Closed Kyumagi closed 3 years ago
This error doesn't have anything to do with the artist your search. It means that your device couldn't read the data from Genius in time. If you're on version 3, I suggest you try this configuration:
genius = Genius(ACCESS_TOKEN, timeout=15, retries=3)
If you still get that error after setting this configuration, try these methods and see if they give you the timeout error as well:
song = genius.song(1)
artist = genius.artist(1)
If they do, it means something's wrong with your connection to Genius. You should investigate that and maybe try using a proxy. If they don't, it means that something goes wrong when your computer tries to get data from Genius Web API (genius.com/api). This API isn't officially supported and all I can suggest is using a proxy.
On a separate note, make sure to mask your access token when posting your code. I removed it from your question, but you shouldn't use that anymore and generate a new one.
Thanks for your help; I used genius = Genius(ACCESS_TOKEN, timeout=15, retries=3)
in my script. but sometimes it works and sometimes it doesn't. I think i should use a proxy as you said(I don't know how to use a proxy please tell me how :D).
I tried song = genius.song(1)
and artist = genius.artist(1)
and they worked well.
And... that wasn't exactly my API; I had changed a few of characters before posting. thanks anyway <3.
I usually use a VPN when dealing with Genius. You could do this too, but you should beware that Genius has captcha enabled and requests from some VPN servers hit that captcha. I don't know if that's also the case for proxies, but there are a few ways to use proxies when using the reuqests
package. Although it's already been explained by the Requests documentation and in StackOverflow answers, I'll explain briefly how to do it with LyricsGenius:
import os
import lyricsgenius as lg
os.environ['HTTP_PROXY'] = os.environ['http_proxy'] = 'http://http-connect-proxy:3128/'
os.environ['HTTPS_PROXY'] = os.environ['https_proxy'] = 'http://http-connect-proxy:3128/'
os.environ['NO_PROXY'] = os.environ['no_proxy'] = '127.0.0.1,localhost,.local'
genius = lg.Genius(ACCESS_TOKEN, ...)
import lyricsgenius as lg
proxies = {
'http': 'http://user:pass@10.10.1.0:3128',
'https': 'https://user:pass@10.10.1.0:3128',
}
genius = lg.Genius(ACCESS_TOKEN, ...)
genius._session.proxies = proxies
If you need further information about using proxies, please refer to the links above.
Hello! I tried to
search_artist
"eminem" but i got the "HTTPSConnectionPool(host='genius.com', port=443): Read timed out. (read timeout=5)" error. I tried to search "drake" and "Sia" instead of "eminem" but got this error again. here is my code and the error:Please help me fix this error. Sorry for my bad english, I'm not a native speaker.