swh.lister.bitbucket.lister module

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

Bases: swh.lister.core.indexing_lister.IndexingHttpLister


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: Dict) → Dict[str, Any][source]
get_next_target_from_response(response: requests.models.Response) → Optional[datetime.datetime][source]
This will read the ‘next’ link from the api response if any

and return it as a datetime.


response (Response) – requests’ response from api call


next date as a datetime

transport_response_simplified(response: requests.models.Response) → List[Dict[str, Any]][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.


response – response object from the server.


list of repo MODEL dicts

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

request_uri(identifier: datetime.datetime) → str[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: int, lower: Optional[int] = None, upper: Optional[int] = None) → bool[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 )

  • inner (sortable type) – the value being checked

  • lower (sortable type) – optional lower bound

  • upper (sortable type) – optional upper bound


whether inner is confined by the optional lower and upper bounds