码迷,mamicode.com
首页 > 编程语言 > 详细

python通过POST提交页面请求

时间:2015-05-07 16:10:01      阅读:282      评论:0      收藏:0      [点我收藏+]

标签:

http://blog.csdn.net/liyzh_inspur/article/details/6294292

#网页POST提交数据

import urllib
import urllib2
url = ‘http://umbra.nascom.nasa.gov/cgi-bin/eit-catalog.cgi‘
values = {‘obs_year‘:‘2011‘,‘obs_month‘:‘March‘,
                             ‘obs_day‘:‘8‘,‘start_year‘:‘2011‘
                             ,‘start_month‘:‘March‘,‘start_day‘:‘8‘
                             ,‘start_hour‘:‘All Hours‘,‘stop_year‘:‘2011‘
                             ,‘stop_month‘:‘March‘,‘stop_day‘:‘8‘
                             ,‘stop_hour‘:‘All Hours‘,‘xsize‘:‘All‘
                             ,‘ysize‘:‘All‘,‘wave‘:‘all‘
                             ,‘filter‘:‘all‘,‘object‘:‘all‘
                             ,‘xbin‘:‘all‘,‘ybin‘:‘all‘
                             ,‘highc‘:‘all‘}
data = urllib.urlencode(values)
print data
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
the_page = response.read()
print the_page

 

import urllib
import urllib2


url = ‘http://test.api.study.91open.huayu.nd/v5/app/getappinfo‘
values ={‘projectId‘:‘155‘,‘k‘:‘C66BEFF134DF96E8‘}
data = urllib.urlencode(values)
print data
req = urllib2.Request(url, data)
response = urllib2.urlopen(req)
the_page = response.read()
print the_page

python通过POST提交页面请求

标签:

原文地址:http://www.cnblogs.com/xuejinhui/p/4485044.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!