MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / _client

Function _client

lib/utils/api.py:739–759  ·  view source on GitHub ↗
(url, options=None)

Source from the content-addressed store, hash-verified

737 logger.critical(errMsg)
738
739def _client(url, options=None):
740 logger.debug("Calling '%s'" % url)
741 try:
742 headers = {"Content-Type": "application/json"}
743
744 if options is not None:
745 data = getBytes(jsonize(options))
746 else:
747 data = None
748
749 if DataStore.username or DataStore.password:
750 headers["Authorization"] = "Basic %s" % encodeBase64("%s:%s" % (DataStore.username or "", DataStore.password or ""), binary=False)
751
752 req = _urllib.request.Request(url, data, headers)
753 response = _urllib.request.urlopen(req)
754 text = getText(response.read())
755 except:
756 if options:
757 logger.error("Failed to load and parse %s" % url)
758 raise
759 return text
760
761def client(host=RESTAPI_DEFAULT_ADDRESS, port=RESTAPI_DEFAULT_PORT, username=None, password=None):
762 """

Callers 1

clientFunction · 0.85

Calls 7

getBytesFunction · 0.90
jsonizeFunction · 0.90
encodeBase64Function · 0.90
getTextFunction · 0.90
debugMethod · 0.80
readMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…