Skip to content

Commit

Permalink
Set default auth=UNSET in httpx client
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed Oct 16, 2020
1 parent c70a805 commit d665438
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions authlib/integrations/httpx_client/oauth2_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def __init__(self, client_id=None, client_secret=None,
def handle_error(error_type, error_description):
raise OAuthError(error_type, error_description)

async def request(self, method, url, withhold_token=False, auth=None, **kwargs):
async def request(self, method, url, withhold_token=False, auth=UNSET, **kwargs):
if not withhold_token and auth is UNSET:
if not self.token:
raise MissingTokenError()
Expand Down Expand Up @@ -112,9 +112,9 @@ async def ensure_active_token(self):
# Notify coroutines that token is refreshed
self._token_refresh_event.set()
return
await self._token_refresh_event.wait() # wait until the token is ready
await self._token_refresh_event.wait() # wait until the token is ready

async def _fetch_token(self, url, body='', headers=None, auth=None,
async def _fetch_token(self, url, body='', headers=None, auth=UNSET,
method='POST', **kwargs):
if method.upper() == 'POST':
resp = await self.post(
Expand All @@ -133,7 +133,7 @@ async def _fetch_token(self, url, body='', headers=None, auth=None,
return self.parse_response_token(resp.json())

async def _refresh_token(self, url, refresh_token=None, body='',
headers=None, auth=None, **kwargs):
headers=None, auth=UNSET, **kwargs):
resp = await self.post(
url, data=dict(url_decode(body)), headers=headers,
auth=auth, **kwargs)
Expand All @@ -150,7 +150,7 @@ async def _refresh_token(self, url, refresh_token=None, body='',

return self.token

def _http_post(self, url, body=None, auth=None, headers=None, **kwargs):
def _http_post(self, url, body=None, auth=UNSET, headers=None, **kwargs):
return self.post(
url, data=dict(url_decode(body)),
headers=headers, auth=auth, **kwargs)
Expand Down Expand Up @@ -187,7 +187,7 @@ def __init__(self, client_id=None, client_secret=None,
def handle_error(error_type, error_description):
raise OAuthError(error_type, error_description)

def request(self, method, url, withhold_token=False, auth=None, **kwargs):
def request(self, method, url, withhold_token=False, auth=UNSET, **kwargs):
if not withhold_token and auth is UNSET:
if not self.token:
raise MissingTokenError()
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ deps =
py27: unittest2
flask: Flask
flask: Flask-SQLAlchemy
py3: httpx==0.14.3
py3: httpx
py3: pytest-asyncio
py3: starlette
py3: itsdangerous
Expand Down

0 comments on commit d665438

Please sign in to comment.