Last active
January 24, 2020 15:33
-
-
Save skaboy71/6d014db28e260571d30f80cdb158c11c to your computer and use it in GitHub Desktop.
Python 3.5 Function to upload a pdf as "transient doc" to Adobe Sign via REST V5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests # get requests via pip with documentation here: http://docs.python-requests.org/en/master/ | |
def upl_trans(file_path, docName, apiToken): | |
"""Uploads document to EchoSign and returns its ID | |
:param access_token: EchoSign Access Token | |
:param file_path: Absolute or relative path to File | |
:return string: transientDucumentId | |
:usage example: transID1 = upl_trans('./_MSA_noline.pdf','Test1.pdf', '*** your_api_token_or_integration_key_here ***') | |
""" | |
headers = { | |
'Access-Token': apiToken, # Your access token or integration key here. | |
} | |
data = { | |
'Mime-Type': 'application/pdf', | |
'File-Name': docName | |
} | |
url = config01.tranUrl | |
files = {'File': open(file_path, 'rb')} | |
return requests.post(url, headers=headers, data=data, | |
files=files).json().get('transientDocumentId') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment