手机
当前位置:查字典教程网 >脚本专栏 >python >用Python的urllib库提交WEB表单
用Python的urllib库提交WEB表单
摘要:复制代码代码如下:classEntryDemo(Frame):"""DemonstrateEntrysandEventbinding"""c...

复制代码 代码如下:

class EntryDemo( Frame ):

"""Demonstrate Entrys and Event binding"""

chosenrange = 2

url_login="http://.../ipgw/ipgw.ipgw/"

uid = '' #用户名

password = '' # 密码

operation = '' # 操作

range = '2' # 范围

the_page = '' # WEB服务器返回页面

# 表单的INPUT 值一定要记得填齐全

def login(self):

values = {

'uid' : self.uid,

'password' : self.password,

'operation' : self.operation,

'range' : self.range, # 1:国际 2:国内

'timeout':'0'

}

postdata = urllib.urlencode(values) # 表单值编码

req = urllib2.Request(self.url_login, postdata) # 服务器请求

response = urllib2.urlopen(req)

self.the_page = response.read()

#print self.the_page

【用Python的urllib库提交WEB表单】相关文章:

Python常见数据结构详解

使用python BeautifulSoup库抓取58手机维修信息

c++生成dll使用python调用dll的方法

Python下的Mysql模块MySQLdb安装详解

python中的列表推导浅析

Python实现的几个常用排序算法实例

简明 Python 基础学习教程

python使用xmlrpc实例讲解

python实现的各种排序算法代码

Python字符转换

精品推荐
分类导航