Skip to main content

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

Metadata

Release files for seattle-food-truck 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for seattle-food-truck 0.3.1
File Size Uploaded
seattle_food_truck-0.3.1.tar.gz 7.6 kB Details

Release files / seattle_food_truck-0.3.1.tar.gz

Download URL seattle_food_truck-0.3.1.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7ef8067fc4c0b2abf65fe5181e7b1144d12a8dc2d67a62112fe61f57be8d1507
BLAKE2b-256 checksum
How to use checksums
5a3d3921031743814f603ce5cfd257403032953104ce122ddfc63e116dd2a181
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.6.0.post20201009 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.3

Release history Release notifications | RSS feed

This release

0.3.1 This release

1 release file

0.3.0

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

2 release files

0.1.0

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page