Created
April 3, 2018 21:51
-
-
Save nshores/bb5c1978d3b638bf215ea886ce80c67d to your computer and use it in GitHub Desktop.
check_mail.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Requires Chromedriver https://sites.google.com/a/chromium.org/chromedriver/ | |
#Google Chrome | |
#PhantomJS (Be sure to include in your path) | |
#USPS Informed Delivery Account | |
#Python3 | |
import myusps | |
# Establish a session. | |
username = "nick@shoresmedia.com" | |
password = "Kv96wLhX87j6" | |
# Use the login credentials you use to login to My USPS via the web. | |
# A login failure raises a `USPSError`. | |
session = myusps.get_session(username, password) | |
# Get your profile information as a dict. Includes name, address, phone, etc. | |
profile = myusps.get_profile(session) | |
# Get all packages that My UPS knows about. | |
packages = myusps.get_packages(session) | |
for pkg in packages: | |
for p in pkg: | |
print ("Number of packages"),(len(packages)) | |
print ("Tracking Number"),(pkg['tracking_number']) | |
# Get mail delivered on a given day. | |
import datetime | |
mail = myusps.get_mail(session, datetime.datetime.now().date()) | |
for items in mail: | |
for item in items: | |
print(items[item]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment