def ccurlPost(url,value):
hdr = "Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:45.0) Gecko/20100101 Firefox/45.0"
c = pycurl.Curl()
if value == "no_redir":
print("no redirect")
else:
c.setopt(c.FOLLOWLOCATION, True)
c.setopt(c.USERAGENT, hdr)
if value != "" and value != "no_redir":
post_data = {'id': value}
post_d = urllib.parse.urlencode(post_data)
c.setopt(c.POSTFIELDS,post_d)
#if rfr != "":
# c.setopt(pycurl.REFERER, rfr)
url = str(url)
c.setopt(c.URL, url)
storage = BytesIO()
c.setopt(c.WRITEDATA, storage)
c.perform()
c.close()
content = storage.getvalue()
content = getContentUnicode(content)
return (content)
评论列表
文章目录