<small id='NVe1W'></small><noframes id='NVe1W'>

  • <legend id='NVe1W'><style id='NVe1W'><dir id='NVe1W'><q id='NVe1W'></q></dir></style></legend>

    <i id='NVe1W'><tr id='NVe1W'><dt id='NVe1W'><q id='NVe1W'><span id='NVe1W'><b id='NVe1W'><form id='NVe1W'><ins id='NVe1W'></ins><ul id='NVe1W'></ul><sub id='NVe1W'></sub></form><legend id='NVe1W'></legend><bdo id='NVe1W'><pre id='NVe1W'><center id='NVe1W'></center></pre></bdo></b><th id='NVe1W'></th></span></q></dt></tr></i><div id='NVe1W'><tfoot id='NVe1W'></tfoot><dl id='NVe1W'><fieldset id='NVe1W'></fieldset></dl></div>
      <bdo id='NVe1W'></bdo><ul id='NVe1W'></ul>

    1. <tfoot id='NVe1W'></tfoot>

        Python urllib2.open 连接由对等错误重置

        Python urllib2.open Connection reset by peer error(Python urllib2.open 连接由对等错误重置)
          <bdo id='l3Zvy'></bdo><ul id='l3Zvy'></ul>

        • <i id='l3Zvy'><tr id='l3Zvy'><dt id='l3Zvy'><q id='l3Zvy'><span id='l3Zvy'><b id='l3Zvy'><form id='l3Zvy'><ins id='l3Zvy'></ins><ul id='l3Zvy'></ul><sub id='l3Zvy'></sub></form><legend id='l3Zvy'></legend><bdo id='l3Zvy'><pre id='l3Zvy'><center id='l3Zvy'></center></pre></bdo></b><th id='l3Zvy'></th></span></q></dt></tr></i><div id='l3Zvy'><tfoot id='l3Zvy'></tfoot><dl id='l3Zvy'><fieldset id='l3Zvy'></fieldset></dl></div>

            <small id='l3Zvy'></small><noframes id='l3Zvy'>

          1. <tfoot id='l3Zvy'></tfoot>
              <legend id='l3Zvy'><style id='l3Zvy'><dir id='l3Zvy'><q id='l3Zvy'></q></dir></style></legend>

                    <tbody id='l3Zvy'></tbody>
                  本文介绍了Python urllib2.open 连接由对等错误重置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试使用 python 抓取页面

                  I'm trying to scrape a page using python

                  问题是,我不断收到对等方重置 Errno54 连接.

                  The problem is, I keep getting Errno54 Connection reset by peer.

                  运行此代码时出现错误 -

                  The error comes when I run this code -

                  urllib2.urlopen("http://www.bkstr.com/webapp/wcs/stores/servlet/CourseMaterialsResultsView?catalogId=10001&categoryId=9604&storeId=10161&langId=-1&programId=562&termId=100020629&divisionDisplayName=Stanford&departmentDisplayName=ILAC&courseDisplayName=126&sectionDisplayName=01&demoKey=d&purpose=browse")
                  

                  此页面上的所有网址都会发生这种情况 - 有什么问题?

                  this happens for all the urls on this pag- what is the issue?

                  推荐答案

                  $> telnet www.bkstr.com 80
                  Trying 64.37.224.85...
                  Connected to www.bkstr.com.
                  Escape character is '^]'.
                  GET /webapp/wcs/stores/servlet/CourseMaterialsResultsView?catalogId=10001&categoryId=9604&storeId=10161&langId=-1&programId=562&termId=100020629&divisionDisplayName=Stanford&departmentDisplayName=ILAC&courseDisplayName=126&sectionDisplayName=01&demoKey=d&purpose=browse HTTP/1.0
                  
                  Connection closed by foreign host.
                  

                  从 python 或其他任何地方获取该 URL 不会有任何乐趣.如果它在您的浏览器中工作,那么肯定有其他事情发生,例如 cookie 或身份验证等.或者,可能是服务器坏了,或者他们改变了配置.

                  You're not going to have any joy fetching that URL from python, or anywhere else. If it works in your browser then there must be something else going on, like cookies or authentication or some such. Or, possibly, the server's broken or they've changed their configuration.

                  尝试在您以前从未访问过该网站的浏览器中打开它以进行检查.然后登录并重试.

                  Try opening it in a browser that you've never accessed that site in before to check. Then log in and try it again.

                  毕竟是 cookie:

                  It was cookies after all:

                  import cookielib, urllib2
                  
                  cj = cookielib.CookieJar()
                  opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
                  #Need to set a cookie
                  opener.open("http://www.bkstr.com/")
                  #Now open the page we want
                  data = opener.open("http://www.bkstr.com/webapp/wcs/stores/servlet/CourseMaterialsResultsView?catalogId=10001&categoryId=9604&storeId=10161&langId=-1&programId=562&termId=100020629&divisionDisplayName=Stanford&departmentDisplayName=ILAC&courseDisplayName=126&sectionDisplayName=01&demoKey=d&purpose=browse").read()
                  

                  输出看起来不错,但您必须检查它是否符合您的要求:)

                  The output looks ok, but you'll have to check that it does what you want :)

                  这篇关于Python urllib2.open 连接由对等错误重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Running .jl file from R or Python(从 R 或 Python 运行 .jl 文件)
                  Running Julia .jl file in python(在 python 中运行 Julia .jl 文件)
                  Using PIP in a Azure WebApp(在 Azure WebApp 中使用 PIP)
                  How to run python3.7 based flask web api on azure(如何在 azure 上运行基于 python3.7 的烧瓶 web api)
                  Azure Python Web App Internal Server Error(Azure Python Web 应用程序内部服务器错误)
                  Run python dlib library on azure app service(在 azure app 服务上运行 python dlib 库)

                          <i id='YG2Ox'><tr id='YG2Ox'><dt id='YG2Ox'><q id='YG2Ox'><span id='YG2Ox'><b id='YG2Ox'><form id='YG2Ox'><ins id='YG2Ox'></ins><ul id='YG2Ox'></ul><sub id='YG2Ox'></sub></form><legend id='YG2Ox'></legend><bdo id='YG2Ox'><pre id='YG2Ox'><center id='YG2Ox'></center></pre></bdo></b><th id='YG2Ox'></th></span></q></dt></tr></i><div id='YG2Ox'><tfoot id='YG2Ox'></tfoot><dl id='YG2Ox'><fieldset id='YG2Ox'></fieldset></dl></div>

                          <legend id='YG2Ox'><style id='YG2Ox'><dir id='YG2Ox'><q id='YG2Ox'></q></dir></style></legend>

                            <bdo id='YG2Ox'></bdo><ul id='YG2Ox'></ul>

                            <small id='YG2Ox'></small><noframes id='YG2Ox'>

                          • <tfoot id='YG2Ox'></tfoot>
                              <tbody id='YG2Ox'></tbody>