def get_bower_package(self, url, dest=None, version=None,
                          process_deps=True):
        dest = dest or Path(".") / "assets"
        parsed_url = urlparse(url)
        if parsed_url.scheme == "git" or parsed_url.path.endswith(".git"):
            if parsed_url.netloc == "github.com":
                user, repo = parsed_url.path[1:-4].split("/")
                response = get(github_api_uri +
                               "/repos/{}/{}/tags".format(user, repo))
                tags = response.json()
                target = None
                if not len(tags):
                    click.secho("fatal: no tags exist for {}/{}".format(
                        user, repo), fg="red")
                    raise InvalidPackageError
                if version is None:
                    target = tags[0]
                else:
                    for tag in tags:
                        if semver.match(tag["name"],
                                        Bower.clean_semver(version)):
                            target = tag
                            break
                if not target:
                    click.secho(
                        "fatal: failed to find matching tag for "
                        "{user}/{repo} {version}".format(user, repo, version),
                        fg="red")
                    raise VersionNotFoundError
                click.secho("installing {}/{}#{}".format(
                    user, repo, tags[0]["name"]), fg="green")
                return self.get_bower_package(
                    url=target["zipball_url"],
                    dest=dest,
                    version=version)
            raise NotImplementedError
            click.echo("git clone {url}".format(url=url))
            cmd = envoy.run('git clone {url} "{dest}"'.format(
                url=url, dest=dest))
        elif parsed_url.scheme in ("http", "https"):
            zip_dest = download_file(url, dest=self.temp_dir,
                                     label="{dest_basename}",
                                     expected_extension="zip")
            with zipfile.ZipFile(zip_dest, "r") as pkg:
                return self.extract_bower_zipfile(pkg, dest,
                                                  expected_version=version)
                # pkg.extractall(str(dest))
        else:
            click.secho("protocol currently unsupported :(")
            sys.exit(1)
def send_request(self, copy_id_photo_from=None):
        """
        Assembles a submission to Software Secure and sends it via HTTPS.

        Keyword Arguments:
            copy_id_photo_from (SoftwareSecurePhotoVerification): If provided, re-send the ID photo
                data from this attempt.  This is used for reverification, in which new face photos
                are sent with previously-submitted ID photos.

        Returns:
            request.Response

        """
        # If AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING is True, we want to
        # skip posting anything to Software Secure. We actually don't even
        # create the message because that would require encryption and message
        # signing that rely on settings.VERIFY_STUDENT values that aren't set
        # in dev. So we just pretend like we successfully posted
        if settings.FEATURES.get('AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING'):
            fake_response = requests.Response()
            fake_response.status_code = 200
            return fake_response

        headers, body = self.create_request(copy_id_photo_from=copy_id_photo_from)
        response = requests.post(
            settings.VERIFY_STUDENT["SOFTWARE_SECURE"]["API_URL"],
            headers=headers,
            data=json.dumps(body, indent=2, sort_keys=True, ensure_ascii=False).encode('utf-8'),
            verify=False
        )

        log.info(u"Sent request to Software Secure for receipt ID %s.", self.receipt_id)
        if copy_id_photo_from is not None:
            log.info(
                (
                    u"Software Secure attempt with receipt ID %s used the same photo ID "
                    u"data as the receipt with ID %s"
                ),
                self.receipt_id, copy_id_photo_from.receipt_id
            )

        log.debug("Headers:\n{}\n\n".format(headers))
        log.debug("Body:\n{}\n\n".format(body))
        log.debug(u"Return code: {}".format(response.status_code))
        log.debug(u"Return message:\n\n{}\n\n".format(response.text))

        return response