Skip to content

Instantly share code, notes, and snippets.

@bobspryn
Created July 19, 2012 05:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bobspryn/3140960 to your computer and use it in GitHub Desktop.
Save bobspryn/3140960 to your computer and use it in GitHub Desktop.
Working python file to create embedded echosign widget
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment