Skip to content Skip to sidebar Skip to footer

Pycurl Equivalent Of "curl --data-binary"

I'd like to know the equivalent of this curl command in pycurl: curl --data-binary @binary_data_file.bin 'http://server/myapp/method' Note: The above curl statement uses the POST

Solution 1:

The requests library is meant to keep things like this simple:

importrequestsr= requests.post('http://server/myapp/method', data={'aaa': 'bbb'})

Or depending on how the receiving end expects data:

importrequestsr= requests.post('http://server/myapp/method',
    data=file('binary_data_file.bin','rb').read())

Post a Comment for "Pycurl Equivalent Of "curl --data-binary""