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

I got ban from TWSE after running the unit test twice #39

Open
ianlini opened this issue Mar 24, 2018 · 5 comments
Open

I got ban from TWSE after running the unit test twice #39

ianlini opened this issue Mar 24, 2018 · 5 comments
Labels

Comments

@ianlini
Copy link
Contributor

ianlini commented Mar 24, 2018

I got ban from TWSE after running the unit test twice.
I am very sure that I am not running other crawler at the same time.
The unit test is very dangerous. Maybe we should add some delay between requests, or mock almost all the requests.

@mlouielu
Copy link
Owner

What kind of ban do you get? The whole RealtimeTest get failed? I'm currently fixing this issue for the unittest.

@ianlini
Copy link
Contributor Author

ianlini commented Mar 26, 2018

While calling TWSEFetcher.fetch, I got [Errno 101] Network is unreachable, and my browser cannot open http://www.tse.com.tw/. It's a typical ban when you request TWSE too frequently.

@mlouielu
Copy link
Owner

I can reproduce this when doing the unittest twice

...
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='www.twse.com.tw', port=80): Max retries exceeded with url: /exchangeReport/STOCK_DAY?date=20180101&stockNo=2330 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f5432992898>: Failed to establish a new connection: [Errno 101] Network is unreachable',))

@mlouielu mlouielu added the bug label Mar 26, 2018
@Evanstsai
Copy link

Evanstsai commented May 31, 2018

我也有類似的問題
我成功執行一次,但第二次就不work了
HTTPConnectionPool(host='www.twse.com.tw', port=80): Max retries exceeded with url: /exchangeReport/STOCK_DAY?date=20180401&stockNo=2303 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10f8c40f0>: Failed to establish a new connection: [Errno 61] Connection refused',))

@mlouielu
Copy link
Owner

I've try using request.Session, but it still don't work :(

someone said the limit is 5s/3 query

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

No branches or pull requests

3 participants