public
Last active

Working python file to create embedded echosign widget

  • Download Gist
echosign.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
#!/usr/bin/python
import base64
import suds
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
 
url = "https://secure.echosign.com/services/EchoSignDocumentService14?wsdl"
 
client = suds.client.Client(url, autoblend=True)
 
 
with open('/Users/bobspryn/Desktop/flowers.pdf', 'r') as f:
read_data = f.read()
f.closed
 
 
wci = client.factory.create("ns17:WidgetCreationInfo")
 
fileInfo = client.factory.create("ns1:FileInfo")
fileInfo.fileName = "flowers.pdf"
fileInfo.url = "http://www.lohilabs.com/misc/flowers.pdf"
fileInfo.mimeType = None
# fileInfo.file = base64.b64encode(read_data)
 
fileInfoArray = client.factory.create("ns1:ArrayOfFileInfo")
fileInfoArray.FileInfo.append(fileInfo)
 
 
wci.name = "Monkeys2"
wci.signatureFlow = "SENDER_SIGNATURE_NOT_REQUIRED"
wci.fileInfos = fileInfoArray
wci.securityOptions = None
wci.callbackInfo = None
wci.widgetCompletionInfo = None
wci.widgetAuthFailureInfo = None
wci.locale = None
wci.mergeFieldInfo = None
 
print wci
 
 
r = client.service.createEmbeddedWidget("YOURAPIKEY", None, wci)
 
print r.javascript

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.