Package buildxml :: Package xmlgetter :: Module request :: Class BaseRequester
[hide private]
[frames] | no frames]

Class BaseRequester

source code


Base class that adds the function _requestURL for requesting a URL over the HTTP protocol. It uses urllib2 and httplib to do so.

Instance Methods [hide private]
 
__init__(self, source_name)
Initialize the instance.
source code
 
_requestURL(self, url, data=None, headers={u'User-Agent': USER_AGENT})
Queries the given URL with the given HTTP headers and optional data.
source code

Inherited from log.BaseLogger: logger

Inherited from log.BaseLogger (private): _getLogger

Class Variables [hide private]

Inherited from log.BaseLogger (private): _loggers

Instance Variables [hide private]

Inherited from log.BaseLogger (private): _source_name

Method Details [hide private]

__init__(self, source_name)
(Constructor)

source code 

Initialize the instance.

Parameters:
Overrides: log.BaseLogger.__init__

_requestURL(self, url, data=None, headers={u'User-Agent': USER_AGENT})

source code 

Queries the given URL with the given HTTP headers and optional data.

If data is not None, the request method will be PUT, GET otherwise.

If exceptions are thrown, they will be logged and the function returns None. Otherwise the servers response is returned.

Parameters:
  • url (string) - The URL to be requested from the server.
  • data (dict or sequence of two-element tuples) - Optional data to be sent to the server.
  • headers (dict) - Optional headers to be sent with the request. Defaults to User-Agent: USER_AGENT .