[ANSWERED]: curl -X command convert to urllib2

Posted on
Thu Apr 30, 2015 11:54 am
kw123 offline
User avatar
Posts: 6009
Joined: May 12, 2013
Location: Dallas, TX

[ANSWERED]: curl -X command convert to urllib2

i have the following curl command that works:

curl http:.... -H "authorization: Token xxx" -X DELETE

I have not been able to incorporate the -X DELETE into a urllib2 call. The authorization is ok. It goes into the header ={ "authorization": "token 1212341234"}.

but the -X DELETE is not in the form "xx:yy"

Any hint how to get this into URLIB2 would be appreciated. I have been searching on the web for several hours, but no luck..

thanks

Karl


curl reference
-X, --request <command>

(HTTP) Specifies a custom request method to use when communicating with the HTTP server. The specified request method will be used instead of the method otherwise used (which defaults to GET). Read the HTTP 1.1 specification for details and explanations. Common additional HTTP requests include PUT and DELETE, but related technologies like WebDAV offers PROPFIND, COPY, MOVE and more. .....

at [urlhttp://curl.haxx.se/docs/manpage.html][/url]

Posted on
Thu Apr 30, 2015 7:41 pm
matt (support) offline
Site Admin
User avatar
Posts: 18735
Joined: Jan 27, 2003
Location: Texas

Re: curl -X command convert to urllib2

Take a look at this blog thread, or you might want to consider using Requests since it supports all the HTTP verbs.. I've never used Requests, but it looks nice and I think it will run on Python 2.6.

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest