python 3.x get请求与发送post请求

1.python get请求

importsys#for sys.argv

importurllib.request

print(requests.get('http://localhost:8080/jenkins/job/python/api/python?pretty=true').text)

2.python 发送post登陆请求

importsys#for sys.argv

importurllib.request

importurllib.parse

importrequests

fromrequests.authimportHTTPBasicAuth

url='http://xx.xx.com:xx/index.php?app=main&func=passport&action=login'

r = requests.post(url,data={},auth=('账号','密码'))

print(r.status_code)

print(r.headers)

print(r.reason)

你可能感兴趣的:(python 3.x get请求与发送post请求)