Paul's Programming Notes     Archive     Feed     Github

Ordered Post Data - Python Requests

Here's an example of how to send ordered data with python's Requests library, for when the order of your post request data matters:

import requests
from collections import OrderedDict

payload = OrderedDict([("username", "admin"), ("pwd", "password")]) # the order matters!
r = requests.post('http://1.1.1.1/example', data=payload)
print r.text