letterboxd package reference

letterboxd module

Python 3 wrapper for Version 0 of the Letterboxd API

class letterboxd.letterboxd.Letterboxd(api_base='https://api.letterboxd.com/api/v0', api_key='', api_secret='')[source]

Loads the API base URL, API key, and API shared secret, and connects with all of the other classes.

If the key and secret are not passed as arguments, it looks for them as environment variables, as LBXD_API_KEY and LBXD_API_SECRET.

auth()[source]
Returns:services.auth.Authentication object
film(film_id)[source]
Parameters:film_id – str - the LID of a film on Letterboxd
Returns:services.film.Film object
film_collection(film_collection_id, film_collection_request)[source]

/film-collection/{id}

Get details about a film collection by ID. The response will include the film relationships for the signed-in member and the member indicated by the member LID if specified.

Parameters:
  • film_collection_id – str - LID of the FilmCollection
  • film_collection_request – dict - FilmCollectionRequest
Returns:

dict - FilmCollection

films()[source]
Returns:services.film.Films object
list(list_id)[source]
Parameters:list_id – str - the LID of a list on Letterboxd
Returns:services.list.List object
member(member_id)[source]
Parameters:member_id – str - LID for Letterboxd member
Returns:services.member.Member object
search(search_request)[source]

/search

Parameters:search_request – dict - SearchRequest
Returns:dict - SearchResponse
user(username, password)[source]

Signs in the user, and adds the oAuth token to future API calls

Parameters:
  • username – str
  • password – str
Returns:

user.User object

api module

class letterboxd.api.API(api_base, api_key, api_secret)[source]

Communication methods for the Letterboxd API

api_call(path, params={}, form=None, headers={}, method='get')[source]

The workhorse method of calls to the Letterboxd API

Parameters:
  • path – str - URL endpoint path for the desired service
  • params – dict - request parameters
  • form – str - form information, likely from the auth.py call
  • headers – dict - request parameters
  • method – str - HTML methods, [get, post, put, patch, delete]
Returns:

requests.Response object

user module

User-based features of the Letterboxd API

class letterboxd.user.User(api, username, password)[source]

Provices access token and shortcuts to user-focused methods

me

/me

Get details about the authenticated member.

Calls to this endpoint must include the access token for an authenticated member.

Returns:dict - MemberAccount
me_update(member_settings_update_request)[source]

/me

Update the profile settings for the authenticated member.

Calls to this endpoint must include the access token for an authenticated member

Parameters:member_settings_update_request – dict - MemberSettingsUpdateRequest
Returns:dict - MemberSettingsUpdateResponse
token

Ask services.auth to get a token, and return the token string

Returns:str - oAuth token

config module

Configuration

Constants for package use.