Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise for status when Yahoo! returns 403 / use User-Agent header #74

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Add mock raise_for_status().
Rudd-O authored Feb 22, 2023
commit 69ff2081899879648e60ef9cf743fddc5e250c45
4 changes: 4 additions & 0 deletions beanprice/sources/yahoo_test.py
Original file line number Diff line number Diff line change
@@ -26,6 +26,10 @@ def __init__(self, contents, status_code=requests.codes.ok):
def json(self, **kwargs):
return json.loads(self.contents, **kwargs)

def raise_for_status(self):
if self.status_code != requests.codes.ok:
raise HTTPError(self.status_code)


class YahooFinancePriceFetcher(unittest.TestCase):