Skip to content

Latest commit

 

History

History
52 lines (33 loc) · 950 Bytes

README.md

File metadata and controls

52 lines (33 loc) · 950 Bytes

py-postmates

Hi!

A simple Python client for the Postmates API.

Setup

You may need to install the security package extras for requests:

$ pip install requests[security]

Usage

Create an instance of the API

import postmates as pm

api = pm.PostmatesAPI(<YOUR_CUSTOMER_ID>, <YOUR_API_KEY>)

Create some locations and get a quote for a delivery.

pickup = pm.Location('Alice', '100 Start St, San Francisco, CA', '415-555-0000')
dropoff = pm.Location('Bob', '200 End St, San Francisco, CA', '415-777-9999')

quote = pm.DeliveryQuote(api, pickup.address, dropoff.address)

Create a delivery and schedule it.

delivery = Delivery(api, 'a manifest', pickup, dropoff)
delivery.create()

Update the status of a pending delivery.

delivery.update_status()

If nothing's happened yet, you can cancel (but it will still cost you).

delivery.cancel()

Have fun!