Giter Site home page Giter Site logo

python-myusps's Introduction

Build Status PyPI version

python-myusps

Python 3 API for USPS Informed Delivery, a way to track packages and mail.

Prerequisites

USPS

Sign up for Informed Delivery and verify your address.

Chrome

Install Google Chrome and Chromedriver. These are dependencies for the Selenium webdriver, which is used internally to this module to facilitate the login process.

Instructions (adapt as necessary for your OS):

Note that installing Selenium Server is not required.

Install

pip install myusps

Usage

import myusps

# Establish a session.
# 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)

# Get mail delivered on a given day.
import datetime
mail = myusps.get_mail(session, datetime.datetime.now().date())

Caching

Session cookies are cached by default in ./usps_cookies.pickle and will be used if available instead of logging in. If the cookies expire, a new session will be established automatically.

HTTP requests are cached by default in ./usps_cache.sqlite. HTTP caching defaults to 5 minutes and can be turned off by passing cache=False to get_session. The cache expiry can be adjusted with the keyword argument cache_expiry.

Development

Lint

tox

Release

make release

Contributions

Contributions are welcome. Please submit a PR that passes tox.

Disclaimer

Not affiliated with USPS. Does not use USPS Web Tools API. Use at your own risk.

python-myusps's People

Contributors

happyleavesaoc avatar mezz64 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.