源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

用Python的urllib库提交WEB表单

  • 时间:2022-08-18 10:09 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:用Python的urllib库提交WEB表单
[u]复制代码[/u] 代码如下:
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
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部