[GH-ISSUE #195] Issue with requests >requests-2.13.0 #98

Closed
opened 2026-02-27 23:20:49 +03:00 by kerem · 2 comments
Owner

Originally created by @motsu35 on GitHub (Jun 2, 2017).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/195

If you are using a slightly older version of requests, everything is fine in the world... if you are using the most current version, you end up with:

     results = sp.search(q='weezer', limit=20)
  File "/usr/local/lib/python2.7/dist-packages/spotipy/client.py", line 339, in search
    return self._get('search', q=q, limit=limit, offset=offset, type=type, market=market)
  File "/usr/local/lib/python2.7/dist-packages/spotipy/client.py", line 146, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/spotipy/client.py", line 100, in _internal_call
    headers = self._auth_headers()
  File "/usr/local/lib/python2.7/dist-packages/spotipy/client.py", line 90, in _auth_headers
    token = self.client_credentials_manager.get_access_token()
  File "/usr/local/lib/python2.7/dist-packages/spotipy/oauth2.py", line 57, in get_access_token
    token_info = self._request_access_token()
  File "/usr/local/lib/python2.7/dist-packages/spotipy/oauth2.py", line 74, in _request_access_token
    headers=headers, verify=True, proxies=self.proxies)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 112, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 58, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 504, in request
    prep.url, proxies, stream, verify, cert
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 676, in merge_environment_settings
    no_proxy = proxies.get('no_proxy') if proxies is not None else None
AttributeError: 'str' object has no attribute 'get'
Originally created by @motsu35 on GitHub (Jun 2, 2017). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/195 If you are using a slightly older version of requests, everything is fine in the world... if you are using the most current version, you end up with: ``` results = sp.search(q='weezer', limit=20) File "/usr/local/lib/python2.7/dist-packages/spotipy/client.py", line 339, in search return self._get('search', q=q, limit=limit, offset=offset, type=type, market=market) File "/usr/local/lib/python2.7/dist-packages/spotipy/client.py", line 146, in _get return self._internal_call('GET', url, payload, kwargs) File "/usr/local/lib/python2.7/dist-packages/spotipy/client.py", line 100, in _internal_call headers = self._auth_headers() File "/usr/local/lib/python2.7/dist-packages/spotipy/client.py", line 90, in _auth_headers token = self.client_credentials_manager.get_access_token() File "/usr/local/lib/python2.7/dist-packages/spotipy/oauth2.py", line 57, in get_access_token token_info = self._request_access_token() File "/usr/local/lib/python2.7/dist-packages/spotipy/oauth2.py", line 74, in _request_access_token headers=headers, verify=True, proxies=self.proxies) File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 112, in post return request('post', url, data=data, json=json, **kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 58, in request return session.request(method=method, url=url, **kwargs) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 504, in request prep.url, proxies, stream, verify, cert File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 676, in merge_environment_settings no_proxy = proxies.get('no_proxy') if proxies is not None else None AttributeError: 'str' object has no attribute 'get' ```
kerem 2026-02-27 23:20:49 +03:00
Author
Owner

@pemako commented on GitHub (Jan 14, 2018):

I have the same situation.

<!-- gh-comment-id:357510581 --> @pemako commented on GitHub (Jan 14, 2018): I have the same situation.
Author
Owner

@stephanebruckert commented on GitHub (Jan 14, 2020):

proxies.get('no_proxy') 

> AttributeError: 'str' object has no attribute 'get'

Looks like proxies is a string instead of the default None or an expected dict. I'm assuming that you've initialised spotipy with an empty proxies string, i.e.: sp = spotipy.Spotify(auth=token, proxies='')

Closing this for now since the issue is old and context is missing but feel free to re-open

<!-- gh-comment-id:574420001 --> @stephanebruckert commented on GitHub (Jan 14, 2020): proxies.get('no_proxy') > AttributeError: 'str' object has no attribute 'get' Looks like `proxies` is a string instead of the default `None` or an expected dict. I'm assuming that you've initialised spotipy with an empty `proxies` string, i.e.: `sp = spotipy.Spotify(auth=token, proxies='')` Closing this for now since the issue is old and context is missing but feel free to re-open
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#98
No description provided.