Package tlib :: Package base :: Module HttpRequestor :: Class HttpRequestor
[hide private]
[frames] | no frames]

Class HttpRequestor

source code

object --+
         |
        HttpRequestor

Note: This class is deprecated. New projects should use requests library instead

Helper class for sending requests of HTTP with GET and POST

Instance Methods [hide private]
 
__init__(*args, **kwargs)
Constructor for class
source code
 
make_path_params(*args, **kwargs)
Constucts a request with the parameters formated in path parameter format.
source code
 
make_query_params(*args, **kwargs)
Constucts a request with the parameters formated in query parameter format.
source code
 
make_get_request(*args, **kwargs)
Sends a GET HTTP request.
source code
 
make_post_request(*args, **kwargs)
Sends a POST HTTP request.
source code
 
get_auth(*args, **kwargs)
Creates the authentication for accessing HTTP
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  api_url = ''
domain url to use when sending requests
  api_method = ''
api method to use when sending requests
  api_params = ''
parameters to send to the method when sending requests
  api_header = {}
Authorization to put into header when sending requests
  api_post_payload = {}
Payload to be delivered when sending a POST request
  logger = None
logger to send loggin information to.
  api_path_params = ''
  formatted_params = ''
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(*args, **kwargs)
(Constructor)

source code 

Constructor for class

Parameters:
  • api_url (str) - URL to the base of the API
  • logger (Logger) - instance of a logging object configured in testing project
Decorators:
  • @deprecated
Overrides: object.__init__

make_path_params(*args, **kwargs)

source code 

Constucts a request with the parameters formated in path parameter format. EX: http://myserver.com/api/method/pathParam1/pathParam2

Parameters:
  • params (dict) - a list of parameter values to send to the api
Decorators:
  • @deprecated

make_query_params(*args, **kwargs)

source code 

Constucts a request with the parameters formated in query parameter format. EX: http://myserver.com/api/method?queryParam=paramValue

Parameters:
  • params (dict) - a dictionary of parameter names and values to send to the api
Decorators:
  • @deprecated

make_get_request(*args, **kwargs)

source code 

Sends a GET HTTP request. Make sure you have set the classe's api_params,api_url and api_method first

Args :null

Returns : (file-like object) the HTTP response

Raises :null

Decorators:
  • @deprecated

make_post_request(*args, **kwargs)

source code 

Sends a POST HTTP request. Make sure you have set the classe's api_params,api_url, api_header and api_method first

Returns : (file-like object) the HTTP response

Decorators:
  • @deprecated

get_auth(*args, **kwargs)

source code 

Creates the authentication for accessing HTTP

Parameters:
  • credentials (dict) - 'username' and 'password' keys for a dictionary containing the HTTP Basic Auth to access the api
Decorators:
  • @deprecated

Class Variable Details [hide private]

logger

logger to send loggin information to. Logger comes from pytest test definitions

Value:
None