Package: hellosign-python-sdk
Hellosign Python SDKA Python wrapper for theHelloSign APIInstallationInstall usingeasy_install:easy_installhellosign-python-sdkInstall usingpip:pipinstallhellosign-python-sdkInstall from code:gitclonehttps://github.com/HelloSign/hellosign-python-sdk.gitcdhellosign-python-sdk
pythonsetup.pyinstallConfigurationIn your application, importHSClient:fromhellosign_sdkimportHSClientThen create a HSClient object and pass authentication information to initialize it:# Initialize HSClient using email and passwordclient=HSClient(email_address="api_user@example.com",password="your_password")# Initialize HSClient using api keyclient=HSClient(api_key="your_api_key")# Initialize HSClient using api tokenclient=HSClient(access_token="your_api_access_token")Note: In case you initialize the HSClient with all the above credentials, the priority order is as follow: access_token, api_key, then email and password.UsageFor more information about the wrapper, its methods and parameters visit our detailed API documentation onreadthedocs.AccountGet current account informationaccount=client.get_account_info()The account information is also stored inclient.account. For example, to print theemail_addressof your account:printclient.account.email_addressUpdate your account informationclient.account.callback_url="https://www.example.com/callback"client.update_account_info()Create a new HelloSign accountnew_account=client.create_account("new_user@example.com")Signature RequestGet a Signature Requestsignature_request=client.get_signature_request("fa5c8a0b0f492d768749333ad6fcc214c111e967")printsignature_request.requester_email_addressprintsignature_request.signature_request_idGet a list of your Signature Requestssignature_request_list=client.get_signature_request_list(page=1)# Print out the name of the signers in every signature requestforsignature_requestinsignature_request_list:printsignature_request.signatures[0].signer_nameSend a Signature Requestfiles=["NDA.pdf","AppendixA.pdf"]signers=[{"name":"Jack","email_address":"jack@example.com"},{"name":"Jill","email_address":"jill@example.com"}]cc_email_addresses=["lawyer@hellosign.com","lawyer@example.com"]# Send a signature request with remote filessignature_request=client.send_signature_request(test_mode=True,files=None,file_urls=["http://www.example.com/download/sample.pdf"],title="NDA with Acme Co.",subject="The NDA we talked about",message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",signing_redirect_url=None,signers=signers,cc_email_addresses=cc_email_addresses)# Send a signature request with uploaded filessignature_request=client.send_signature_request(test_mode=True,files=files,file_urls=None,title="NDA with Acme Co.",subject="The NDA we talked about",message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",signing_redirect_url=None,signers=signers,cc_email_addresses=cc_email_addresses)Send a Signature Request with Templatesigners=[{"name":"Jack","email_address":"jack@example.com"},{"name":"Jill","email_address":"jill@example.com"}]cc_email_addresses=["lawyer@hellosign.com","lawyer@example.com"]ccs=[{"email_address":"lawyer@hellosign.com","role_name":"Lawyer 1"},{"email_address":"lawyer@example.com","role_name":"Lawyer 2"}]custom_fields=[{"Field 1":"Value 1"},{"Field 2":"Value 2"}]# Send a signature request with uploaded filessignature_request=client.send_signature_request_with_template(test_mode=True,template_id="fa5c8a0b0f492d768749333ad6fcc214c111e967",title="NDA with Acme Co.",subject="The NDA we talked about",message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",signing_redirect_url=None,signers=signers,ccs=ccs,custom_fields=custom_fields)EmbeddedEmbedded signingsigners=[{"name":"Jack","email_address":"jack@example.com"},{"name":"Jill","email_address":"jill@example.com"}]signature_request=client.send_signature_request_embedded(test_mode=True,client_id="YOUR CLIENT ID",files=["path/to/NDA.pdf"],title="NDA with Acme Co.",subject="The NDA we talked about",message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",signing_redirect_url=Nonesigners=signers,cc_email_addresses=None,form_fields_per_document=None)# Retrieve the signature url to pass to the embedded iFrameforsignatureinsignature_request.signatures:embedded_obj=client.get_embedded_object(signature.signature_id)sign_url=embedded_obj.sign_urlMore information about the asscociated front-end code can be foundhereEmbedded requesting# Create a draft and retrieve the claim urldraft=client.create_embedded_unclaimed_draft(test_mode=True,client_id="YOUR CLIENT ID",requester_email_address="requester@example.com",files=["path/to/NDA.pdf"],draft_type="signature_request",subject="The NDA we talked about",message="Please sign this NDA and then we can discuss more. Let me know if you have any questions.",is_for_embedded_signing=False)claim_url=draft.claim_urlMore information about the associated front-end code can be foundhereOnce the user edits the draft in the embedded iFrame and sends the signature request your app callback will receive asignature_request_sentevent containing aSignatureRequestobject. If we had usedis_for_embedded_signing=True, we would want to get the signature ids out of theSignatureRequestfrom that event and fetch the signature urls at this point. In your event callback handler, you will need to do something like this:client=HSClient(api_key='your_api_key')event_data=json.loads(request.POST.get('json'))ifevent_data['event']['event_type']=='signature_request_sent':sig_req=event_data['signature_request']forsiginsig_req['signature_request']['signatures']:embedded_obj=client.get_embedded_object(sig['signature_id'])sign_url=embedded_obj.sign_url# Save sign_url somewhereTestsYou can run the test suite by executing the following commands after you cloned the repo:
Note that it requires to have a HelloSign account, with at least one template and one api app.WARNING:We advise against running the tests against your personal account as they perform destructive actions.cd hellosign_sdk
cp tests/test_helper.sample.py tests/test_helper.py
HELLOSIGN_API_KEY='YOUR API KEY'
HELLOSIGN_API_CLIENT_ID='YOUR APP CLIENT ID'
HELLOSIGN_API_CLIENT_SECRET='YOUR APP CLIENT SECRET'
nosetests --with-coverage --cover-package=hellosign_sdk --include=hellosign_sdk/tests/unit_tests/* --include=hellosign_sdk/tests/functional_tests/*Additional notesLocal callbacksWe do not allow app callbacks (event or OAuth) to be set to localhost. However it is still possible to test callbacks against a local server. Tunneling services such asngrokcan help you set this up.LicenseThe MIT License (MIT)

Copyright (C) 2015 hellosign.com

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.