Request

發送一個請求

HTTP Get

import requests
response = requests.get('https://api.github.com/events')
import requests
payload = {'key1': 'value1', 'key2': 'value2'}
>>> r = requests.get('https://httpbin.org/get', params=payload)

HTTP Post

import requests
response = requests.post('https://httpbin.org/post', data = {'key':'value'})

Response

response.text
response.status_code

JSON Response

import requests
response = requests.get('https://api.github.com/events')
response.json()

參考文獻

results matching ""

    No results matching ""