Skip to content

Commit

Permalink
Percent-encode colons in URL query values for AsyncClient.request
Browse files Browse the repository at this point in the history
  • Loading branch information
Harmon758 committed May 18, 2022
1 parent 8d54410 commit fa73d70
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tweepy/asynchronous/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ async def request(
url, headers, body = oauth_client.sign(
url, method, headers=headers
)
# oauthlib.oauth1.Client (OAuthClient) expects colons in query
# values (e.g. in timestamps) to be percent-encoded, while
# aiohttp.ClientSession does not automatically encode them
before_query, question_mark, query = url.partition('?')
url = URL(
f"{before_query}?{query.replace(':', '%3A')}",
encoded = True
)
params = None
else:
headers["Authorization"] = f"Bearer {self.bearer_token}"
Expand Down

0 comments on commit fa73d70

Please sign in to comment.