Python httplib.request() Examples
The following are 30
code examples of httplib.request().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
httplib
, or try the search function
.
Example #1
Source File: binding.py From splunk-ref-pas-code with Apache License 2.0 | 6 votes |
def get(self, url, headers=None, **kwargs): """Sends a GET request to a URL. :param url: The URL. :type url: ``string`` :param headers: A list of pairs specifying the headers for the HTTP response (for example, ``[('Content-Type': 'text/cthulhu'), ('Token': 'boris')]``). :type headers: ``list`` :param kwargs: Additional keyword arguments (optional). These arguments are interpreted as the query part of the URL. The order of keyword arguments is not preserved in the request, but the keywords and their arguments will be URL encoded. :type kwargs: ``dict`` :returns: A dictionary describing the response (see :class:`HttpLib` for its structure). :rtype: ``dict`` """ if headers is None: headers = [] if kwargs: # url is already a UrlEncoded. We have to manually declare # the query to be encoded or it will get automatically URL # encoded by being appended to url. url = url + UrlEncoded('?' + _encode(**kwargs), skip_encode=True) return self.request(url, { 'method': "GET", 'headers': headers })
Example #2
Source File: binding.py From SplunkForPCAP with MIT License | 6 votes |
def get(self, url, headers=None, **kwargs): """Sends a GET request to a URL. :param url: The URL. :type url: ``string`` :param headers: A list of pairs specifying the headers for the HTTP response (for example, ``[('Content-Type': 'text/cthulhu'), ('Token': 'boris')]``). :type headers: ``list`` :param kwargs: Additional keyword arguments (optional). These arguments are interpreted as the query part of the URL. The order of keyword arguments is not preserved in the request, but the keywords and their arguments will be URL encoded. :type kwargs: ``dict`` :returns: A dictionary describing the response (see :class:`HttpLib` for its structure). :rtype: ``dict`` """ if headers is None: headers = [] if kwargs: # url is already a UrlEncoded. We have to manually declare # the query to be encoded or it will get automatically URL # encoded by being appended to url. url = url + UrlEncoded('?' + _encode(**kwargs), skip_encode=True) return self.request(url, { 'method': "GET", 'headers': headers })
Example #3
Source File: binding.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 6 votes |
def get(self, url, headers=None, **kwargs): """Sends a GET request to a URL. :param url: The URL. :type url: ``string`` :param headers: A list of pairs specifying the headers for the HTTP response (for example, ``[('Content-Type': 'text/cthulhu'), ('Token': 'boris')]``). :type headers: ``list`` :param kwargs: Additional keyword arguments (optional). These arguments are interpreted as the query part of the URL. The order of keyword arguments is not preserved in the request, but the keywords and their arguments will be URL encoded. :type kwargs: ``dict`` :returns: A dictionary describing the response (see :class:`HttpLib` for its structure). :rtype: ``dict`` """ if headers is None: headers = [] if kwargs: # url is already a UrlEncoded. We have to manually declare # the query to be encoded or it will get automatically URL # encoded by being appended to url. url = url + UrlEncoded('?' + _encode(**kwargs), skip_encode=True) return self.request(url, { 'method': "GET", 'headers': headers })
Example #4
Source File: binding.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 6 votes |
def _auth_headers(self): """Headers required to authenticate a request. Assumes your ``Context`` already has a authentication token or cookie, either provided explicitly or obtained by logging into the Splunk instance. :returns: A list of 2-tuples containing key and value """ if self.has_cookies(): return [("Cookie", _make_cookie_header(self.get_cookies().items()))] elif self.basic and (self.username and self.password): token = 'Basic %s' % b64encode("%s:%s" % (self.username, self.password)) return [("Authorization", token)] elif self.token is _NoAuthenticationToken: return [] else: # Ensure the token is properly formatted if self.token.startswith('Splunk '): token = self.token else: token = 'Splunk %s' % self.token return [("Authorization", token)]
Example #5
Source File: binding.py From splunk-ref-pas-code with Apache License 2.0 | 6 votes |
def _handle_auth_error(msg): """Handle reraising HTTP authentication errors as something clearer. If an ``HTTPError`` is raised with status 401 (access denied) in the body of this context manager, reraise it as an ``AuthenticationError`` instead, with *msg* as its message. This function adds no round trips to the server. :param msg: The message to be raised in ``AuthenticationError``. :type msg: ``str`` **Example**:: with _handle_auth_error("Your login failed."): ... # make an HTTP request """ try: yield except HTTPError as he: if he.status == 401: raise AuthenticationError(msg, he) else: raise
Example #6
Source File: binding.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 6 votes |
def _handle_auth_error(msg): """Handle reraising HTTP authentication errors as something clearer. If an ``HTTPError`` is raised with status 401 (access denied) in the body of this context manager, reraise it as an ``AuthenticationError`` instead, with *msg* as its message. This function adds no round trips to the server. :param msg: The message to be raised in ``AuthenticationError``. :type msg: ``str`` **Example**:: with _handle_auth_error("Your login failed."): ... # make an HTTP request """ try: yield except HTTPError as he: if he.status == 401: raise AuthenticationError(msg, he) else: raise
Example #7
Source File: binding.py From splunk-ref-pas-code with Apache License 2.0 | 6 votes |
def _auth_headers(self): """Headers required to authenticate a request. Assumes your ``Context`` already has a authentication token, either provided explicitly or obtained by logging into the Splunk instance. :returns: A list of 2-tuples containing key and value """ if self.token is _NoAuthenticationToken: return [] else: # Ensure the token is properly formatted if self.token.startswith('Splunk '): token = self.token else: token = 'Splunk %s' % self.token return [("Authorization", token)]
Example #8
Source File: binding.py From SplunkForPCAP with MIT License | 6 votes |
def _auth_headers(self): """Headers required to authenticate a request. Assumes your ``Context`` already has a authentication token or cookie, either provided explicitly or obtained by logging into the Splunk instance. :returns: A list of 2-tuples containing key and value """ if self.has_cookies(): return [("Cookie", _make_cookie_header(self.get_cookies().items()))] elif self.token is _NoAuthenticationToken: return [] else: # Ensure the token is properly formatted if self.token.startswith('Splunk '): token = self.token else: token = 'Splunk %s' % self.token return [("Authorization", token)]
Example #9
Source File: binding.py From SplunkForPCAP with MIT License | 6 votes |
def _handle_auth_error(msg): """Handle reraising HTTP authentication errors as something clearer. If an ``HTTPError`` is raised with status 401 (access denied) in the body of this context manager, reraise it as an ``AuthenticationError`` instead, with *msg* as its message. This function adds no round trips to the server. :param msg: The message to be raised in ``AuthenticationError``. :type msg: ``str`` **Example**:: with _handle_auth_error("Your login failed."): ... # make an HTTP request """ try: yield except HTTPError as he: if he.status == 401: raise AuthenticationError(msg, he) else: raise
Example #10
Source File: binding.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 6 votes |
def _auth_headers(self): """Headers required to authenticate a request. Assumes your ``Context`` already has a authentication token or cookie, either provided explicitly or obtained by logging into the Splunk instance. :returns: A list of 2-tuples containing key and value """ if self.has_cookies(): return [("Cookie", _make_cookie_header(self.get_cookies().items()))] elif self.basic and (self.username and self.password): token = 'Basic %s' % b64encode("%s:%s" % (self.username, self.password)) return [("Authorization", token)] elif self.token is _NoAuthenticationToken: return [] else: # Ensure the token is properly formatted if self.token.startswith('Splunk '): token = self.token else: token = 'Splunk %s' % self.token return [("Authorization", token)]
Example #11
Source File: binding.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 6 votes |
def get(self, url, headers=None, **kwargs): """Sends a GET request to a URL. :param url: The URL. :type url: ``string`` :param headers: A list of pairs specifying the headers for the HTTP response (for example, ``[('Content-Type': 'text/cthulhu'), ('Token': 'boris')]``). :type headers: ``list`` :param kwargs: Additional keyword arguments (optional). These arguments are interpreted as the query part of the URL. The order of keyword arguments is not preserved in the request, but the keywords and their arguments will be URL encoded. :type kwargs: ``dict`` :returns: A dictionary describing the response (see :class:`HttpLib` for its structure). :rtype: ``dict`` """ if headers is None: headers = [] if kwargs: # url is already a UrlEncoded. We have to manually declare # the query to be encoded or it will get automatically URL # encoded by being appended to url. url = url + UrlEncoded('?' + _encode(**kwargs), skip_encode=True) return self.request(url, { 'method': "GET", 'headers': headers })
Example #12
Source File: binding.py From splunk-ref-pas-code with Apache License 2.0 | 6 votes |
def request(self, url, message, **kwargs): """Issues an HTTP request to a URL. :param url: The URL. :type url: ``string`` :param message: A dictionary with the format as described in :class:`HttpLib`. :type message: ``dict`` :param kwargs: Additional keyword arguments (optional). These arguments are passed unchanged to the handler. :type kwargs: ``dict`` :returns: A dictionary describing the response (see :class:`HttpLib` for its structure). :rtype: ``dict`` """ response = self.handler(url, message, **kwargs) response = record(response) if 400 <= response.status: raise HTTPError(response) return response # Converts an httplib response into a file-like object.
Example #13
Source File: binding.py From SA-ctf_scoreboard_admin with Creative Commons Zero v1.0 Universal | 6 votes |
def _handle_auth_error(msg): """Handle reraising HTTP authentication errors as something clearer. If an ``HTTPError`` is raised with status 401 (access denied) in the body of this context manager, reraise it as an ``AuthenticationError`` instead, with *msg* as its message. This function adds no round trips to the server. :param msg: The message to be raised in ``AuthenticationError``. :type msg: ``str`` **Example**:: with _handle_auth_error("Your login failed."): ... # make an HTTP request """ try: yield except HTTPError as he: if he.status == 401: raise AuthenticationError(msg, he) else: raise
Example #14
Source File: binding.py From SA-ctf_scoreboard_admin with Creative Commons Zero v1.0 Universal | 6 votes |
def _auth_headers(self): """Headers required to authenticate a request. Assumes your ``Context`` already has a authentication token or cookie, either provided explicitly or obtained by logging into the Splunk instance. :returns: A list of 2-tuples containing key and value """ if self.has_cookies(): return [("Cookie", _make_cookie_header(self.get_cookies().items()))] elif self.basic and (self.username and self.password): token = 'Basic %s' % b64encode("%s:%s" % (self.username, self.password)) return [("Authorization", token)] elif self.token is _NoAuthenticationToken: return [] else: # Ensure the token is properly formatted if self.token.startswith('Splunk '): token = self.token else: token = 'Splunk %s' % self.token return [("Authorization", token)]
Example #15
Source File: binding.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 6 votes |
def _handle_auth_error(msg): """Handle reraising HTTP authentication errors as something clearer. If an ``HTTPError`` is raised with status 401 (access denied) in the body of this context manager, reraise it as an ``AuthenticationError`` instead, with *msg* as its message. This function adds no round trips to the server. :param msg: The message to be raised in ``AuthenticationError``. :type msg: ``str`` **Example**:: with _handle_auth_error("Your login failed."): ... # make an HTTP request """ try: yield except HTTPError as he: if he.status == 401: raise AuthenticationError(msg, he) else: raise
Example #16
Source File: binding.py From SA-ctf_scoreboard_admin with Creative Commons Zero v1.0 Universal | 6 votes |
def get(self, url, headers=None, **kwargs): """Sends a GET request to a URL. :param url: The URL. :type url: ``string`` :param headers: A list of pairs specifying the headers for the HTTP response (for example, ``[('Content-Type': 'text/cthulhu'), ('Token': 'boris')]``). :type headers: ``list`` :param kwargs: Additional keyword arguments (optional). These arguments are interpreted as the query part of the URL. The order of keyword arguments is not preserved in the request, but the keywords and their arguments will be URL encoded. :type kwargs: ``dict`` :returns: A dictionary describing the response (see :class:`HttpLib` for its structure). :rtype: ``dict`` """ if headers is None: headers = [] if kwargs: # url is already a UrlEncoded. We have to manually declare # the query to be encoded or it will get automatically URL # encoded by being appended to url. url = url + UrlEncoded('?' + _encode(**kwargs), skip_encode=True) return self.request(url, { 'method': "GET", 'headers': headers })
Example #17
Source File: binding.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 6 votes |
def get(self, url, headers=None, **kwargs): """Sends a GET request to a URL. :param url: The URL. :type url: ``string`` :param headers: A list of pairs specifying the headers for the HTTP response (for example, ``[('Content-Type': 'text/cthulhu'), ('Token': 'boris')]``). :type headers: ``list`` :param kwargs: Additional keyword arguments (optional). These arguments are interpreted as the query part of the URL. The order of keyword arguments is not preserved in the request, but the keywords and their arguments will be URL encoded. :type kwargs: ``dict`` :returns: A dictionary describing the response (see :class:`HttpLib` for its structure). :rtype: ``dict`` """ if headers is None: headers = [] if kwargs: # url is already a UrlEncoded. We have to manually declare # the query to be encoded or it will get automatically URL # encoded by being appended to url. url = url + UrlEncoded('?' + _encode(**kwargs), skip_encode=True) return self.request(url, { 'method': "GET", 'headers': headers })
Example #18
Source File: binding.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 6 votes |
def _auth_headers(self): """Headers required to authenticate a request. Assumes your ``Context`` already has a authentication token or cookie, either provided explicitly or obtained by logging into the Splunk instance. :returns: A list of 2-tuples containing key and value """ if self.has_cookies(): return [("Cookie", _make_cookie_header(self.get_cookies().items()))] elif self.basic and (self.username and self.password): token = 'Basic %s' % b64encode("%s:%s" % (self.username, self.password)) return [("Authorization", token)] elif self.token is _NoAuthenticationToken: return [] else: # Ensure the token is properly formatted if self.token.startswith('Splunk '): token = self.token else: token = 'Splunk %s' % self.token return [("Authorization", token)]
Example #19
Source File: binding.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 6 votes |
def _handle_auth_error(msg): """Handle reraising HTTP authentication errors as something clearer. If an ``HTTPError`` is raised with status 401 (access denied) in the body of this context manager, reraise it as an ``AuthenticationError`` instead, with *msg* as its message. This function adds no round trips to the server. :param msg: The message to be raised in ``AuthenticationError``. :type msg: ``str`` **Example**:: with _handle_auth_error("Your login failed."): ... # make an HTTP request """ try: yield except HTTPError as he: if he.status == 401: raise AuthenticationError(msg, he) else: raise
Example #20
Source File: binding.py From splunk-elasticsearch with Apache License 2.0 | 6 votes |
def _handle_auth_error(msg): """Handle reraising HTTP authentication errors as something clearer. If an ``HTTPError`` is raised with status 401 (access denied) in the body of this context manager, reraise it as an ``AuthenticationError`` instead, with *msg* as its message. This function adds no round trips to the server. :param msg: The message to be raised in ``AuthenticationError``. :type msg: ``str`` **Example**:: with _handle_auth_error("Your login failed."): ... # make an HTTP request """ try: yield except HTTPError as he: if he.status == 401: raise AuthenticationError(msg, he) else: raise
Example #21
Source File: binding.py From splunk-elasticsearch with Apache License 2.0 | 6 votes |
def _auth_headers(self): """Headers required to authenticate a request. Assumes your ``Context`` already has a authentication token, either provided explicitly or obtained by logging into the Splunk instance. :returns: A list of 2-tuples containing key and value """ if self.token is _NoAuthenticationToken: return [] else: # Ensure the token is properly formatted if self.token.startswith('Splunk '): token = self.token else: token = 'Splunk %s' % self.token return [("Authorization", token)]
Example #22
Source File: binding.py From splunk-elasticsearch with Apache License 2.0 | 6 votes |
def request(self, url, message, **kwargs): """Issues an HTTP request to a URL. :param url: The URL. :type url: ``string`` :param message: A dictionary with the format as described in :class:`HttpLib`. :type message: ``dict`` :param kwargs: Additional keyword arguments (optional). These arguments are passed unchanged to the handler. :type kwargs: ``dict`` :returns: A dictionary describing the response (see :class:`HttpLib` for its structure). :rtype: ``dict`` """ response = self.handler(url, message, **kwargs) response = record(response) if 400 <= response.status: raise HTTPError(response) return response # Converts an httplib response into a file-like object.
Example #23
Source File: binding.py From splunk-elasticsearch with Apache License 2.0 | 6 votes |
def get(self, url, headers=None, **kwargs): """Sends a GET request to a URL. :param url: The URL. :type url: ``string`` :param headers: A list of pairs specifying the headers for the HTTP response (for example, ``[('Content-Type': 'text/cthulhu'), ('Token': 'boris')]``). :type headers: ``list`` :param kwargs: Additional keyword arguments (optional). These arguments are interpreted as the query part of the URL. The order of keyword arguments is not preserved in the request, but the keywords and their arguments will be URL encoded. :type kwargs: ``dict`` :returns: A dictionary describing the response (see :class:`HttpLib` for its structure). :rtype: ``dict`` """ if headers is None: headers = [] if kwargs: # url is already a UrlEncoded. We have to manually declare # the query to be encoded or it will get automatically URL # encoded by being appended to url. url = url + UrlEncoded('?' + _encode(**kwargs), skip_encode=True) return self.request(url, { 'method': "GET", 'headers': headers })
Example #24
Source File: binding.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 5 votes |
def post(self, url, headers=None, **kwargs): """Sends a POST request to a URL. :param url: The URL. :type url: ``string`` :param headers: A list of pairs specifying the headers for the HTTP response (for example, ``[('Content-Type': 'text/cthulhu'), ('Token': 'boris')]``). :type headers: ``list`` :param kwargs: Additional keyword arguments (optional). If the argument is ``body``, the value is used as the body for the request, and the keywords and their arguments will be URL encoded. If there is no ``body`` keyword argument, all the keyword arguments are encoded into the body of the request in the format ``x-www-form-urlencoded``. :type kwargs: ``dict`` :returns: A dictionary describing the response (see :class:`HttpLib` for its structure). :rtype: ``dict`` """ if headers is None: headers = [] # We handle GET-style arguments and an unstructured body. This is here # to support the receivers/stream endpoint. if 'body' in kwargs: # We only use application/x-www-form-urlencoded if there is no other # Content-Type header present. This can happen in cases where we # send requests as application/json, e.g. for KV Store. if len(filter(lambda x: x[0].lower() == "content-type", headers)) == 0: headers.append(("Content-Type", "application/x-www-form-urlencoded")) body = kwargs.pop('body') if len(kwargs) > 0: url = url + UrlEncoded('?' + _encode(**kwargs), skip_encode=True) else: body = _encode(**kwargs) message = { 'method': "POST", 'headers': headers, 'body': body } return self.request(url, message)
Example #25
Source File: binding.py From splunk-elasticsearch with Apache License 2.0 | 5 votes |
def post(self, url, headers=None, **kwargs): """Sends a POST request to a URL. :param url: The URL. :type url: ``string`` :param headers: A list of pairs specifying the headers for the HTTP response (for example, ``[('Content-Type': 'text/cthulhu'), ('Token': 'boris')]``). :type headers: ``list`` :param kwargs: Additional keyword arguments (optional). If the argument is ``body``, the value is used as the body for the request, and the keywords and their arguments will be URL encoded. If there is no ``body`` keyword argument, all the keyword arguments are encoded into the body of the request in the format ``x-www-form-urlencoded``. :type kwargs: ``dict`` :returns: A dictionary describing the response (see :class:`HttpLib` for its structure). :rtype: ``dict`` """ if headers is None: headers = [] headers.append(("Content-Type", "application/x-www-form-urlencoded")), # We handle GET-style arguments and an unstructured body. This is here # to support the receivers/stream endpoint. if 'body' in kwargs: body = kwargs.pop('body') if len(kwargs) > 0: url = url + UrlEncoded('?' + _encode(**kwargs), skip_encode=True) else: body = _encode(**kwargs) message = { 'method': "POST", 'headers': headers, 'body': body } return self.request(url, message)
Example #26
Source File: _form.py From BruteXSS with GNU General Public License v3.0 | 5 votes |
def click(self, name=None, type=None, id=None, nr=0, coord=(1,1), request_class=_request.Request, label=None): """Return request that would result from clicking on a control. The request object is a mechanize.Request instance, which you can pass to mechanize.urlopen. Only some control types (INPUT/SUBMIT & BUTTON/SUBMIT buttons and IMAGEs) can be clicked. Will click on the first clickable control, subject to the name, type and nr arguments (as for find_control). If no name, type, id or number is specified and there are no clickable controls, a request will be returned for the form in its current, un-clicked, state. IndexError is raised if any of name, type, id or nr is specified but no matching control is found. ValueError is raised if the HTMLForm has an enctype attribute that is not recognised. You can optionally specify a coordinate to click at, which only makes a difference if you clicked on an image. """ return self._click(name, type, id, label, nr, coord, "request", self._request_class)
Example #27
Source File: clientform.py From POC-EXP with GNU General Public License v3.0 | 5 votes |
def click_request_data(self, name=None, type=None, id=None, nr=0, coord=(1,1), request_class=urllib2.Request, label=None): """As for click method, but return a tuple (url, data, headers). You can use this data to send a request to the server. This is useful if you're using httplib or urllib rather than urllib2. Otherwise, use the click method. # Untested. Have to subclass to add headers, I think -- so use urllib2 # instead! import urllib url, data, hdrs = form.click_request_data() r = urllib.urlopen(url, data) # Untested. I don't know of any reason to use httplib -- you can get # just as much control with urllib2. import httplib, urlparse url, data, hdrs = form.click_request_data() tup = urlparse(url) host, path = tup[1], urlparse.urlunparse((None, None)+tup[2:]) conn = httplib.HTTPConnection(host) if data: httplib.request("POST", path, data, hdrs) else: httplib.request("GET", path, headers=hdrs) r = conn.getresponse() """ return self._click(name, type, id, label, nr, coord, "request_data", self._request_class)
Example #28
Source File: binding.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 5 votes |
def delete(self, url, headers=None, **kwargs): """Sends a DELETE request to a URL. :param url: The URL. :type url: ``string`` :param headers: A list of pairs specifying the headers for the HTTP response (for example, ``[('Content-Type': 'text/cthulhu'), ('Token': 'boris')]``). :type headers: ``list`` :param kwargs: Additional keyword arguments (optional). These arguments are interpreted as the query part of the URL. The order of keyword arguments is not preserved in the request, but the keywords and their arguments will be URL encoded. :type kwargs: ``dict`` :returns: A dictionary describing the response (see :class:`HttpLib` for its structure). :rtype: ``dict`` """ if headers is None: headers = [] if kwargs: # url is already a UrlEncoded. We have to manually declare # the query to be encoded or it will get automatically URL # encoded by being appended to url. url = url + UrlEncoded('?' + _encode(**kwargs), skip_encode=True) message = { 'method': "DELETE", 'headers': headers, } return self.request(url, message)
Example #29
Source File: binding.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 5 votes |
def delete(self, url, headers=None, **kwargs): """Sends a DELETE request to a URL. :param url: The URL. :type url: ``string`` :param headers: A list of pairs specifying the headers for the HTTP response (for example, ``[('Content-Type': 'text/cthulhu'), ('Token': 'boris')]``). :type headers: ``list`` :param kwargs: Additional keyword arguments (optional). These arguments are interpreted as the query part of the URL. The order of keyword arguments is not preserved in the request, but the keywords and their arguments will be URL encoded. :type kwargs: ``dict`` :returns: A dictionary describing the response (see :class:`HttpLib` for its structure). :rtype: ``dict`` """ if headers is None: headers = [] if kwargs: # url is already a UrlEncoded. We have to manually declare # the query to be encoded or it will get automatically URL # encoded by being appended to url. url = url + UrlEncoded('?' + _encode(**kwargs), skip_encode=True) message = { 'method': "DELETE", 'headers': headers, } return self.request(url, message)
Example #30
Source File: binding.py From SA-ctf_scoreboard with Creative Commons Zero v1.0 Universal | 5 votes |
def has_cookies(self): """Returns true if the ``HttpLib`` member of this instance has at least one cookie stored. :return: ``True`` if there is at least one cookie, else ``False`` :rtype: ``bool`` """ return len(self.get_cookies()) > 0 # Shared per-context request headers