Private functions#
HTTPAPIWrapper._checked_get_or_post#
Runs a GET or POST request returning the result as a JSON with optional logging and error raising.
**HTTPAPIWrapper._checked_get_or_post**(self, url, the_request, is_post, requests_kwargs, good_message, bad_message, raise_errors)
__url:__ The https://… url.
__the_request:__ The “json” kwarg is set to this. Can be None in which no “json” will be set.
__is_post:__ True for post, False for get.
__requests_kwargs=None:__ Dict of extra arguments to send to requests/aiohttp. None is equivalent to {}.
__good_message=None:__ The string-valued message to logger.debug. None means do not log.
__bad_message=’This HTTPs request failed’:__ The string-valued message to prepend to logger.error if the response isnt code 10000.
__raise_errors=True:__ Raise a BadResponseException if the request returns an error.
The https response as a dict, using requests/aiohttp.post(…).json() to parse it.
BadResponseException if raise_errors=True and the response is an error response.
HTTPAPIWrapper._xtract_character#
**HTTPAPIWrapper._xtract_character**(self, resp_data)
__resp_data:__ JSON response data.
The Character object.
(this function does not raise any notable errors)
HTTPAPIWrapper._upload_extension#
Gets the upload URL and needed fields for uploading a file.
**HTTPAPIWrapper._upload_extension**(self, extension)
__extension:__ String-valued extension.
(upload_url or None, upload_fields).
(this function does not raise any notable errors)
HTTPAPIWrapper._do_upload#
Uploads a file to the given upload URL with the given upload fields.
**HTTPAPIWrapper._do_upload**(self, upload_url, upload_fields, file_path)
__upload_url:__ Obtained with _upload_extension.
__upload_fields:__ Obtained with _upload_extension.
__file_path:__ The path of the file.
The full URL string of the uploaded file. None if doesn’t receive a valid response (error condition).
Exception: If the file upload fails, this function will raise an exception detailing the error.
HTTPAPIWrapper.__str__#
The string output function for debugging.
**HTTPAPIWrapper.__str__**(self)
__(this class constructor accepts no arguments):__
The easy-to-read string summary.
(this function does not raise any notable errors)
HTTPAPIWrapper.__repr__#
The string output function for debugging.
**HTTPAPIWrapper.__repr__**(self)
__(this class constructor accepts no arguments):__
The easy-to-read string summary.
(this function does not raise any notable errors)
Private attributes#
_URL2example_response
HTTPAPIWrapper._checked_get_or_post._URL2example_response
HTTPAPIWrapper._do_upload._
HTTPAPIWrapper._checked_get_or_post._URL2example_response