def prepare(self, first_url):
tmp_cookie = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(tmp_cookie))
try:
response = opener.open(self.logout_url, timeout=3)
except urllib.HTTPError as e:
logging.warn("server process request error: err_code=%s", e.code)
return -5, None
except urllib.URLError as e:
logging.warn("reach server error: reason=%s", e.reason)
return -10, None
except Exception as e:
logging.warn("other exception: msg=%s", e.message)
return -100, None
for item in tmp_cookie:
self.my_cookie+=item.name + "=" +item.value + ";"
#htm = response.read()
return 0, None
########## post data to request_url ##############
评论列表
文章目录