johnwmillr / LyricsGenius

Download song lyrics and metadata from Genius.com 🎢🎀
http://www.johnwmillr.com/scraping-genius-lyrics/
MIT License
878 stars 159 forks source link

Enforce rate limiting #262

Open mohansaidinesh opened 9 months ago

mohansaidinesh commented 9 months ago

Iam getting the bug at :

Code: artist = genius.search_artist("Andy Shauf", max_songs=3, sort="title", include_features=True) print(artist.songs)

Bug: HTTPError: 403 Client Error: Forbidden for url: https://genius.com/api/search/multi?q=Andy+Shauf

During handling of the above exception, another exception occurred:

HTTPError Traceback (most recent call last) /usr/local/lib/python3.10/dist-packages/lyricsgenius/api/base.py in _makerequest(self, path, method, params, public_api, web, **kwargs) 86 error = get_description(e) 87 if response.status_code < 500 or tries > self.retries: ---> 88 raise HTTPError(response.status_code, error) 89 90 # Enforce rate limiting

HTTPError: [Errno 403] 403 Client Error: Forbidden for url: https://genius.com/api/search/multi?q=Andy+Shauf

allerter commented 9 months ago

Sadly, the API docs don't provide any info regarding rate limiting. So, the only option is to put a wait there with a reasonable wait time.

On Fri, Sep 22, 2023, 19:18 MOHAN SAI DINESH BODDAPATI < @.***> wrote:

Iam getting the bug at :

Code: artist = genius.search_artist("Andy Shauf", max_songs=3, sort="title", include_features=True) print(artist.songs)

Bug: HTTPError: 403 Client Error: Forbidden for url: https://genius.com/api/search/multi?q=Andy+Shauf

During handling of the above exception, another exception occurred:

HTTPError Traceback (most recent call last) /usr/local/lib/python3.10/dist-packages/lyricsgenius/api/base.py https://localhost:8080/# in make_request(self, path, method, params, public_api, web, **kwargs) 86 error = get_description(e) 87 if response.status_code < 500 or tries > self.retries: ---> 88 raise HTTPError(response.status_code, error) 89 90 # Enforce rate limiting

HTTPError: [Errno 403] 403 Client Error: Forbidden for url: https://genius.com/api/search/multi?q=Andy+Shauf

β€” Reply to this email directly, view it on GitHub https://github.com/johnwmillr/LyricsGenius/issues/262, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKX455BKOFHCQXVACRMKRI3X3XB55ANCNFSM6AAAAAA5DM4JWE . You are receiving this because you are subscribed to this thread.Message ID: @.***>