Client interface for the Citybikes API
Project description
python-citybikes is a python client for the Citybikes API.
About Citybikes
Citybikes is a project about making bike sharing data available to both users and developers. It has a nice and easy to use API, but this package might be useful to projects consuming the API.
python-citybikes must not be confused with pybikes:
pybikes is a set of tools to access bike sharing data directly from the providers. It’s the library powering the project and the API. If a network is not supported or does not correctly work, it’s there where the issue or the contribution must be sent.
python-citybikes is a python wrapper around the Citybikes API.
Installation
$ pip install python-citybikes
Usage
First instantiate a client
>>>> import citybikes
>>>> client = citybikes.Client()
Get the full list of networks
>>>> networks = list(client.networks)
>>>> len(networks)
458
>>>> networks[0]
{'name': 'Opole Bike', 'href': '/v2/networks/opole-bike', 'location': {'lat
itude': 50.6645, 'city': 'Opole', 'country': 'PL', 'longitude': 17.9276}, '
id': 'opole-bike', 'company': ['Nextbike GmbH']}
Get stations from a network
>>>> len(networks[0].stations)
16
>>>> list(networks[0].stations)[0]
{'timestamp': '2016-11-22T16:05:44.318000Z', 'id': 'd8c9f66260759aeb27445b2
cddf2d6b9', 'name': 'Pętla Autobusowa - Dambonia', 'free_bikes': 7, 'empty_
slots': 3, 'latitude': 50.661775266224, 'extra': {'bike_uids': ['60128', '6
0108', '60063', '60062', '60052', '60037', '60190'], 'number': '6011', 'slo
ts': 10, 'uid': '132115'}, 'longitude': 17.888891100884}
Instantiate a network by id directly
>>>> bicing = citybikes.Network(client, uid='bicing')
>>>> bicing['name']
'Bicing'
>>>> len(bicing.stations)
465
Get a network ordered by distance to lat, lng
>>>> # Lets get the nearest network to NY lat, lng
>>>> net, dist = next(iter(client.networks.near(40.7128, -74.0059)))
>>>> net
{'href': '/v2/networks/citi-bike-nyc', 'id': 'citi-bike-nyc', 'gbfs_href':
'https://gbfs.citibikenyc.com/gbfs/gbfs.json', 'location': {'latitude': 40.
7143528, 'country': 'US', 'longitude': -74.00597309999999, 'city': 'New Yor
k, NY'}, 'company': ['NYC Bike Share, LLC', 'Motivate International, Inc.',
'PBSC Urban Solutions'], 'name': 'Citi Bike'}
Get stations from a network ordered by distance to lat, lng
>>>> # Now, get stations ordered by distance to Manhattan center
>>>> sts = net.stations.near(40.7831, -73.9712)
>>>> for s, dist in sts[:5]:
... print(s['name'])
...
W 82 St & Central Park West
Central Park West & W 85 St
W 84 St & Columbus Ave
Central Park West & W 76 St
W 89 St & Columbus Ave
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_citybikes-0.3.3.tar.gz.
File metadata
- Download URL: python_citybikes-0.3.3.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5365656ea956fbc4e09d09ed0d945c23ff81519a64594ddaf9f02926c3b5275e
|
|
| MD5 |
5459d3027a94a0302fb5683a85b4e167
|
|
| BLAKE2b-256 |
69d377c2960b8c518aec05a4bce8d88ff6f75cca44509be1fc869dc96f1ca72e
|
Provenance
The following attestation bundles were made for python_citybikes-0.3.3.tar.gz:
Publisher:
release.yml on eskerda/python-citybikes
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_citybikes-0.3.3.tar.gz -
Subject digest:
5365656ea956fbc4e09d09ed0d945c23ff81519a64594ddaf9f02926c3b5275e - Sigstore transparency entry: 417782544
- Sigstore integration time:
-
Permalink:
eskerda/python-citybikes@ad35130ca8d08846dc3a11c065b74d2ff335eb03 -
Branch / Tag:
refs/tags/0.3.3 - Owner: https://github.com/eskerda
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ad35130ca8d08846dc3a11c065b74d2ff335eb03 -
Trigger Event:
push
-
Statement type:
File details
Details for the file python_citybikes-0.3.3-py3-none-any.whl.
File metadata
- Download URL: python_citybikes-0.3.3-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55546599f7eaacf6b812b3cb3f20c5eb3f1cf52af5a3a26431feb2bf2f784175
|
|
| MD5 |
1f3edc5facfec00d290ae0b0638e6290
|
|
| BLAKE2b-256 |
8f6dd810487aeda93208e86d53f5ddc5c015aa8f44239b6320d332e9bb3391ac
|
Provenance
The following attestation bundles were made for python_citybikes-0.3.3-py3-none-any.whl:
Publisher:
release.yml on eskerda/python-citybikes
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_citybikes-0.3.3-py3-none-any.whl -
Subject digest:
55546599f7eaacf6b812b3cb3f20c5eb3f1cf52af5a3a26431feb2bf2f784175 - Sigstore transparency entry: 417782556
- Sigstore integration time:
-
Permalink:
eskerda/python-citybikes@ad35130ca8d08846dc3a11c065b74d2ff335eb03 -
Branch / Tag:
refs/tags/0.3.3 - Owner: https://github.com/eskerda
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ad35130ca8d08846dc3a11c065b74d2ff335eb03 -
Trigger Event:
push
-
Statement type: