def myopen_http(method, url, values):
if not url:
raise ValueError("cannot submit, no URL provided")
## FIXME: should test that it's not a relative URL or something
try:
from urllib import urlencode, urlopen
except ImportError: # Python 3
from urllib.request import urlopen
from urllib.parse import urlencode
if method == 'GET':
if '?' in url:
url += '&'
else:
url += '?'
url += urlencode(values)
data = None
else:
data = urlencode(values).encode('utf-8')
return urlopen(url, data)
#
# main_domain_stat='file:///Users/Zharkov/Downloads/test2.htm'
#
# page=html.parse(main_domain_stat)
#
# e = page.getroot().\
# find_class('cl_hr').\
# pop()
#
# t=e.getchildren().pop()
#
# print(e, t)
评论列表
文章目录