Reputation: 489
I would like to send data to a server via http and include some parameters and a picture.
Has anyone managed to do this with Python?
I am using a Raspberry Pi so I have python 2.7.3.
Many thanks for your help,
John.
Upvotes: 1
Views: 1012
Reputation: 30416
Here is an approach with the Requests lib (from doc):
>>> url = 'http://httpbin.org/post'
>>> files = {'file': open('report.xls', 'rb')}
>>> r = requests.post(url, files=files)
>>> r.text
{
...
"files": {
"file": "<censored...binary...data>"
},
...
}
Upvotes: 1