Git Product home page Git Product logo

py_nextbus's People

Contributors

pmaris avatar

Stargazers

 avatar

Watchers

 avatar

py_nextbus's Issues

Import error

When trying to import the py_nextbus module, I get the following error. I haven't been able to figure out what it means.

Traceback (most recent call last): File "/home/nick/Documents/Workspaces/BusScheduler/HomeBusSchedule.py", line 1, in <module> import py_nextbus File "/home/nick/Documents/Workspaces/BusScheduler/py_nextbus/__init__.py", line 3, in <module> from .client import NextBusClient File "/home/nick/Documents/Workspaces/BusScheduler/py_nextbus/client.py", line 3, in <module> from urllib.error import HTTPError ImportError: No module named error

`TypeError` when getting vehicle locations

When Client().get_vehicle_locations() is called, it returns a TypeError.

before_times[i] is the last time the request was made.

Traceback (most recent call last):
  File "program.py", line 51, in <module>
    data = client.get_vehicle_locations(route, before_times[i], agency)
  File "/home/user/env/lib/python3.5/site-packages/py_nextbus/client.py", line 301, in get_vehicle_locations
    return self._perform_request(params=params)
  File "/home/user/env/lib/python3.5/site-packages/py_nextbus/client.py", line 367, in _perform_request
    response = json.loads(response_text)
  File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
    s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'

Change of ownership?

Hey @pmaris. Seems like you're no longer maintaining this project. I'm happy to take it over if you want to move it to an org and add me to the Pypi account.

NextBus not returning proper values when stop includes underscore

The issue is in this line of code:

'stops': '&stops='.join(['%s|%d' % (stop['route_tag'],

Strings are valid for 'stop_tag'. For example, LA Metro Rail uses 80409_0 and 80409_1, with the number after the underscore indicating which direction the trains are moving in: https://www.nextbus.com/#!/lametro-rail/804/804_0_var0/80409_0

Casting to an int means that these stops aren't found properly, since the casting process drops the underscore.

Incorrect parameter for predictions command

I'm seeing the following in my logs when using the client:

Making request to URL http://webservices.nextbus.com/service/publicJSONFeed?command=predictions&a=sf-muni&s=6659&routeTag=36
hass_1  | 2019-01-15 06:22:28 DEBUG (SyncWorker_0) [custom_components.nextbus] 
 {'copyright': 'All data copyright San Francisco Muni 2019.', 'Error': {'content': 'route parameter "r" must be specified in query string', 'shouldRetry': 'false'}}

I can reproduce and resolve with curl by switching the param name to r:

$ curl "http://webservices.nextbus.com/service/publicJSONFeed?command=predictions&a=sf-muni&s=6934&routeTag=36"
{"copyright":"All data copyright San Francisco Muni 2019.","Error":{"content":"route parameter \"r\" must be specified in query string","shouldRetry":"false"}}

$ curl "http://webservices.nextbus.com/service/publicJSONFeed?command=predictions&a=sf-muni&s=6934&r=36"
{"predictions":{"agencyTitle":"San Francisco Muni","routeTag":"36","routeTitle":"36-Teresita","direction":{"title":"Inbound to Forest Hill Station","prediction":{"isDeparture":"false","minutes":"26","seconds":"1608","tripTag":"8239605","vehicle":"8522","affectedByLayover":"true","block":"3603","dirTag":"36___I_N00","epochTime":"1547536388615"}},"stopTitle":"Woodside Ave & Hernandez Ave","stopTag":"6934"},"copyright":"All data copyright San Francisco Muni 2019."}

Seems like a quick fix on line 194.

I can submit a patch tomorrow.

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.