2012-04-17 18 views
18

私はtoggl.com APIとやりとりするためにrequestsパッケージを使用しています。要求ライブラリでHTTP DELETE要求を行う方法

payload = {'some':'data'} 
    headers = {'content-type': 'application/json'} 
    url = "https://www.toggl.com/api/v6/" + data_description + ".json" 
    response = requests.post(url, data=json.dumps(payload), headers=headers,auth=HTTPBasicAuth(toggl_token, 'api_token')) 

をしかし、私はDELETEリクエストを実行する方法を見つけるように見えるカント:

私がGETとPOSTリクエストを実行することができます。 これは可能ですか?

答えて

34

代わりrequests.post

payload = {'some':'data'} 
headers = {'content-type': 'application/json'} 
url = "https://www.toggl.com/api/v6/" + data_description + ".json" 
response = requests.delete(url, data=json.dumps(payload), headers=headers,auth=HTTPBasicAuth(toggl_token, 'api_token')) 
の使用 requests.delete
関連する問題