API Reference

class bixi.bixi.Bixi(session: SyncClientSession)

Bases: object

Client for the Bixi GraphQL API.

GRAPHQL_URL

URL of the Bixi GraphQL endpoint.

classmethod login(username: str, password: str) Bixi

Log into the Bixi API and return an authenticated client.

Parameters:
  • username – Bixi account username.

  • password – Bixi account password.

Returns:

An authenticated Bixi client.

Raises:

BixiLoginError – If the login request fails, is rejected, or no session cookie is returned.

rides(offset: int = 0) list[Ride]

Get the current member’s ride history.

Parameters:

offset – Number of most-recent rides to skip, for pagination. Defaults to 0, which returns the full ride history.

Returns:

List of rides, most recent first.

Raises:
  • ValueError – If offset is negative.

  • BixiError – If the request to fetch rides fails.

stations() list[Station]

Get all Bixi stations currently in service.

Returns:

List of stations.

Raises:

BixiError – If the request to fetch stations fails.

exception bixi.bixi.BixiError

Bases: Exception

Raised when a Bixi API request fails.

exception bixi.bixi.BixiLoginError

Bases: BixiError

Raised when authenticating with the Bixi API fails.

class bixi.bixi.Ride(id: str, start_time: datetime, end_time: datetime, price: float, duration: timedelta, start_station_name: str, end_station_name: str)

Bases: object

A completed Bixi ride.

id

Unique identifier of the ride.

Type:

str

start_time

Date and time the ride started.

Type:

datetime.datetime

end_time

Date and time the ride ended.

Type:

datetime.datetime

price

Price charged for the ride.

Type:

float

duration

Duration of the ride.

Type:

datetime.timedelta

start_station_name

Name of the station where the ride started.

Type:

str

end_station_name

Name of the station where the ride ended.

Type:

str

class bixi.bixi.Station(id: str, name: str, lat: float, lng: float)

Bases: object

A Bixi bike-share station.

id

Unique identifier of the station.

Type:

str

name

Display name of the station.

Type:

str

lat

Latitude of the station.

Type:

float

lng

Longitude of the station.

Type:

float