Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Ship Library Python Example
import json
import urllib
import urllib2
# Set up recipients array with two recipients
recipients = [
'name': 'John Smith',
'street1': '1 Main St',
'street2': 'Apt 208',
'city': 'San Francisco',
'state': 'CA',
'postalcode': '94102',
'country': 'United States'
'name': 'Jane Doe',
'street1': '123 Mission Street',
'city': 'San Francisco',
'state': 'CA',
'postalcode': '94105',
'country': 'United States',
# Set up sender array
sender = {
'name': 'Pepper Gram',
'email': '',
'street1': '800 Market Street',
'city': 'San Francisco',
'state': 'CA',
'postalcode': '94102',
'country': 'United States',
params = {
'appkey': 'YOUR_APPKEY_HERE',
'testMode': True,
'frontPhotoId': 123456,
'recipients': json.dumps(recipients),
'sender': json.dumps(sender),
data = urllib.urlencode(params)
req = urllib2.Request('', data, {})
r = urllib2.urlopen(req)
resp = json.loads(
if resp.get('success'):
# Success!
print resp
print 'An error occurred.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.