3

私はインターネット全体を見ましたが、このエラーを解決する方法がわかりません。何が起こっているか知っている人はいますか?

コード:

for index in range(len(sections)):      
    br.select_form(name="win1")
    post_url, post_data, headers =  br.form.click_request_data()
    post_data = post_data.replace("ICAction=None", "ICAction=DERIVED_CLSRCH_SSR_CLASSNAME_LONG$"+str(index))
    r = br.open(post_url, post_data) ##ERROR ON THIS LINE
    html = r.read()

    if index < range(len(sections)):
        br.select_form(name="win1")
        post_url, post_data, headers =  br.form.click_request_data()
        post_data = post_data.replace("ICAction=None", "ICAction=CLASS_SRCH_WRK2_SSR_PB_BACK")
        r = br.open(post_url, post_data)
        html = r.read()

エラーログ

[Sun Aug 12 22:28:04 2012] [error] Traceback (most recent call last):
[Sun Aug 12 22:28:04 2012] [error]   File "C:/wamp/www/python/scrape.py", line 131, in application
[Sun Aug 12 22:28:04 2012] [error]     r = br.open(post_url, post_data)
[Sun Aug 12 22:28:04 2012] [error]   File "build\\bdist.win-amd64\\egg\\mechanize\\_mechanize.py", line 203, in open
[Sun Aug 12 22:28:04 2012] [error]     return self._mech_open(url, data, timeout=timeout)
[Sun Aug 12 22:28:04 2012] [error]   File "build\\bdist.win-amd64\\egg\\mechanize\\_mechanize.py", line 230, in _mech_open
[Sun Aug 12 22:28:04 2012] [error]     response = UserAgentBase.open(self, request, data)
[Sun Aug 12 22:28:04 2012] [error]   File "build\\bdist.win-amd64\\egg\\mechanize\\_opener.py", line 193, in open
[Sun Aug 12 22:28:04 2012] [error]     response = urlopen(self, req, data)
[Sun Aug 12 22:28:04 2012] [error]   File "build\\bdist.win-amd64\\egg\\mechanize\\_urllib2_fork.py", line 344, in _open
[Sun Aug 12 22:28:04 2012] [error]     '_open', req)
[Sun Aug 12 22:28:04 2012] [error]   File "build\\bdist.win-amd64\\egg\\mechanize\\_urllib2_fork.py", line 332, in _call_chain
[Sun Aug 12 22:28:04 2012] [error]     result = func(*args)
[Sun Aug 12 22:28:04 2012] [error]   File "build\\bdist.win-amd64\\egg\\mechanize\\_urllib2_fork.py", line 1170, in https_open
[Sun Aug 12 22:28:04 2012] [error]     return self.do_open(conn_factory, req)
[Sun Aug 12 22:28:04 2012] [error]   File "build\\bdist.win-amd64\\egg\\mechanize\\_urllib2_fork.py", line 1118, in do_open
[Sun Aug 12 22:28:04 2012] [error]     raise URLError(err)
[Sun Aug 12 22:28:04 2012] [error] URLError: <urlopen error [Errno 10054] An existing connection was forcibly closed by the remote host>
4

2 に答える 2

1

考えてみると、投稿データが巨大で、リクエストを台無しにしていたと思います。私はそれをトリミングしました、今はうまくいきます。

于 2012-08-13T07:01:44.577 に答える
0

プロトコルのサポートを再確認してください。問題が解決したことを有効にすると、TLS1.0 が無効になっているサーバーに接続しようとすると、このエラー (python 2.7、windows 2008R2 サーバー/IIS 7、windows 7 クライアント) が発生しました。

于 2015-07-28T18:58:17.540 に答える