Public Member Functions | |
def | __init__ (self) |
def | discardCookies (self) |
def | getCookies (self) |
def | getToken (self, username, password) |
def | query (self, url, data=None, files=None, keepCookies=True) |
def | setBaseUrl (self, baseUrl='') |
def | setProxy (self, proxy='') |
def | setRetries (self, retries=()) |
def | setTimeout (self, timeout=0) |
Public Attributes | |
baseUrl | |
curl | |
retries | |
token | |
Static Public Attributes | |
retryCodes = frozenset([502, 503]) | |
Class used for querying URLs using the HTTP protocol.
Definition at line 64 of file upload_popcon.py.
def upload_popcon.HTTP.__init__ | ( | self | ) |
Definition at line 70 of file upload_popcon.py.
References upload_popcon.HTTP.setBaseUrl(), and upload_popcon.HTTP.setRetries().
def upload_popcon.HTTP.discardCookies | ( | self | ) |
Discards cookies.
Definition at line 92 of file upload_popcon.py.
References upload_popcon.HTTP.curl.
Referenced by upload_popcon.HTTP.query(), and uploadConditions.HTTP.query().
def upload_popcon.HTTP.getCookies | ( | self | ) |
Returns the list of cookies.
Definition at line 87 of file upload_popcon.py.
References upload_popcon.HTTP.curl.
def upload_popcon.HTTP.getToken | ( | self, | |
username, | |||
password | |||
) |
Definition at line 132 of file upload_popcon.py.
References upload_popcon.HTTP.baseUrl, upload_popcon.HTTP.curl, str, and upload_popcon.HTTP.token.
Queries a URL, optionally with some data (dictionary). If no data is specified, a GET request will be used. If some data is specified, a POST request will be used. If files is specified, it must be a dictionary like data but the values are filenames. By default, cookies are kept in-between requests. A HTTPError exception is raised if the response's HTTP code is not 200.
Definition at line 175 of file upload_popcon.py.
References upload_popcon.HTTP.baseUrl, upload_popcon.HTTP.curl, upload_popcon.HTTP.discardCookies(), upload_popcon.HTTP.retries, upload_popcon.HTTP.retryCodes, str, and upload_popcon.HTTP.token.
Referenced by production_tasks.BaseDataset.run(), and edmIntegrityCheck.IntegrityCheck.test().
def upload_popcon.HTTP.setBaseUrl | ( | self, | |
baseUrl = '' |
|||
) |
Allows to set a base URL which will be prefixed to all the URLs that will be queried later.
Definition at line 98 of file upload_popcon.py.
References upload_popcon.HTTP.baseUrl.
Referenced by upload_popcon.HTTP.__init__(), and uploadConditions.HTTP.__init__().
def upload_popcon.HTTP.setProxy | ( | self, | |
proxy = '' |
|||
) |
Allows to set a proxy.
Definition at line 105 of file upload_popcon.py.
References upload_popcon.HTTP.curl.
def upload_popcon.HTTP.setRetries | ( | self, | |
retries = () |
|||
) |
Allows to set retries. The retries are a sequence of the seconds to wait per retry. The retries are done on: * PyCurl errors (includes network problems, e.g. not being able to connect to the host). * 502 Bad Gateway (for the moment, to avoid temporary Apache-CherryPy issues). * 503 Service Temporarily Unavailable (for when we update the frontends).
Definition at line 117 of file upload_popcon.py.
Referenced by upload_popcon.HTTP.__init__(), and uploadConditions.HTTP.__init__().
def upload_popcon.HTTP.setTimeout | ( | self, | |
timeout = 0 |
|||
) |
Allows to set a timeout.
Definition at line 111 of file upload_popcon.py.
References upload_popcon.HTTP.curl.
upload_popcon.HTTP.baseUrl |
Definition at line 83 of file upload_popcon.py.
Referenced by upload_popcon.HTTP.getToken(), uploadConditions.HTTP.getToken(), upload_popcon.HTTP.query(), uploadConditions.HTTP.query(), upload_popcon.HTTP.setBaseUrl(), and uploadConditions.HTTP.setBaseUrl().
upload_popcon.HTTP.curl |
Definition at line 74 of file upload_popcon.py.
Referenced by upload_popcon.HTTP.discardCookies(), uploadConditions.HTTP.discardCookies(), upload_popcon.HTTP.getCookies(), uploadConditions.HTTP.getCookies(), upload_popcon.HTTP.getToken(), uploadConditions.HTTP.getToken(), upload_popcon.HTTP.query(), uploadConditions.HTTP.query(), upload_popcon.HTTP.setProxy(), uploadConditions.HTTP.setProxy(), upload_popcon.HTTP.setTimeout(), and uploadConditions.HTTP.setTimeout().
upload_popcon.HTTP.retries |
Definition at line 130 of file upload_popcon.py.
Referenced by upload_popcon.HTTP.query(), and uploadConditions.HTTP.query().
|
static |
Definition at line 68 of file upload_popcon.py.
Referenced by upload_popcon.HTTP.query(), and uploadConditions.HTTP.query().
upload_popcon.HTTP.token |
Definition at line 85 of file upload_popcon.py.
Referenced by upload_popcon.HTTP.getToken(), uploadConditions.HTTP.getToken(), upload_popcon.HTTP.query(), uploadConditions.HTTP.query(), uploadConditions.ConditionsUploader.setHost(), uploadConditions.ConditionsUploader.signIn(), upload_popcon.ConditionsUploader.signOut(), and uploadConditions.ConditionsUploader.signOut().