我有一幅长篇的文字,用尿布2进行了一系列的呼声。 The url is on http, but requires accreditation. 目前,我正试图管理这本书,这样它将发出100多次电话。 每当我管理该书时,有些电话都出现错误,编号为401,有些通过。 所有电话都使用相同的用户名称和密码。 (每当我手写时,这并不是同一个呼吁失败,有时是第一场呼吁失败,有时是失败的。)
为什么可能出现401人的想法不一致?
The error message printed to the screen is...
这里是用来发出呼声的方法:
def simpleExecuteRequest(minX, minY, maxX, maxY, type) :
url = http://myhost.com/geowebcache/rest/seed/mylayer.xml
msgTemplate = """<?xml version="1.0" encoding="UTF-8"?>
<seedRequest>
<name>mylayer</name>
<bounds>
<coords>
<double>%s</double>
<double>%s</double>
<double>%s</double>
<double>%s</double>
</coords>
</bounds>
<gridSetId>nyc</gridSetId>
<zoomStart>0</zoomStart>
<zoomStop>10</zoomStop>
<format>image/png</format>
<type>%s</type>
<threadCount>1</threadCount>
</seedRequest>
"""
message = msgTemplate%(minX, minY, maxX, maxY, type)
headers = { User-Agent : "Python script", Content-type : text/xml; charset="UTF-8" , Content-length : %d % len(message) }
passwordManager = urllib2.HTTPPasswordMgrWithDefaultRealm()
passwordManager.add_password(None, url, username , xxx )
authenticationHandler = urllib2.HTTPBasicAuthHandler(passwordManager)
proxyHandler = urllib2.ProxyHandler({})
opener = urllib2.build_opener(proxyHandler, authenticationHandler)
urllib2.install_opener(opener)
try :
request = urllib2.Request(url, message, headers)
response = urllib2.urlopen(request)
content = response.read()
print success
except IOError, e:
print e
有时,产出将照此办理......
<urlopen error (10053, Software caused connection abort )>
success
success
<urlopen error (10053, Software caused connection abort )>
<urlopen error (10053, Software caused connection abort )>
...
在1分钟后,委员会不妨照此办理。
success
<urlopen error (10053, Software caused connection abort )>
success
success
<urlopen error (10053, Software caused connection abort )>
On both runs the same series of inputs for min/max x/y and type were provided in the same order. ...