Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import easypost
from time import gmtime, strftime
easypost.api_key = 'cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi'
shipment = easypost.Shipment.create(
to_address={
'name': "Customer",
'street1': "8308 Fenway Rd",
'city': "Bethesda",
'state': "MD",
'zip': "20817",
'country': "US"
},
from_address={
'name': "Sawyer Bateman",
'company': "EasyPost",
'street1': "164 Townsend St",
'city': "San Francisco",
'state': "CA",
import easypost
easypost.api_key = 'cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi'
# this address will be verified
address = easypost.Address.create(
verify=["delivery"],
street1="118 2 streat",
street2="FL 4",
city="San Francisco",
state="CA",
zip="94105",
country="US",
company="EasyPost",
phone="415-456-7890"
)
print(address.street1)
import easypost
easypost.api_key = 'cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi'
# create addresses
to_address = {
'name': "Sawyer Bateman",
'street1': "1A Larkspur Cres.",
'street2': "",
'city': "St. Albert",
'state': "AB",
'zip': "t8n2m4",
'country': "CA",
'phone': "780-283-9384"
}
from_address = {
'name': "Jon Calhoun",
'street1': "388 Townsend St",
import easypost
easypost.api_key = 'cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi'
order = easypost.Order.create(
to_address={
'company': 'Oakland Dmv Office',
'name': "Customer",
'street1': "5300 Claremont Ave",
'city': "Oakland",
'state': "CA",
'zip': "94618",
'country': 'US',
'phone': '800-777-0133'
},
from_address={
'name': "EasyPost",
'company': "EasyPost",
'street1': "164 Townsend St",
import easypost
easypost.api_key = 'PRODUCTION API KEY'
# Here are two different ways to retrieve your api_keys
api_keys = easypost.User.all_api_keys()
my_keys1 = api_keys.keys
me = easypost.User.retrieve()
my_keys2 = me.api_keys()
# Here is how to retrieve the api_keys of a child user
child = me.children[0]
child_keys = child.api_keys()
import easypost
easypost.api_key = 'PRODUCTION API KEY'
me = easypost.User.retrieve()
child_user = easypost.User.create(
name='Python All-Things-Testing',
phone_number='555-555-5555'
)
id = child_user.id
retrieved_user = easypost.User.retrieve(id)
new_name = 'Python All-Things-Tested'
retrieved_user.name = new_name
retrieved_user.save()
updated_user = easypost.User.retrieve(id)
import easypost
easypost.api_key = 'cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi'
# create test tracker
tracker = easypost.Tracker.create(
tracking_code="EZ2000000002",
carrier="USPS"
)
print(tracker.id) # This is random
# retrieve tracker by id
tracker2 = easypost.Tracker.retrieve(tracker.id)
print(tracker2.id) # Should be the same as above
# retrieve all trackers by tracking_code
trackers = easypost.Tracker.all(tracking_code="EZ2000000002")
import easypost
easypost.api_key = 'cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi'
try:
# this request will raise an error
address = easypost.Address.create(
verify_strict=["delivery"],
street1="UNDELIEVRABLE ST",
city="San Francisco",
state="CA",
zip="94105",
country="US",
company="EasyPost",
phone="415-456-7890"
)
except easypost.Error as e:
print(e.http_body)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import tempfile
import time
import urllib2
import easypost
easypost.api_key = 'cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi'
easypost.api_base = 'http://localhost:5000/v2'
def process_job(job):
with tempfile.NamedTemporaryFile() as f:
try:
response = urllib2.urlopen(job['url'])
except urllib2.URLError:
return False
f.write(response.read())
f.flush()
return print_zpl(f.name)
#if success:
import easypost
easypost.api_key = 'cueqNZUb3ldeWTNX7MU3Mel8UXtaAMUi'
# easypost.api_base = 'http://localhost:5000/v2'
# addresses
to_address = {
"name": "Sawyer Bateman",
"street1": "1A Larkspur Cres.",
"street2": "",
"city": "St. Albert",
"state": "AB",
"zip": "t8n2m4",
"country": "CA",
"phone": "780-283-9384"
}
from_address = {
"name": "Jon Calhoun",