Skip to main content

A CLI for tracking packages from USPS.

Project description

iiPythonx / USPS

A CLI for tracking packages from USPS.

Installation

uv pip install usps-cli

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

Usage

Get the tracking information for a package:

usps track <tracking number>

Add a tracking number to your package list:

usps add <tracking number>

Remove a tracking number from your package list:

usps remove <tracking number>

Show all your current packages:

usps track

Add a name to a package:

usps name <tracking number> [name]

# If you don't specify name, it will prompt for one.
$ usps name <tracking number>
Enter name: ...

# You can remove a name as well:
usps name --erase <tracking number>

Requirements

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 logging the request data
  • 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.7.3.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

usps_cli-0.7.3-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: usps_cli-0.7.3.tar.gz
  • Upload date:
  • Size: 7.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.7.3.tar.gz
Algorithm Hash digest
SHA256 abacba3d5e2017c02c0c75529848f04eec336e093c292fbe6a70719489a71d97
MD5 bc9ebc845b079c039b7e881960f8b1be
BLAKE2b-256 1f875e578a99df49b8115a9fa630e56a096e6200f30637986afb327c1f1b302a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: usps_cli-0.7.3-py3-none-any.whl
  • Upload date:
  • Size: 9.2 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.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7d7c398c27ecb213d40efd81f3afc50003f3c8f7cbcb6135acfe7f7ca3e1306f
MD5 8a3afd19c45403a774f6fae4ed33a52a
BLAKE2b-256 9d83283404d870843f7396c0263909d4a20aba3e8366c97fcfd2d161863cd16e

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