Skip to main content

A simple BikeWise API wrapper.

License: MIT.

Installation

pip install python-bikewise

API Examples

Make an instance of the BikeWise class. For example:

from bikewise import BikeWise
bike = BikeWise()

You can access incident or location information:

  • Access the incidents endpoint if you’d like more detailed information about bike incidents.

  • Access the locations endpoint if you’d like to map incident locations. This endpoint behaves exactly like incidents, but returns a valid geojson.

  • Access the locations.markers endpoint (behaves like root locations endpoint) to return simplestyled markers (mapbox styled markers).

A table of acceptable parameters for methods in BikeWise(). Note, some parameters are restricted to certain methods - please look at the examples below.

Parameter

Data Type

Description

Notes

page

integer

Page of results to fetch.

per_page

integer

Number of results to return per page. Defaults to 25

occurred_before

integer

End of period

Accepts UTC unix timestamps.

occurred_after

integer

Start of period

Accepts UTC unix timestamps.

incident_type

string

Only incidents of specific type

proximity

string

Center of location for proximity search

Accepts an ip address, an address, zipcode, city, or latitude,longitude - i.e. 70.210.133.87, 210 NW 11th Ave, Portland, OR, 60647, Chicago, IL, and 45.521728,-122.67326 are all acceptable.

proximity_square

integer

Size of the proximity search

Sets the length of the sides of the square to find matches inside of. The square is centered on the location specified by proximity.

query

string

Full text search of incidents

id

integer

Incident ID

limit

integer

Max number of results to return. Defaults to 100

all

boolean

Give ‘em all to me. Will ignore limit

If you pass the all parameter it returns all matches (which can be big, > 4mb), otherwise it returns the 100 most recent.

Incidents:

# incidents method parameters
"""
bike.incidents(page=0, per_page=25)
bike.incidents.id(id)
bike.incidents.features(page=0, per_page=25, occurred_before=0, occurred_after=0,
                        incident_type="", proximity="", proximity_area=0, query="")
"""

# example
>>> bike.incidents.features(per_page=1, occurred_after=1440444800, incident_type='theft')
>>> {'incidents': [{'address': 'Portland, OR, 97227',
                    'description': 'Taken from basement',
                    'id': 115242,
                    'location_description': None,
                    'location_type': None,
                    'media': {'image_url': None, 'image_url_thumb': None},
                    'occurred_at': 1585854000,
                    'source': {'api_url': 'https://bikeindex.org/api/v1/bikes/705265',
                               'html_url': 'https://bikeindex.org/bikes/705265',
                               'name': 'BikeIndex.org'},
                    'title': 'Stolen 2018 On-One Dirty Disco(black)',
                    'type': 'Theft',
                    'type_properties': None,
                    'updated_at': 1585862797,
                    'url': 'https://bikewise.org/api/v1/incidents/115242'}]}

Locations & Markers:

# locations method parameters
"""
bike.locations(limit=100, all=False)
bike.locations.features(occurred_before=0, occurred_after=0, incident_type="", proximity="",
                        proximity_area=0, query="", limit=100, all=False)
bike.locations.markers(occurred_before=0, occurred_after=0, incident_type="", proximity="",
                       proximity_area=0, query="", limit=100, all=False)
"""

# example
>>> bike.locations.features(occurred_after=1440444800, incident_type='theft', limit=1)
>>> {'features': [{'geometry': {'coordinates': [-122.6766628, 45.5461375],
                                'type': 'Point'},
                   'properties': {'description': 'Taken from basement <a '
                                                 'href="https://bikeindex.org/bikes/705265" '
                                                 'target="_blank">View details</a>',
                                  'id': 115242,
                                  'marker-color': '#BD1622',
                                  'marker-size': 'small',
                                  'occurred_at': '2020-04-02 14:00:00 -0500',
                                  'title': 'Stolen 2018 On-One Dirty Disco '
                                           '(04-02-2020)'},
                   'type': 'Feature'}],
     'type': 'FeatureCollection'}

Support

If you find any bug or you want to propose a new feature, please use the issues tracker. I’ll be happy to help!

Metadata

Release files for python-bikewise 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-bikewise 0.1.0
File Size Uploaded Provenance
python-bikewise-0.1.0.tar.gz 6.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for python-bikewise 0.1.0
File Interpreter ABI Platform
python_bikewise-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.6 kB

Release files / python-bikewise-0.1.0.tar.gz

Download URL python-bikewise-0.1.0.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9599155e4c53995646bf50edfdcfbdb6ce2bbc8d5eef2e1c1528adb848df3da4
BLAKE2b-256 checksum
How to use checksums
711ecee8fa6373d2d65c8ce4e3c6514a8f963625316ff9bab47be3868f7f31e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release files / python_bikewise-0.1.0-py3-none-any.whl

Download URL python_bikewise-0.1.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4d93fb25b5ac71dc877573ca25d1acab1386b601549e8a3b1cfb59597984997
BLAKE2b-256 checksum
How to use checksums
68e7a9ac10e10d75c788463f6d48bf22cf944ce40e902cfe72b7998e932d9761
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Security for python-bikewise 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page