swh.lister.bitbucket.lister module

class swh.lister.bitbucket.lister.BitBucketLister(url=None, override_config=None, per_page=100)[source]

Bases: swh.lister.core.indexing_lister.IndexingHttpLister

MODEL

alias of swh.lister.bitbucket.models.BitBucketModel

LISTER_NAME = 'bitbucket'
DEFAULT_URL = 'https://api.bitbucket.org/2.0'
instance = 'bitbucket'
default_min_bound = datetime.datetime(1970, 1, 1, 0, 0, tzinfo=datetime.timezone.utc)
PATH_TEMPLATE = '/repositories?after=%s'
get_model_from_repo(repo)[source]
get_next_target_from_response(response)[source]
This will read the ‘next’ link from the api response if any

and return it as a datetime.

Parameters

response (Response) – requests’ response from api call

Returns

next date as a datetime

transport_response_simplified(response)[source]
Convert the server response into list of a dict for each repo in the

response, mapping columns in the lister’s MODEL class to repo data.

Implementation of this method depends on the server API spec and the shape of the network response object returned by the transport_request method.

Parameters

response – response object from the server.

Returns

list of repo MODEL dicts

( eg. [{‘uid’: r[‘id’], etc.} for r in response.json()] )

request_uri(identifier)[source]

Get the full request URI given the transport_request identifier.

MAY BE OVERRIDDEN if something more complex than the PATH_TEMPLATE is required.

is_within_bounds(inner, lower=None, upper=None)[source]

See if a sortable value is inside the range [lower,upper].

MAY BE OVERRIDDEN, for example if the server indexable* key is technically sortable but not automatically so.

    • ( see: swh.lister.core.indexing_lister.IndexingLister )

Parameters
  • inner (sortable type) – the value being checked

  • lower (sortable type) – optional lower bound

  • upper (sortable type) – optional upper bound

Returns

whether inner is confined by the optional lower and upper bounds