someone can me explain how can i use curl request below in pycurl library:
curl -X POST --user 'username:password' url
Thanks.
someone can me explain how can i use curl request below in pycurl library:
curl -X POST --user 'username:password' url
Thanks.
This may be answering your question with a suggestion, but without knowing your reasons for using PyCurl, I'm going to suggest you use the 'requests' module.
PyCurl is useful for very high network-intensive tasks, but otherwise, the 'requests' module is vastly easier and less painful to use.
To do as you ask with requests, the following works:
Or, to be a little safer and better informed, use:
Assuming your POST works, the above isn't strictly necessary, nor is it particular to using 'requests', but it will let you know how things went with your request went. It's nothing but a try: except: approach to the same thing, with some print() statements to report back how everything worked out. :)
And assuming you have data to post, 'requests' makes that simple as well. See the following for more comprehensive information:
http://docs.python-requests.org/en/master/user/quickstart/
If you are constrained to using PyCurl, though, have you looked at their Quickstart page? The last couple or three sections, in particular, may help:
http://pycurl.io/docs/latest/quickstart.html