Code Monkey home page Code Monkey logo

packagetrack's Introduction

packagetrack - Track packages

Authors: Scott Torborg (storborg) Michael Stella (alertedsnake) Alex Headley (aheadley)
Version: 0.4

This library tracks packages.

Note Use at your own risk!

Requirements

setuptools, suds, pytz, pip, fedex module

For debian or ubuntu, do::
$ apt-get install python-setuptools python-suds python-tz python-pip $ pip install fedex

Installation

Simple as:

$ easy_install packagetrack

Or if you prefer, download the source and then:

$ python setup.py build
$ python setup.py install

Example

>>> from packagetrack import Package
>>> package = Package('1Z9999999999999999')
# Identify packages (UPS, FedEx, DHL, CanadaPost, and USPS)
>>> package.carrier
'UPS'
>>> info = package.track()
>>> print info.status
IN TRANSIT TO
>>> print info.delivery_date
2010-06-25 00:00:00
>>> print info.last_update
2010-06-19 00:54:00
# Get tracking URLs
>>> print package.url
http://wwwapps.ups.com/WebTracking/processInputRequest?TypeOfInquiryNumber=T&InquiryNumber1=1Z9999999999999999

API Configuration

To enable package tracking (not just finding URLs or matching TNs to carriers), you will need to get API credentials for most of the carriers you wish to use. The default configuration method is to read the config values from ~/.packagetrack, which looks like this:

[UPS]
license_number = XXXXXXXXXXXXXXXX
user_id = XXXX
password = XXXX

[FedEx]
key = XXXXXXXXXXXXXXXX
password = XXXXXXXXXXXXXXXXXXXXXXXXX
account_number = #########
meter_number = #########

[USPS]
userid = XXXXXXXXXXXX
password = XXXXXXXXXXXX

[CanadaPost]
username = XXXXXXXXXXXXXXXX
password = XXXXXXXXXXXXXXXXXXXXXX

You can specify an alternate location for the config file like so:

>>> from packagetrack.configuration import DotFileConfig
>>> cfg = DotFileConfig('/path/to/file')
>>> packagetrack.auto_register_carriers(cfg)

Alternatively, you can provide a different type of config like the DictConfig or making another type (like one that pulls values from a database).

License

Packagetrack is released under the GNU General Public License (GPL). See the LICENSE file for full text of the license.

packagetrack's People

Contributors

aheadley avatar alertedsnake avatar slowriot avatar

Watchers

Alexander Fu avatar James Cloos 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.