Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed predictions error and spruced up README #5

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,19 @@ Install with Pip:
Usage
---

```
>>> import py_nextbus
>>> client = py_nextbus.NextBusClient(output_format='json')
>>> agencies = client.get_agency_list()
```python
import py_nextbus
client = py_nextbus.NextBusClient(output_format='json')

agencies = client.get_agency_list()

# Set client agency for further requests
client = py_nextbus.NextBusClient(output_format='json', agency='sf-muni')

# View routes and see available stops, etc
client.get_route_list()
client.get_route_config('25')

# Get prediction for a route at a stop
client.get_predictions(stop_tag='7617', route_tag='25')
```
3 changes: 2 additions & 1 deletion py_nextbus/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
NEXTBUS_XML_FEED_URL = 'http://webservices.nextbus.com/service/publicXMLFeed'
NEXTBUS_JSON_FEED_URL = 'http://webservices.nextbus.com/service/publicJSONFeed'


class NextBusClient():
"""Minimalistic client for making requests using the NextBus API.

Expand Down Expand Up @@ -191,7 +192,7 @@ def get_predictions(self, stop_tag, route_tag=None, agency=None):
}

if route_tag is not None:
params['routeTag'] = route_tag
params['r'] = route_tag

return self._perform_request(params=params)

Expand Down