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

Adding custom user-agent, bypass Yahoo's block #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lxwang
Copy link

@lxwang lxwang commented Jul 21, 2021

It seems like Yahoo blocked python user agent. Changing the agent to "custom" seems to fix it.

It seems like Yahoo blocked python user agent. Changing the agent to "custom" seems to fix it.
@bigAl32
Copy link

bigAl32 commented Jul 30, 2021

This fixed worked for a couple of days

page = requests.get(url, headers={'User-Agent':'Custom'})

but now I'm getting the same error again, anyone else?

Traceback (most recent call last):
File "/Users/alex/PycharmProjects/Narus/scratch/scr8.py", line 35, in
yec_raw = pd.DataFrame(yec.earnings_between(date_from, date_to))
File "/Users/alex/PycharmProjects/Narus/venv/lib/python3.7/site-packages/yahoo_earnings_calendar/scraper.py", line 139, in earnings_between
earnings_data += self.earnings_on(current_date)
File "/Users/alex/PycharmProjects/Narus/venv/lib/python3.7/site-packages/yahoo_earnings_calendar/scraper.py", line 93, in earnings_on
page_data_dict = self._get_data_dict(dated_url)
File "/Users/alex/PycharmProjects/Narus/venv/lib/python3.7/site-packages/yahoo_earnings_calendar/scraper.py", line 39, in _get_data_dict
'\n') if row.startswith('root.App.main = ')][0][:-1]
IndexError: list index out of range

@edouardswiac
Copy link

edouardswiac commented Mar 7, 2022

If you are relying on earnings dates to make actual money you should use a robust service like earningscalendar.net, else you'll be spending more time playing cat and mouse updating your scraper to avoid blocks instead of actually trading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants