# Create a file with Python API failed

**URL:** <https://community.hubspot.com/t/create-a-file-with-python-api-failed/15231>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [July 10, 2019, 1:13pm UTC](https://community.hubspot.com/t/create-a-file-with-python-api-failed/15231 "2019-07-10T13:13:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yorambaron](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/yorambaron/32/18373_2.png) [@yorambaron](https://community.hubspot.com/u/yorambaron)\
**Post date:** [July 10, 2019, 1:13pm UTC](https://community.hubspot.com/t/create-a-file-with-python-api-failed/15231/1 "2019-07-10T13:13:59Z")

</div>

Hello,

I tried to use the following Python code to upload a file to HubSpot, the code was copied from [this](https://developers.hubspot.com/docs/methods/files/post_files) link:

```auto
import requests
files = {'files': open('/path/on/your/local-computer/report.xls', 'rb')}
r = requests.post(
 'http://api.hubapi.com/filemanager/api/v2/files?hapikey=demo', 
 data={
 "folder_paths": "folder-in-the-cos-file-manager/subfolder"
 },
 files=files)

```

I ran this script but there was no response from the Linux shell. In addition I couldn’t find the uploaded file in HubSpot..

Questions:

I1. s there a problem with this API example? I saw a few people that asked a simillar question.

2. How do you run this code with the curl command?

Thanks,

Yoram

---

<div class="post-metadata">

**Author:** ![yorambaron](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/yorambaron/32/18373_2.png) [@yorambaron](https://community.hubspot.com/u/yorambaron)\
**Post date:** [July 10, 2019, 1:32pm UTC](https://community.hubspot.com/t/create-a-file-with-python-api-failed/15231/2 "2019-07-10T13:32:41Z")

</div>

Please disregard, I found the uploaded files under Marketing/File Manager.
