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'
I have the same situation.
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
Most helpful comment
I have the same situation.