{"id":13573161,"url":"https://github.com/eskerda/pybikes","last_synced_at":"2025-05-15T02:09:46.359Z","repository":{"id":978174,"uuid":"778569","full_name":"eskerda/pybikes","owner":"eskerda","description":"bike sharing + python = pybikes","archived":false,"fork":false,"pushed_at":"2025-05-12T20:21:43.000Z","size":2554,"stargazers_count":578,"open_issues_count":24,"forks_count":170,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-05-12T21:37:54.908Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://citybik.es","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eskerda.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2010-07-16T10:07:59.000Z","updated_at":"2025-05-12T20:21:44.000Z","dependencies_parsed_at":"2024-01-12T04:56:10.301Z","dependency_job_id":"4322357f-e4e6-4d8d-a46f-f8c496800351","html_url":"https://github.com/eskerda/pybikes","commit_stats":{"total_commits":1231,"total_committers":107,"mean_commits":"11.504672897196262","dds":0.4354183590576767,"last_synced_commit":"1310c156426d9cca18b0a1cb2e29980091b4c4c3"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eskerda%2Fpybikes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eskerda%2Fpybikes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eskerda%2Fpybikes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eskerda%2Fpybikes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eskerda","download_url":"https://codeload.github.com/eskerda/pybikes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253836688,"owners_count":21971970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T15:00:31.037Z","updated_at":"2025-05-15T02:09:46.342Z","avatar_url":"https://github.com/eskerda.png","language":"Python","readme":"pybikes [![Build Status](https://github.com/eskerda/pybikes/actions/workflows/test.yml/badge.svg)](https://github.com/eskerda/pybikes/actions/workflows/test.yml)\n[![Chat on Matrix](https://matrix.to/img/matrix-badge.svg)](https://matrix.to/#/#citybikes:matrix.org)\n=======\n![pybikes](http://citybik.es/files/pybikes.png)\n\npybikes provides a set of tools to scrape bike sharing data from different\nwebsites and APIs, thus providing a coherent and generalized set of classes\nand methods to access this sort of information.\n\nThe library is distributed and intended mainly for statistics and data\nsharing projects. More importantly, it powers the [CityBikes][1] project, and\nis composed of a set of classes and a pack of data files that provide instances\nfor all different systems.\n\nInstallation\n------------\n\nInstall directly from GitHub:\n```bash\npip install git+https://github.com/eskerda/pybikes.git\n```\n\nOr after downloading/cloning the source:\n```bash\npython setup.py install\n```\n\nThe following dependencies are required (example using Ubuntu package manager):\n```\nsudo apt-get install python\nsudo apt-get install python-setuptools\nsudo apt-get install libxml2 libxml2-dev libxslt1-dev libgeos-dev\n```\n\nUsage\n-----\n```python\n\u003e\u003e\u003e import pybikes\n\n# Capital BikeShare instantiation data is in bixi.json file\n\u003e\u003e\u003e capital_bikeshare = pybikes.get('capital-bikeshare')\n\n# The instance contains all possible metadata regarding this system\n\u003e\u003e\u003e print(capital_bikeshare.meta)\n{\n    'name': 'Capital BikeShare',\n    'city': 'Washington, DC - Arlington, VA',\n    'longitude': -77.0363658,\n    'system': 'Bixi',\n    'company': ['PBSC'],\n    'country': 'USA',\n    'latitude': 38.8951118\n}\n# The update method retrieves the list of stations\n\u003e\u003e\u003e print(len(capital_bikeshare.stations))\n0\n\u003e\u003e\u003e capital_bikeshare.update()\n\u003e\u003e\u003e print(len(capital_bikeshare.stations))\n191\n\u003e\u003e\u003e print(capital_bikeshare.stations[0])\n--- 31000 - 20th \u0026 Bell St ---\nbikes: 7\nfree: 4\nlatlng: 38.8561,-77.0512\nextra: {\n    'installed': True,\n    'uid': 1,\n    'locked': False,\n    'removalDate': '',\n    'installDate': '1316059200000',\n    'terminalName': '31000',\n    'temporary': False,\n    'name': '20th \u0026 Bell St',\n    'latestUpdateTime': '1353454305589'\n}\n```\n\nSome systems might require an API key to work (for instance, Cyclocity). In\nthese cases, the instance factory can take an extra API key parameter.\n\n```python\n\u003e\u003e\u003e key = \"This is not an API key\"\n\u003e\u003e\u003e dublinbikes = pybikes.get('dublinbikes', key)\n```\n\nNote that pybikes works as an instance factory and, choicely, instances can be\ngenerated by passing the right arguments to the desired class\n\n```python\n\u003e\u003e\u003e from pybikes.cyclocity import BixiSystem\n\u003e\u003e\u003e capital_bikeshare = BixiSystem(\n        tag = 'foo_tag',\n        root_url = 'http://capitalbikeshare.com/data/stations/',\n        meta = {'foo':'bar'}\n    )\n```\n\nThe way information is retrieved can be tweaked using the PyBikesScraper class\nincluded on the utils module thus allowing session reusing and niceties such as\nusing a proxy. This class uses [Requests][2] module internally.\n\n```python\n\u003e\u003e\u003e scraper = pybikes.utils.PyBikesScraper()\n\u003e\u003e\u003e scraper.enableProxy()\n\u003e\u003e\u003e scraper.setProxies({\n        \"http\" : \"127.0.0.1:8118\",\n        \"https\": \"127.0.0.1:8118\"\n    })\n\u003e\u003e\u003e scraper.setUserAgent(\"Walrus™ v3.0\")\n\u003e\u003e\u003e scraper.headers['Foo'] = 'bar'\n\u003e\u003e\u003e capital_bikeshare.update(scraper)\n```\n\n[1]: http://www.citybik.es              \"CityBikes\"\n[2]: http://docs.python-requests.org    \"Requests\"\n\nTests\n-----\nTests are separated between unit tests and integration tests with the different\nsources supported.\n\nTo run unit tests simply\n\n```bash\nmake test\n```\n\nTo run integration tests\n\n```bash\nmake test-update\n```\n\nNote that some systems require authorization keys, tests expect these to be\nset as environment variables like:\n\n```bash\nPYBIKES_CYCLOCITY='some-api-key'\nPYBIKES_DEUTSCHEBAHN_CLIENT_ID='some-client-id'\nPYBIKES_DEUTSCHEBAHN_CLIENT_SECRET='some-client-secret'\n\n# or if using an .env file\n# source .env\n\nmake test-update\n```\n\nThis project uses pytest for tests. Test a particular network by passing a\nfilter expresson\n\n```bash\npytest -k bicing\npytest -k gbfs\n```\n\nTo speed up tests execution, install [pytest-xdist][3] to specify the number of\nCPUs to use\n\n```bash\npytest -k gbfs -n auto\n```\n\nTo use Makefile steps and pass along pytest arguments, append to the `T_FLAGS`\nvariable\n\n```bash\nmake test-update T_FLAGS+='-n 10 -k gbfs'\n```\n\nIntegration tests can generate a json report file with all extracted data stored\nas geojson. Using this json report file, further useful reports can be generated\nlike a summary of the overall health of the library or a map visualization of\nall the information.\n\nFor more information on reports see [utils/README.md][4]\n\n[3]: https://pypi.org/project/pytest-xdist/\n[4]: utils/README.md\n\nDevelopment\n-----------\nWe welcome contributions from the community! The best place to get started is\nby diving into the codebase or checking the issues list.\n\nJoin our developer community on Matrix: [#citybikes:matrix.org](https://matrix.to/#/#citybikes:matrix.org)\n","funding_links":[],"categories":["Consumption","Uncategorized","Producing Data","Python","Planning Coding Resources"],"sub_categories":["Mobility and Transportation","Uncategorized","Software for Creating APIs","Python"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feskerda%2Fpybikes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feskerda%2Fpybikes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feskerda%2Fpybikes/lists"}