python-citybikes
================
`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`_.
.. _Citybikes: https://citybik.es
.. _Citybikes API: https://api.citybik.es
.. _pybikes: https://github.com/eskerda/pybikes
Installation
------------
.. code-block:: sh
$ pip install python-citybikes
Usage
-----
First instantiate a client
.. code-block:: python
>>>> import citybikes
>>>> client = citybikes.Client()
Get the full list of networks
.. code-block:: python
>>>> 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
.. code-block:: python
>>>> 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
.. code-block:: python
>>>> bicing = citybikes.Network(client, uid='bicing')
>>>> bicing['name']
'Bicing'
>>>> len(bicing.stations)
465
Get a network ordered by distance to lat, lng
.. code-block:: python
>>>> # 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
.. code-block:: python
>>>> # 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
Raw data
{
"_id": null,
"home_page": null,
"name": "python-citybikes",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "Citybikes, api.citybik.es, bike sharing",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/fd/cc/312894e3990f0ad60f8111d6bd114e1fec5d5f6e807a1980dbc4b538fa3e/python_citybikes-0.3.0.tar.gz",
"platform": null,
"description": "python-citybikes\n================\n\n`python-citybikes` is a python client for the `Citybikes API`_.\n\nAbout Citybikes\n---------------\nCitybikes_ is a project about making bike sharing data available to both users\nand developers. It has a nice and easy to use API, but this package might be\nuseful to projects consuming the API.\n\n``python-citybikes`` must not be confused with `pybikes`_:\n\n- `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.\n- `python-citybikes` is a python wrapper around the `Citybikes API`_.\n\n.. _Citybikes: https://citybik.es\n.. _Citybikes API: https://api.citybik.es\n.. _pybikes: https://github.com/eskerda/pybikes\n\n\nInstallation\n------------\n\n.. code-block:: sh\n\n $ pip install python-citybikes\n\nUsage\n-----\nFirst instantiate a client\n\n.. code-block:: python\n\n >>>> import citybikes\n >>>> client = citybikes.Client()\n\nGet the full list of networks\n\n.. code-block:: python\n\n >>>> networks = list(client.networks)\n >>>> len(networks)\n 458\n >>>> networks[0]\n {'name': 'Opole Bike', 'href': '/v2/networks/opole-bike', 'location': {'lat\n itude': 50.6645, 'city': 'Opole', 'country': 'PL', 'longitude': 17.9276}, '\n id': 'opole-bike', 'company': ['Nextbike GmbH']}\n\nGet stations from a network\n\n.. code-block:: python\n\n >>>> len(networks[0].stations)\n 16\n >>>> list(networks[0].stations)[0]\n {'timestamp': '2016-11-22T16:05:44.318000Z', 'id': 'd8c9f66260759aeb27445b2\n cddf2d6b9', 'name': 'P\u0119tla Autobusowa - Dambonia', 'free_bikes': 7, 'empty_\n slots': 3, 'latitude': 50.661775266224, 'extra': {'bike_uids': ['60128', '6\n 0108', '60063', '60062', '60052', '60037', '60190'], 'number': '6011', 'slo\n ts': 10, 'uid': '132115'}, 'longitude': 17.888891100884}\n\nInstantiate a network by id directly\n\n.. code-block:: python\n\n >>>> bicing = citybikes.Network(client, uid='bicing')\n >>>> bicing['name']\n 'Bicing'\n >>>> len(bicing.stations)\n 465\n\nGet a network ordered by distance to lat, lng\n\n.. code-block:: python\n\n >>>> # Lets get the nearest network to NY lat, lng\n >>>> net, dist = next(iter(client.networks.near(40.7128, -74.0059)))\n >>>> net\n {'href': '/v2/networks/citi-bike-nyc', 'id': 'citi-bike-nyc', 'gbfs_href': \n 'https://gbfs.citibikenyc.com/gbfs/gbfs.json', 'location': {'latitude': 40.\n 7143528, 'country': 'US', 'longitude': -74.00597309999999, 'city': 'New Yor\n k, NY'}, 'company': ['NYC Bike Share, LLC', 'Motivate International, Inc.',\n 'PBSC Urban Solutions'], 'name': 'Citi Bike'}\n\nGet stations from a network ordered by distance to lat, lng\n\n.. code-block:: python\n\n >>>> # Now, get stations ordered by distance to Manhattan center\n >>>> sts = net.stations.near(40.7831, -73.9712)\n >>>> for s, dist in sts[:5]:\n ... print(s['name'])\n ...\n W 82 St & Central Park West\n Central Park West & W 85 St\n W 84 St & Columbus Ave\n Central Park West & W 76 St\n W 89 St & Columbus Ave\n\n",
"bugtrack_url": null,
"license": null,
"summary": "Client interface for the Citybikes API",
"version": "0.3.0",
"project_urls": {
"Documentation": "https://docs.citybik.es",
"Homepage": "https://citybik.es",
"Source": "https://github.com/eskerda/python-citybikes",
"Tracker": "https://github.com/eskerda/python-citybikes/issues"
},
"split_keywords": [
"citybikes",
" api.citybik.es",
" bike sharing"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "50051634439c9a35b4fca6468080385be84f9fbce55acbd165d332395ae99955",
"md5": "ee4035194e26d7278280637ce9cb9267",
"sha256": "e3f3319eafe017bfb10fb626f6577ab1a2f32cf339cc58b7365069235cc7b1f4"
},
"downloads": -1,
"filename": "python_citybikes-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ee4035194e26d7278280637ce9cb9267",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 7381,
"upload_time": "2025-08-19T19:32:30",
"upload_time_iso_8601": "2025-08-19T19:32:30.420565Z",
"url": "https://files.pythonhosted.org/packages/50/05/1634439c9a35b4fca6468080385be84f9fbce55acbd165d332395ae99955/python_citybikes-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "fdcc312894e3990f0ad60f8111d6bd114e1fec5d5f6e807a1980dbc4b538fa3e",
"md5": "61d464c3ff3a8ce26c02b1bdd58baf21",
"sha256": "9df2338ff158b1cd574f2224781935de4b25ac13d7ab7609d67167b229d52a4c"
},
"downloads": -1,
"filename": "python_citybikes-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "61d464c3ff3a8ce26c02b1bdd58baf21",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 8047,
"upload_time": "2025-08-19T19:32:31",
"upload_time_iso_8601": "2025-08-19T19:32:31.481480Z",
"url": "https://files.pythonhosted.org/packages/fd/cc/312894e3990f0ad60f8111d6bd114e1fec5d5f6e807a1980dbc4b538fa3e/python_citybikes-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-19 19:32:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "eskerda",
"github_project": "python-citybikes",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "python-citybikes"
}