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
Rate limit edgar requests #24
Comments
For anyone that hits this, I'm able to work around this pretty seamlessly by using requests-random-user-agent. In my use case, the primary issue seems to be the lack of a custom user agent, resulting in automation denial much sooner. If I am not doing an excessive amount of scraping then I can mostly not worry about the rate limiting for now. Just importing the library is enough for any subsequent calls to |
I'm seeing this error as well. It's throwing an error on line 18 of |
@rpocase Do you think you can submit a MR for it? |
@joeyism I'd love to, but don't know that I'll find the time to do a proper fix. My workaround has been sufficient for my needs, but I wouldn't recommend introducing it into the base library as the "right" fix. |
Just slow it down with
|
I think there are two issues blended together hear. Rate limiting and user agent string. I am working on a fix for the user agent string that uses a singleton session object where you can set default headers. This also has the added benefit of reusing a pooled TCP connection. As far as rate limiting goes the SEC should return a 429 and that should be handled with some sort of back off. Has anyone confirmed that the SEC returns a 429? They are also beta testing RESTful APIs so this may all be moot. |
Unless anything has changed since issue creation, they respond with a |
final_url = 'https://www.sec.gov/Archives/edgar/data/0000866273/000086627321000088/0000866273-21-000088-index.htm' I am using the above code to scrap filing from the sec.gov website using a random user-agent. for random user-agent I have used a fake user agent package. Still, I am facing HTTP Error 403. What is the solution to avoid 403 errors? It was working before I am have been facing Error 403 for the last few days. |
Follow https://www.sec.gov/os/webmaster-faq#developers on how to formulate the headers for user-agent. Even a fake email would work. I think they are doing some regex matching only |
Thanks, buddy. A few weeks earlier I came across the article, SEC has restricted their request and in URL one has to define hostname, user agent with email id. I have used my email address to access the filing link and it is now working. |
@mahantymanoj |
@joeyism |
* Added new required request headers for SEC EDGAR * Added UTF-8 header * Changed dependecy from broken fuzzwuzz to new rapidfuzz. Fixes joeyism#28 * Fixes joeyism#24 (with user comment poor-mans patch for checking rate limits) * minor formatting adjustments for code readabiltiy Changes to be committed: modified: edgar/company.py modified: edgar/document.py modified: edgar/edgar.py modified: requirements.txt
|
@mahantymanoj |
edit done... |
* Added new required request headers for SEC EDGAR * Added UTF-8 header * Changed dependecy from broken fuzzwuzz to new rapidfuzz. Fixes #28 * Fixes #24 (with user comment poor-mans patch for checking rate limits) * minor formatting adjustments for code readabiltiy Changes to be committed: modified: edgar/company.py modified: edgar/document.py modified: edgar/edgar.py modified: requirements.txt
The folks at the SEC published some "guidance" on their FAQ that includes sample request headers. You can find it here. |
The SEC website recently (within the last couple months) added rate limiting to their website. Currently, none of this libraries requests properly respond to it. This leads to hard to decode errors and makes this generally much less usable in a scripted fashion. When an IP is detected as needing rate limiting, the SEC website returns a
403
response with a body that looks like the below text.The text was updated successfully, but these errors were encountered: