lnk.tinyurl package¶
Submodules¶
lnk.tinyurl.cli module¶
lnk.tinyurl.command module¶
Contains the base-class for all bit.ly commands.
-
class
lnk.tinyurl.command.Command(which)[source]¶ Bases:
lnk.abstract.AbstractCommandBase-class for all tinyurl commands.
Configures the AbstractCommand base class for all commands in the entire application, which needs information about the service being used. Moreover sets up the necessary parameters needed for any request to the bit.ly API (the api-key, the response-format and the provider).
-
parameters¶ dict
The necessary parameters for any request to the tinyurl API.
-
static
verify(response, what)[source]¶ Verifies an HTTP-response from the tinyurl API.
Overrides the ‘pure-virtual’ (i.e. not-implemented) base method from AbstractCommand. If the verification finds no faults in the response, the data is returned.
Parameters: - response (requests.Response) – The HTTP response to a request to the bit.ly API.
- what (str) – A human-readable string representing what the request was for, such that if there is an error in the response, an errors.HTTPError or errors.APIError is raised with the message ‘Could not <what>.’
Returns: The actual data of the response, if no fault was found.
Raises: errors.HTTPError– If it was found that there was an HTTP-related exception, such as a faulty URL or other badness.
-