def METHOD_NAME(self, pyfile):
    try:
        password = self.get_password()
        if password:
            api_data = self.api_request(
                "session/download",
                session_id=self.account.info["data"]["session_id"],
                token=self.account.info["data"]["token"],
                url=pyfile.url,
                password=password,
            )
        else:
            api_data = self.api_request(
                "session/download",
                session_id=self.account.info["data"]["session_id"],
                token=self.account.info["data"]["token"],
                url=pyfile.url,
            )
    except BadHeader as exc:
        if exc.code == 403:
            if password:
                self.fail(self._("Wrong password"))
            else:
                self.fail(self._("Download is password protected"))
        elif exc.code != 200:
            self.log_debug("Download failed, error code {}".format(exc.code))
            self.offline()
    self.link = api_data["location"]