Public Member Functions | |
def | __init__ |
def | addCERNSSOCookies |
def | discardCookies |
def | getCookies |
def | query |
def | setBaseUrl |
def | setProxy |
def | setRetries |
def | setTimeout |
Public Attributes | |
baseUrl | |
curl | |
retries | |
Static Public Attributes | |
tuple | retryCodes = frozenset([502, 503]) |
Class used for querying URLs using the HTTP protocol.
Definition at line 225 of file upload_popcon.py.
def upload_popcon.HTTP.__init__ | ( | self | ) |
Definition at line 232 of file upload_popcon.py.
References upload_popcon.HTTP.setBaseUrl(), and upload_popcon.HTTP.setRetries().
Adds the required CERN SSO cookies for a URL using Kerberos. After calling this, you can use query() for your SSO-protected URLs. This method will use your Kerberos ticket to sign in automatically in CERN SSO (i.e. no password required). If you do not have a ticket yet, use kinit. If you wish to make secure SSL connections to the CERN SSO (i.e. verify peers/hosts), you may need to install the CERN-CA-certs package. Use secure == False to skip this (i.e. this is the same as curl -k/--insecure). Not recommended: tell users to install them or use lxplus6. The same way, if you have a self-signed certificate in your target URL you can use secureTarget == False as well. Note that this option is provided in order to be able to use a secure SSL connection to CERN SSO, even if the connection to your target URL is not secure. Note that you will probably need the CERN-CA-certs package after you get a certificate signed by the CERN CA (https://cern.ch/ca), even if you did not need it for the CERN SSO. Note that this method *does* a query to the given URL if successful. Note that you may need different cookies for different URLs/applications. Note that this method may raise also CERNSSOError exceptions.
Definition at line 367 of file upload_popcon.py.
References upload_popcon._getCERNSSOCookies(), and upload_popcon.HTTP.baseUrl.
def upload_popcon.HTTP.discardCookies | ( | self | ) |
Discards cookies.
Definition at line 249 of file upload_popcon.py.
Referenced by upload_popcon.HTTP.query(), and uploadConditions.HTTP.query().
def upload_popcon.HTTP.getCookies | ( | self | ) |
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 295 of file upload_popcon.py.
References upload_popcon.HTTP.baseUrl, upload_popcon.HTTP.discardCookies(), list(), upload_popcon.HTTP.retries, and upload_popcon.HTTP.retryCodes.
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 256 of file upload_popcon.py.
Referenced by uploadConditions.HTTP.__init__(), and upload_popcon.HTTP.__init__().
def upload_popcon.HTTP.setProxy | ( | self, | |
proxy = '' |
|||
) |
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 278 of file upload_popcon.py.
Referenced by uploadConditions.HTTP.__init__(), and upload_popcon.HTTP.__init__().
def upload_popcon.HTTP.setTimeout | ( | self, | |
timeout = 0 |
|||
) |
upload_popcon.HTTP.baseUrl |
Definition at line 261 of file upload_popcon.py.
Referenced by upload_popcon.HTTP.addCERNSSOCookies(), uploadConditions.HTTP.getToken(), upload_popcon.HTTP.query(), uploadConditions.HTTP.query(), and uploadConditions.HTTP.setBaseUrl().
upload_popcon.HTTP.curl |
Definition at line 236 of file upload_popcon.py.
upload_popcon.HTTP.retries |
Definition at line 292 of file upload_popcon.py.
Referenced by upload_popcon.HTTP.query(), and uploadConditions.HTTP.query().
|
static |
Definition at line 229 of file upload_popcon.py.
Referenced by upload_popcon.HTTP.query(), and uploadConditions.HTTP.query().