Skip to content

Instantly share code, notes, and snippets.

@aldarund
Last active December 17, 2015 09:09
Show Gist options
  • Save aldarund/5585260 to your computer and use it in GitHub Desktop.
Save aldarund/5585260 to your computer and use it in GitHub Desktop.
echosign python embded widget
import base64
import suds
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
url = "https://secure.echosign.com/services/EchoSignDocumentService15?wsdl"
client = suds.client.Client(url, autoblend=True)
with open('D:/1.pdf', 'rb') as f:
read_data = f.read()
f.closed
wci = client.factory.create("ns19:WidgetCreationInfo")
fileInfo = client.factory.create("ns1:FileInfo")
fileInfo.fileName = "flowers.pdf"
# fileInfo.url = "http://viedev.com/misc/1.pdf"
#fileInfo.mimeType = None
fileInfo.file = base64.b64encode(read_data)
#fileInfo.file = read_data
fileInfoArray = client.factory.create("ns1:ArrayOfFileInfo")
fileInfoArray.FileInfo.append(fileInfo)
wpi = client.factory.create("ns19:WidgetPersonalizationInfo")
wpi.email = "shaper.int@gmail.com"
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.createPersonalEmbeddedWidget("APIKEY", None, wci, wpi)
print r.javascript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment