# Help with multipart-formdata - Python Requests code

**URL:** <https://community.postman.com/t/help-with-multipart-formdata-python-requests-code/16213>\
**Category:** Help Hub\
**Tags:** code, shared-code\
**Created:** [September 24, 2020, 7:51pm UTC](https://community.postman.com/t/help-with-multipart-formdata-python-requests-code/16213 "2020-09-24T19:51:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bbourgau](https://avatars.discourse-cdn.com/v4/letter/b/4af34b/32.png) [@bbourgau](https://community.postman.com/u/bbourgau)\
**Post date:** [September 24, 2020, 7:51pm UTC](https://community.postman.com/t/help-with-multipart-formdata-python-requests-code/16213/1 "2020-09-24T19:51:31Z")

</div>

Hi,  
When I create a form-data POST request with two images, the Postman Request works.  
However when I select the code for Python - Requests the generated code does not work at all.  
It’s looking for the boundary markers…  
Is there a way to see the full code that Postman generates that succeeds ?  
Thanks,  
Brian

import requests

url = “[https://face-recognition4.p.rapidapi.com/FaceVerification](https://face-recognition4.p.rapidapi.com/FaceVerification)”

payload = {}

files = [

(‘photo1’, open(’/C:/Users/bbourgault/Pictures/bb.jpg’,‘rb’)),

(‘photo2’, open(’/C:/Users/bbourgault/Pictures/bb3.jpg’,‘rb’))

]

headers = {

‘x-rapidapi-host’: ‘[face-recognition4.p.rapidapi.com](http://face-recognition4.p.rapidapi.com)’,

‘x-rapidapi-key’: ‘b810129938msh1eb822ed1a5e36ep108a11jsn92fa2ad1c363’,

‘Content-Type’: ‘multipart/form-data’

}

response = requests.request(“POST”, url, headers=headers, data = payload, files = files)

print(response.text.encode(‘utf8’))

---

<div class="post-metadata">

**Author:** ![kesarraghav](https://avatars.discourse-cdn.com/v4/letter/k/5daacb/32.png) [@kesarraghav](https://community.postman.com/u/kesarraghav)\
**Post date:** [June 28, 2021, 5:16am UTC](https://community.postman.com/t/help-with-multipart-formdata-python-requests-code/16213/2 "2021-06-28T05:16:57Z")

</div>

Hi Brian, Thanks for posting this issue.  
Have you got any solution to this problem. I am facing the exact same issue while pulling the python code from the postman. Here is my code

```auto
import requests

import json

url = "http://127.0.0.1:6001/api/v1/solve-registration-challenge"

payload={'solvedRegFileLocation': '/var/opt/ncm_dms/reg'}

files=[
('regChallengeFile',('gudsgtcnsrk_reg_challenge.json',open('/home/raghav/Music/gudsgtcnsrk_reg_challenge.json','rb'),'application/json'))
]

headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)

```
