Python mechanize is unresponsive

Asked 1 years ago, Updated 1 years ago, 73 views

If you run the script below, you will not get a response.

import mechanismize

b=mechanize.Browser();
b.set_handle_robots (False);
h=b.open('http://stocks.finance.yahoo.co.jp/stocks/detail/?code=2726');

Other url (such as http://www.google.com) will respond properly.
Why?

python mechanize

2022-09-30 20:48

1 Answers

This is stock price information, so I think it is caused by regular refresh.
Specify set_handle_refresh(False) to disable the Refresh header.
Verified a response.

import mechanismize

b=mechanize.Browser()
b. set_handle_robots (False)
b. set_handle_refresh (False)
h=b.open('http://stocks.finance.yahoo.co.jp/stocks/detail/?code=2726')

In detail, python does not require ;.
Even if there is one, it doesn't make an error...


2022-09-30 20:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.