Python request for referral API


I am interested in using the API, and I started with the referral API:

I would like to do this using Python’s request, but I couldn’t find an example on github.

This is what I have:

from requests_toolbelt.multipart.encoder import MultipartEncoder
import requests

API = my_api
ID = my_id

Link = ‘

m = MultipartEncoder(
fields={‘useAjax’:‘True’, ‘forceEmbedding’: ‘False’,‘pluging’:ID,
‘fileUrl’: Link}

headers = {‘Content-Type’: m.content_type,
‘User-agent’: ‘Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/64.0.3282.167 Chrome/64.0.3282.167 Safari/537.36’,

resp =‘’, data=m,
headers=headers, allow_redirects=False)


As a result, however, I get an error URL.

I would greatly appreciate it if somebody could point me in the right direction. Ideally, I would like to have a file stream rather than having to upload it first to Google Drive.