Skip to content

Commit

Permalink
fix captcha and update version to 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
RuslanUC committed Oct 9, 2022
1 parent ffbc562 commit 53fc708
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion remoteauthclient/remoteauthclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,17 @@ async def _getToken(self, ticket: str, captcha_key: Optional[str]=None) -> Optio
if captcha_key:
data["captcha_key"] = captcha_key
data["captcha_rqtoken"] = self._rqtoken
log.debug(f"Trying to get a token with request body: {data}")
resp = await sess.post("https://discord.com/api/v9/users/@me/remote-auth/login", json=data, **_proxy)
j = await resp.json()
log.debug(f"Response code: {resp.status}")
log.debug(f"Response body: {j}")
if "encrypted_token" not in j and captcha_key is None and j.get("captcha_key") == "captcha-required":
if "encrypted_token" not in j and captcha_key is None and "captcha_key" in j:
log.debug(f"Detected captcha response. Calling on_captcha method with {j}")
del j["captcha_key"]
self._rqtoken = j["captcha_rqtoken"]
captcha_key = await self._event("captcha", captcha_data=j)
log.debug(f"on_captcha result: {captcha_key}")
if not captcha_key:
return
return await self._getToken(ticket, captcha_key)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name='remoteauthclient',
version='1.4.0b3',
version='1.4.0',
packages=["remoteauthclient"],
long_description=open(join(dirname(__file__), 'README.md')).read(),
long_description_content_type="text/markdown",
Expand Down

0 comments on commit 53fc708

Please sign in to comment.