Requester

Just another Python API for Travis CI (API).

A module which provides the requester object. It’s the object which communicates with the API endpoints.

Author:
Nissar Chababy, @funilrys, contactTATAfunilrysTODTODcom
Project link:
https://github.com/funilrys/PyTravisCI
Project documentation:
https://pytravisci.readthedocs.io/en/latest/

License

MIT License

Copyright (c) 2019, 2020, 2021, 2022 Nissar Chababy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
class PyTravisCI.requester.Requester[source]

Handles all our communication / requests to the Travis CI API.

This only provides lower level implementation. Meaning that you give it raw data and it provides you raw data in exchange. While working with this class, you don’t have access to enhanced feature provided by something like Resource Types objects.

Warning

You are not expected or invited to use this class directly if you don’t know what it may imply!

bind_endpoint_to_base_url(endpoint: str) → str[source]

Binds the endpoint with the base url.

delete(endpoint: str, **kwargs) → dict[source]

Sends a DELETE requests and returns the response.

get(endpoint: str, **kwargs) → dict[source]

Sends a GET requests and returns the response.

classmethod get_error_message(api_response: dict, *, already_checked: bool = False) → Optional[str][source]

Provides the error message.

classmethod get_error_type(api_response: dict, *, already_checked: bool = False) → Optional[str][source]

Provides the error type.

head(endpoint: str, **kwargs) → dict[source]

Sends a HEAD requests and returns the response.

static is_error(api_response: dict) → bool[source]

Checks if the API response is or contain an error as defined by the Travis CI API documentation.

options(endpoint: str, **kwargs) → dict[source]

Sends a OPTIONS requests and returns the response.

patch(endpoint: str, **kwargs) → dict[source]

Sends a PATCH requests and returns the response.

post(endpoint: str, **kwargs) → dict[source]

Sends a POST requests and returns the response.

put(endpoint: str, **kwargs) → dict[source]

Sends a PUT requests and returns the response.

classmethod raise_if_error(req: requests.models.Request, api_response: dict) → None[source]

Raises a TravisCIError if the given API response contain an error.

request_factory()[source]

A decorator which acts as an universal request factory.

set_authorization(value: str) → None[source]

Sets the authorization header.

Raises:TypeError – If value is not a string.
set_base_url(value: str) → None[source]

Sets the base URL we have to communicate with.

Raises:TypeError – If value is not a string.