Code Snippets don't work with Python Requests


#1

With postman I built a post request for a multipart/form-data form. The request adds something to a database. It works fine and does the job when sent from within postman.
Now taking the code snippet for python request is exectuable and returns a response 200. But it doesn’t add the entry to the database. What am I missing?

System: Win7; Python 3.6.0. 64 bits; Requests 2.12.4


#2

They do work.
Using the snippet directly got me falling back to the login route. To avoid this I modified:

requests.request(…) to session.request(…)

Prior to this, the following needs to be executed:

session = requests.Session()

Problem solved. Working now as expected.