Skip to main content

A CLI for tracking packages from USPS.

Project description

iiPythonx / USPS

A CLI for tracking packages from USPS (with crude support for UPS packages).

Installation

uv pip install usps-cli

# or, install from dev:
uv pip install git+https://github.com/iiPythonx/usps

Usage

[!IMPORTANT]
For UPS packages, USPS-cli only support the 1Z version of UPS tracking numbers right now.

Get the tracking information for a package:

usps track 9400100000000000000000

Add a tracking number to your package list:

usps add 9400100000000000000000

Remove a tracking number from your package list:

usps remove 9400100000000000000000

Show all your current packages:

usps track

Add a name to a package:

$ usps name 9400100000000000000000 "Amazon Package"

# If you don't specify name, it will prompt for one.
$ usps name 9400100000000000000000
Choose a package name: Amazon Package

Remove the name from a package:

usps name --erase 9400100000000000000000

For more details, run usps --help.

Requirements

[!NOTE]
If you only plan to track UPS packages, you can skip installing a selenium driver.

Since this package uses selenium for challenge solving, you'll need to install a Firefox-compatible browser and geckodriver.
Feel free to modify the code to use Chromium instead if you prefer it.

If you're on Arch: sudo pacman -S firefox geckodriver,

Inspiration

I tried to make a basic web scraper for the USPS website months ago, only to find out that its security is crazy.
Instead of trying to reverse engineer their client, I made this instead.

How it works:

  • Selenium goes to the USPS tracking website, completing the JS challenge and saving the cookies
  • This client saves that request data to a JSON file for reuse (speeds up the client dramatically)
  • Next, requests pulls the page from USPS using our saved cookies and parses it with BeautifulSoup
  • Apply some basic scraping and there you go, a USPS tracking client

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

usps_cli-0.8.2.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

usps_cli-0.8.2-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file usps_cli-0.8.2.tar.gz.

File metadata

  • Download URL: usps_cli-0.8.2.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for usps_cli-0.8.2.tar.gz
Algorithm Hash digest
SHA256 51d494475e89cd411b14b0f07c57ab3400188e53ed1a893bb3cb2a51dd542c9f
MD5 ec9cd63622e004edd2742871a320f2eb
BLAKE2b-256 229900d6018c8d7b2c4b1cbb95ee81f3a53fbb6e0acf01a300bfe4faa3ece3d6

See more details on using hashes here.

File details

Details for the file usps_cli-0.8.2-py3-none-any.whl.

File metadata

  • Download URL: usps_cli-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 12.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for usps_cli-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9aaf2cf85feff3dad979cdf4d53b9f644b42906cec5cbb3b559973d55ae4ef6a
MD5 c017bd93bf13e166c19e35487c6421af
BLAKE2b-256 6aea30185357946d040c5141b22feba18bbe88c992af50e4eada08310dd9b6cc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page