Package pulp :: Package server :: Package webservices :: Module http
[hide private]
[frames] | no frames]

Module http

source code

HTTP utilities to help pulp web services with HTTP using the web.py framework

Functions [hide private]
 
query_parameters(valid)
Returns: dict of param: [value(s)] of uri query parameters
source code
 
http_authorization()
Return the current http authorization credentials, if any
source code
 
uri_path()
Return the current URI path
source code
 
extend_uri_path(suffix)
Return the current URI path with the suffix appended to it
source code
 
header(hdr, value, unique=True)
Adds 'hdr: value' to the response.
source code
 
_status(code)
Non-public function to set the web ctx status
source code
 
status_ok()
Set response code to ok
source code
 
status_created()
Set response code to created
source code
 
status_no_content()
Set response code to no content
source code
 
status_accepted()
Set response code to accepted
source code
 
status_bad_request()
Set the response code to bad request
source code
 
status_unauthorized()
Set response code to unauthorized
source code
 
status_not_found()
Set response code to not found
source code
 
status_method_not_allowed()
Set response code to method not allowed
source code
 
status_not_acceptable()
Set response code to not acceptable
source code
 
status_conflict()
Set response code to conflict
source code
 
status_internal_server_error()
Set the resonse code to internal server error
source code
Function Details [hide private]

query_parameters(valid)

source code 
Parameters:
  • valid (list of str's) - list of expected query parameters
Returns:
dict of param: [value(s)] of uri query parameters

http_authorization()

source code 

Return the current http authorization credentials, if any

Returns:
str representing the http authorization credentials if found, None otherwise

uri_path()

source code 

Return the current URI path

Returns:
full current URI path

extend_uri_path(suffix)

source code 

Return the current URI path with the suffix appended to it

Parameters:
  • suffix (str) - path fragment to be appended to the current path
Returns:
full path with the suffix appended

header(hdr, value, unique=True)

source code 

Adds 'hdr: value' to the response. This function has, in some regards, the opposite semantics of the web.header function. If unique is True, the hdr will be overwritten if it already exists in the response. Otherwise it will be appended.

Parameters:
  • hdr (str) - valid http header key
  • value (str) - valid value for corresponding header key
  • unique (bool) - whether only one instance of the header is in the response

_status(code)

source code 

Non-public function to set the web ctx status

Parameters:
  • code (int) - http response code