2. pyrate Package

2.1. pyrate Package

2.2. main Module

class pyrate.main.Pyrate[source]

Bases: object

This is the main class

Parameters:
  • http_methods (list) – List of available HTTP methods for this service
  • return_formats (list) – List of available return formats for this service
  • default_header_content – Default content for the request header
  • default_body_content – Default content for the request body
  • default_http_method (string) – Default HTTP method (will be used if none else is specified in request)
  • default_return_format (string) – Default return format (will be used if none else is specified in request)
  • connection_check_method (string) – Used by check_connection()
  • auth_type (string) – The authentification type. Obsolete.
  • base_url (string) – The base url for all api requests
  • send_json (bool) – Whether the request body should be encoded with json
auth_type = None
base_url = None
build_content(args)[source]
check_connection()[source]
check_response_success(response)[source]
connection_check_method = None
create_basic_auth(user, password)[source]

Creates the header content for HTTP Basic Authentification.

Parameters:
  • user – Username
  • password – Password
Return type:

Base64-encoded auth string

default_body_content = None
default_header_content = None
default_http_method = None
default_return_format = None
do(method, content=None, headers=None, http_method=None, return_format=None)[source]
do_request(http_method, url, headers, body, return_format)[source]
get_oauth()[source]
handle_response(response, return_format)[source]
http_methods = ['GET', 'POST', 'PUT', 'DELETE', 'OPTIONS']
parse_errors(response)[source]
return_formats = ['json']
send_json = False

Table Of Contents

Previous topic

5. tests Package

Next topic

3. scripts Package

This Page