PycURL 自动处理cookie,PycURL处理cookie,import pycur
文章由Byrx.net分享于2019-03-23 09:03:15
PycURL 自动处理cookie,PycURL处理cookie,import pycur
import pycurlimport StringIOurl = "<a href="http://www.google.com/">http://www.google.com/"crl = pycurl.Curl()crl.setopt(pycurl.VERBOSE,1)crl.setopt(pycurl.FOLLOWLOCATION, 1)crl.setopt(pycurl.MAXREDIRS, 5)crl.fp = StringIO.StringIO()crl.setopt(pycurl.URL, url)crl.setopt(crl.WRITEFUNCTION, crl.fp.write)# Option -b/--cookie <name=string/file> Cookie string or file to read cookies from# Note: must be a string, not a file object.crl.setopt(pycurl.COOKIEFILE, "cookie_file_name")# Option -c/--cookie-jar <file> Write cookies to this file after operation# Note: must be a string, not a file object.crl.setopt(pycurl.COOKIEJAR, "cookie_file_name")crl.perform()print crl.fp.getvalue()#该片段来自于http://byrx.net
相关内容
- 从dmesg命令中检查nfs相关错误,dmesg命令nfs错误,#! /usr
- python根据给定的文件返回文件名和扩展名,python给定
- python通过PyGame模块播放声音,pythonpygame,import pygam
- 由域名获取该域名的ip地址,获取域名ip地址,主要还是
- python 多线程,python,#coding=utf-
- 抓取图片示例,抓取示例,#!/usr/bin/p
- django 简单显示数据库的内容,django数据库内容,index.h
- python常用列表(数组)操作演示,python操作演示,s = [
- 在Python中的高斯 - 赛德尔方法,python赛德尔,''' x,numIt
- python通过apply使用元祖和列表调用函数,pythonapply,def
评论关闭