Reputation: 31
In the Chrome developer console, it is possible to POST a request like:
$.post( "add_to_offer_ajax.php", { No: 'SZ412042400Q', Quantity: '1' })
This works fine and adds an item to an online quote.
How can I convert this POST to Python 3 and requests? I tried the following, but this does not seem to work:
response =requests.post("https://webshop.seaco.eu/add_to_offer_ajax.php", data={"No": 'SZ412042400Q',"Quantity": "1"})
Upvotes: 0
Views: 85
Reputation: 106946
You can use the json
parameter instead:
response = requests.post("https://webshop.seaco.eu/add_to_offer_ajax.php", json={"No": 'SZ412042400Q',"Quantity": "1"})
Please refer to the documentation for details.
Upvotes: 1