From e8dec0bf64310ebf9e33af19c455ee3c72631c55 Mon Sep 17 00:00:00 2001 From: Chris Berkhout Date: Sat, 3 Aug 2024 17:15:17 +0200 Subject: [PATCH] Update Alpha Vantage rate limit handling. --- src/pricehist/sources/alphavantage.py | 4 ++-- tests/pricehist/sources/test_alphavantage.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pricehist/sources/alphavantage.py b/src/pricehist/sources/alphavantage.py index e60f0f6..c42d490 100644 --- a/src/pricehist/sources/alphavantage.py +++ b/src/pricehist/sources/alphavantage.py @@ -337,8 +337,8 @@ class AlphaVantage(BaseSource): def _raise_for_generic_errors(self, data): if type(data) is dict: - if "Note" in data and "call frequency" in data["Note"]: - raise exceptions.RateLimit(data["Note"]) + if "Information" in data and "daily rate limits" in data["Information"]: + raise exceptions.RateLimit(data["Information"]) if ( "Information" in data and "unlock" in data["Information"] diff --git a/tests/pricehist/sources/test_alphavantage.py b/tests/pricehist/sources/test_alphavantage.py index 8ff70cc..40febb0 100644 --- a/tests/pricehist/sources/test_alphavantage.py +++ b/tests/pricehist/sources/test_alphavantage.py @@ -59,11 +59,11 @@ digital_url = re.compile( ) rate_limit_json = ( - '{ "Note": "' - "Thank you for using Alpha Vantage! Our standard API call frequency is 5 " - "calls per minute and 500 calls per day. Please visit " - "https://www.alphavantage.co/premium/ if you would like to target a higher " - "API call frequency." + '{ "Information": "' + "Thank you for using Alpha Vantage! Our standard API rate limit is 25 " + "requests per day. Please subscribe to any of the premium plans at " + "https://www.alphavantage.co/premium/ to instantly remove all daily rate " + "limits." '" }' )