elwarren/citibike_trips

doesn't work

Closed this issue · 3 comments

ryrr commented

:( its trying to interpret station name as an int

Thanks for using my code! Can you show me an example? I just cloned master and ran a successful test. The output csv contains station names as expected. Running interactively and calling station_by_name with a string also works:

In [10]: cb.station_by_name('W 11 St & 6 Ave')
Out[10]:
{'type': 'Feature',
 'geometry': {'type': 'Point', 'coordinates': [-73.99800419, 40.73532427]},
 'properties': {'station_id': '254',
  'name': 'W 11 St & 6 Ave',
  'terminal': '5914.03',
  'capacity': 59,
  'bikes_available': 11,
  'docks_available': 46,
  'bikes_disabled': 2,
  'docks_disabled': 0,
  'renting': True,
  'returning': True,
  'ebike_surcharge_waiver': False,
  'installed': True,
  'last_reported': 1593660564,
  'icon_pin_bike_layer': 'pin-bike-green-half',
  'icon_pin_dock_layer': 'pin-dock-green-most',
  'icon_dot_bike_layer': 'dot-green',
  'icon_dot_dock_layer': 'dot-green',
  'bike_angels_action': 'neutral',
  'bike_angels_points': 0,
  'bike_angels_digits': 0,
  'valet_status': 'none',
  'zipcode': '10011'}}

full test snippet:

from citibike_trips import CitibikeTrips
u = 'yourname'
p = 'yourpass'
cb = CitibikeTrips(username=u, password=p, save=True)
cb.get_all()
cb.station_by_id('4011')
cb.station_by_name('W 11 St & 6 Ave')
ryrr commented

File "get-trips.py", line 10, in <module> cb.get_all() File "/Users/ryan/projects/citibike_trips/citibike_trips/__init__.py", line 156, in get_all self.extract_profile() File "/Users/ryan/projects/citibike_trips/citibike_trips/__init__.py", line 280, in extract_profile 0 ValueError: invalid literal for int() with base 10: 'Grand'

This is the error i'm getting, I actually resolved it by deleting all the lines involving citibike angels, which I am not a member of. I'm pretty sure null values for those are causing the error. Also unrelated, but all the account information is null for me.

I've created a branch called baprofile that has made bikeangels lookup optional. When initializing the class, just pass ba=False to disable all bikeangels related lookups. The get_profile call will return only account and profile information without downloading trips. It's available here:

https://github.com/elwarren/citibike_trips/tree/baprofile

There are many other enhancements like optionally writing files to filesystem. The heavy 9mb download for zipcodes is gone.

Please test and report back any issues. It works in my testing but I don't have a non-bikeangels account to verify.