Giter Club home page Giter Club logo

pizzapi's Introduction

pizzapi

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

First construct a Customer object and set the customer's address.

>>> customer = Customer('Barack', 'Obama', '[email protected]', '2024561111')
>>> customer.set_address('700 Pennsylvania Avenue NW', 'Washington', 'DC', '20408')

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

>>> store = find_closest_store(customer.address)

Create an Order object.

>>> order = Order(store, customer)

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.

>>> menu = store.get_menu()
>>> menu.search(Name='Pan Pizza', SizeCode='12')
P12IPAZA   Medium (12") Handmade Pan Pizza   $9.99
>>> order.add_item('P12IPAZA')
>>> menu.search(Name='Marinara')
PINBBLMM   Italian Sausage Marinara BreadBowl Pasta   $7.99
PINPASMM   Italian Sausage Marinara Pasta             $6.99
MARINARA   Side Marinara Sauce Dipping Cup            $0.75
>>> order.add_item('MARINARA')
>>> menu.search(Name='Coke')
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
>>> order.add_item('20BCOKE')

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)

pizzapi's People

Contributors

aluttik avatar

Watchers

James Cloos avatar Luke Juusola 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.