py request 基礎

import requests


#經常使用的形式
# requests.get()
# requests.post()
# requests.put()
# requests.request('post')

# 參數
# url='xxx',
# params={'name':11,'pwd':1212},
# cookies = {},
# headers = {},
# data={},
# json={}


# get
# requests.get(
#     url='xxx',
#     params={'name':11,'pwd':1212},
#     cookies = {},
#     headers = {}
# )


#post
requests.post(
    url='xxx',
    params={'name':11,'pwd':1212},
    cookies = {},
    headers = {},
    data={},
    json={}
)


#session 容器   自動加入參數
session = requests.Session()
re = session.post(
    url='aaa.php',
    data = {}

)

更多精彩文章請關注 王明昌博客php

相關文章
相關標籤/搜索