Skip to main content

A Python wrapper for the Dominos Pizza API

Project description

Description

This is a Python wrapper for the Dominos Pizza API.

It’s a port of the pizzapi node.js module written by RIAEvangelist.

Quick Start

Pull the module into your namespace:

from pizzapi import *

First, construct a Customer object and set the customer’s address:

customer = Customer('Donald', 'Trump', 'donald@whitehouse.gov', '2024561111')
address = Address('700 Pennsylvania Avenue NW', 'Washington', 'DC', '20408')

Then, find a store that will deliver to the address.

store = address.closest_store()

In order to add items to your order, you’ll need the items’ product codes. To find the codes, get the menu from the store, then search for items you want to add. You can do this by asking your Store object for its Menu.

menu = store.get_menu()

Then search menu with menu.search. For example, running this command:

menu.search(Name='Coke')

Should print this to the console:

20BCOKE    20oz Bottle Coke®        $1.89
20BDCOKE   20oz Bottle Diet Coke®   $1.89
D20BZRO    20oz Bottle Coke Zero™   $1.89
2LDCOKE    2-Liter Diet Coke®       $2.99
2LCOKE     2-Liter Coke®            $2.99

After you’ve found your items’ product codes, you can create an Order object add add your items:

order = Order(store, customer, address)
order.add_item('P12IPAZA') # add a 12-inch pan pizza
order.add_item('MARINARA') # with an extra marinara cup
order.add_item('20BCOKE')  # and a 20oz bottle of coke

You can remove items as well!

order.remove_item('20BCOKE')

Wrap your credit card information in a PaymentObject:

card = PaymentObject('4100123422343234', '0115', '777', '90210')

And that’s it! Now you can place your order.

order.place(card)

Or if you’re just testing and don’t want to actually order something, use .pay_with.

order.pay_with(card)

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

pizzapi-0.0.4.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

pizzapi-0.0.4-py2-none-any.whl (14.9 kB view details)

Uploaded Python 2

File details

Details for the file pizzapi-0.0.4.tar.gz.

File metadata

  • Download URL: pizzapi-0.0.4.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15rc1

File hashes

Hashes for pizzapi-0.0.4.tar.gz
Algorithm Hash digest
SHA256 02dfbecf704f550d09b3e4dedd9cdda35a8259aad5e1e15b4d9ec6dd7545f584
MD5 3c4b3623e37a9a8ece10866e67764ea7
BLAKE2b-256 8e630f5622d2d8bb4d67028252b3d448a6b2c7ab1efaf8a91a2f4912fdbfac65

See more details on using hashes here.

File details

Details for the file pizzapi-0.0.4-py2-none-any.whl.

File metadata

  • Download URL: pizzapi-0.0.4-py2-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15rc1

File hashes

Hashes for pizzapi-0.0.4-py2-none-any.whl
Algorithm Hash digest
SHA256 adf459cc0305498f8eb7435e440caeb7a1a1aaf5f40756767a47ebd71f347dd6
MD5 883254b4d5b5384d2a49a72fffbb4519
BLAKE2b-256 02337df35906743dd9bda14a7662f7f9104db96719ef307a5b4be430359902dd

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