Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeprecationWarning: Non-string usernames will no longer be supported in Requests 3 #187

Open
michael-k opened this issue May 16, 2018 · 2 comments

Comments

@michael-k
Copy link
Contributor

DeprecationWarning: Non-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (None) to a string or bytes object in the near future to avoid problems.

https://github.com/requests/requests/blob/f3fc892b901abe2c3605f2669af4f6469b896e88/requests/auth.py#L38-L45

Maybe Client._auth should return a function that does the same as HTTPBasicAuth.__call__?

@property
def _auth(self):
return (self.personal_access_token, '')

@michael-k
Copy link
Contributor Author

Stacktrace:

    user = intercom_client.users.find(email=email)
  File "/usr/local/lib/python3.6/site-packages/intercom/api_operations/find.py", line 19, in find
    response = self.client.get("/%s" % (collection), params)
  File "/usr/local/lib/python3.6/site-packages/intercom/client.py", line 91, in get
    return self._execute_request(req, params)
  File "/usr/local/lib/python3.6/site-packages/intercom/client.py", line 84, in _execute_request
    result = request.execute(self.base_url, self._auth, params)
  File "/usr/local/lib/python3.6/site-packages/intercom/request.py", line 36, in execute
    return self.send_request_to_path(base_url, auth, params)
  File "/usr/local/lib/python3.6/site-packages/intercom/request.py", line 75, in send_request_to_path
    auth=auth, verify=certifi.where(), **req_params)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 494, in request
    prep = self.prepare_request(req)
  File "/usr/local/lib/python3.6/site-packages/requests/sessions.py", line 437, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 309, in prepare
    self.prepare_auth(auth, url)
  File "/usr/local/lib/python3.6/site-packages/requests/models.py", line 540, in prepare_auth
    r = auth(self)
  File "/usr/local/lib/python3.6/site-packages/requests/auth.py", line 96, in __call__
    r.headers['Authorization'] = _basic_auth_str(self.username, self.password)
  File "/usr/local/lib/python3.6/site-packages/requests/auth.py", line 44, in _basic_auth_str
    category=DeprecationWarning,
DeprecationWarning: Non-string usernames will no longer be supported in Requests 3.0.0. Please convert the object you've passed in (None) to a string or bytes object in the near future to avoid problems.

@killthekitten
Copy link

killthekitten commented Jun 13, 2019

I realized we had this warning in test environment only, and the quick fix was, well, to override the test config and set it to something other than None. Is that the case for you as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants