Skip to content

Commit

Permalink
add user agent
Browse files Browse the repository at this point in the history
  • Loading branch information
RuslanUC committed Sep 19, 2022
1 parent b044264 commit ffbc562
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions remoteauthclient/remoteauthclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def getAvatarURL(self) -> str:
return f"https://cdn.discord.com/avatars/{self.id}/{self.avatar}.png"

class RemoteAuthClient:
def __init__(self, proxy=None, proxy_auth=None):
def __init__(self, proxy=None, proxy_auth=None, user_agent=None):
self._task = None
self._heartbeatTask = None
self._ws = None
Expand All @@ -51,6 +51,7 @@ def __init__(self, proxy=None, proxy_auth=None):

self.proxy = proxy
self.proxy_auth = proxy_auth
self.user_agent = user_agent or "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36"

@property
def retries(self) -> int:
Expand Down Expand Up @@ -120,7 +121,7 @@ async def _getToken(self, ticket: str, captcha_key: Optional[str]=None) -> Optio
_proxy["proxy"] = f"http://{self.proxy}"
if self.proxy_auth:
_proxy["proxy_auth"] = BasicAuth(**self.proxy_auth)
async with ClientSession() as sess:
async with ClientSession(headers={"User-Agent": self.user_agent}) as sess:
data = {"ticket": ticket}
if captcha_key:
data["captcha_key"] = 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.0b2',
version='1.4.0b3',
packages=["remoteauthclient"],
long_description=open(join(dirname(__file__), 'README.md')).read(),
long_description_content_type="text/markdown",
Expand Down

0 comments on commit ffbc562

Please sign in to comment.