Git Product home page Git Product logo

seattle-food-truck's Introduction

seattle-food-truck

A Python 3.6+ library for discovering Seattle Food Truck schedules

Installation · Tutorial · Command Line Utility · Contributing

PyPI version


Installation

❯ pip install seattle-food-truck

Tutorial

The Client allows you to discover convenient or nearby locations where food trucks are scheduled to visit! After finding a suitable Location we can query it for a schedule of trucks.

from seattle_food_truck import Client

sft = Client()

You can discover locations through listing them all. All locations are memoized once they are discovered to speedup all future queries.

print(f'There are {len(sft.locations)} locations.\n')
print(sft.locations)
There are 675 locations.

[
  Location(name="Metropolitan Park", address="1100 Olive Way, Seattle, WA, United States", uid=283),
  Location(name="10020 Southeast 256th Street, Kent, WA, USA", address="10020 Southeast 256th Street, Kent, WA, USA", uid=633),
  Location(name="1020 Central Avenue North, Kent, WA, USA", address="1020 Central Avenue North, Kent, WA, USA", uid=866),
  Location(name="10256 16th Avenue Southwest, Seattle, WA, USA", address="10256 16th Avenue Southwest, Seattle, WA, USA", uid=864),
  Location(name="103 110th Ave NE, Bellevue, WA, USA", address="103 110th Ave NE, Bellevue, WA, USA", uid=553),
  Location(name="104 Washington Avenue South, Orting, WA, USA", address="104 Washington Avenue South, Orting, WA, USA", uid=806),
  Location(name="10416 193rd Street Court East, Graham, WA, USA", address="10416 193rd Street Court East, Graham, WA, USA", uid=807),
  ...
]

It would be easier if we could sort the list of locations by their proximity to my home or job site! The Client provides two functions for this purpose.

The first discovers all locations ranked by their direct distance away.

address = '3131 Elliott Ave Seattle WA 98121'

for distance, location in sft.locations_closest_to(address):
    print(f'{distance:0.2f} miles away: {location.name}')
    print('\t' + location.address)
0.11 miles away: PI Building
    101 Elliott Ave W, Seattle, WA, United States
0.27 miles away: Olympic Sculpture Park
    2901 Western Avenue, Seattle, WA, United States
0.43 miles away: F5 Networks
    401 Elliott Ave W, Seattle, WA 98119, United States
0.66 miles away: Memorial Stadium
    401 5th Avenue North, Seattle, WA, United States
...

The second simply returns the location nearest to me.

location = sft.nearest_location_to(address)

for truck in location.trucks_today():
    print(truck)
Truck("NOSH", style="Seafood")
Truck("Raney Brothers BBQ", style="BBQ")

Command Line Utility

A primitive CLI tool is installed with this library.

$ sft
Usage: sft [OPTIONS] COMMAND [ARGS]...

  Tool to get you the food trucks scheduled near you in Seattle.

Options:
  --help  Show this message and exit.

Commands:
  locations        Print the locations with food truck bookings.
  trucks-today     Print the truck bookings today.
  trucks-tomorrow  Print the truck bookings tomorrow
❯ sft trucks-tomorrow --location-uid 69
Truck("Sam Choy's Poke To The Max", style="Hawaiian")
Truck("Bumbu Truck", style="Asian")

Contributing

Pull requests, feature requests, and issues welcome!

This library uses the undocumented API at www.seattlefoodtruck.com

seattle-food-truck's People

Contributors

clintval avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

seattle-food-truck's Issues

the library is fail to be installed at Ubuntu 18.04.3

Hi,

when I try to install the library, I got the failure as following:

ubuntu@ip-172-31-21-75:~$ pip install seattle-food-truck
Collecting seattle-food-truck
Downloading https://files.pythonhosted.org/packages/c7/c7/9f404dd5d008aaaa8d6af06b927ec3a6f6818e70cc62f6037a1bd4524d78/seattle_food_truck-0.1.3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-d4bM21/seattle-food-truck/setup.py", line 11
ARTIFACT = f'https://github.com/{AUTHOR}/{PACKAGE}/archive/v{VERSION}.tar.gz'
^
SyntaxError: invalid syntax

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-d4bM21/seattle-food-truck/
ubuntu@ip-172-31-21-75:$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
ubuntu@ip-172-31-21-75:
$

any solution?

thanks,

Add tests

Tests are scattered on local computer. Will make into unittest test classes and push.

CLI tools

Script up an interface on the CLI to mirror the main class. Will be simple with click.

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.