spotipy-dev / spotipy

A light weight Python library for the Spotify Web API
http://spotipy.readthedocs.org
MIT License
5.01k stars 956 forks source link

[help] Don't know how to use proxy #449

Closed matze19999 closed 4 years ago

matze19999 commented 4 years ago

Hey guys,

I read the documentation, but I haven't found a tutorial on how to use a proxy... Can someone please help me or write some short lines on how to get spotipy to use a proxy?

Thank you!!

stephanebruckert commented 4 years ago

Hey,

proxies that you pass to spotipy will be passed directly to request.Session(), see here:

https://github.com/plamere/spotipy/blob/13109c1613594e098f5ecddc64edbf465306052b/spotipy/client.py#L150

See if structuring your proxies as showed in the following references helps:

It is likely going to look like:

proxies = {
    “http”: “http://10.10.10.10:8000”,
    “https”: “http://10.10.10.10:8000”
}
spotipy.Spotify(auth_manager=spotipy.SpotifyOAuth(),
                proxies=proxies)

Please let us know how it goes and we can then improve the docs

matze19999 commented 4 years ago

Thanks, this worked like a charm!

Maybe you can add this code example to the folder examples on GitHub or add a code snipped on the readthedocs page :)