用Python的urllib库提交WEB表单

用Python的urllib库提交WEB表单,第1张

概述复制代码代码如下:classEntryDemo(Frame):\"\"\"DemonstrateEntrysandEventbinding\"\"\"chosenrange=2url_login=\"http://.../ipgw/ipgw.ipgw/\"uid=\'\'#用户名password=\'\'#密码operation=\'\'# *** 作range=\'2\' 复制代码 代码如下:
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的urllib库提交WEB表单所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1202666.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-04
下一篇 2022-06-04

发表评论

登录后才能评论

评论列表(0条)

保存