'How to post two (several) arguments via requests.post() in Python?

I need to post two arguments: .xls file, and one more constant (e.g. 1000)

this is how I tried to do it, but it failed: requests.post('http://13.59.5.143:8082/blablabla', 'data.xls', 1000)

I also tried this, and it doesn`t work too:

  • requests.post('http://13.59.5.143:8082/blablabla', ['data.xls', 1000])
  • requests.post('http://13.59.5.143:8082/blablabla', {'file':'data.xls' ; 'store_id':1000)

What is the right way to post 2 arguments using Python requests lib?

If not requests lib, what are other possible solutions?



Solution 1:[1]

import requests

payload = {'file':'data.xls', 'store_id':1000}
r = requests.get('http://13.59.5.143:8082/blablabla', params=payload)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 laticoda