MCPcopy
hub / github.com/RUB-NDS/PRET / http

Method http

capabilities.py:101–115  ·  view source on GitHub ↗
(self, host)

Source from the content-addressed store, hash-verified

99 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
100 # get capabilities via HTTP
101 def http(self, host):
102 try:
103 # poor man's way get http title
104 sys.stdout.write("Checking for HTTP support: ")
105 html = requests.get("http://" + host).text
106 # cause we are to parsimonious to import BeautifulSoup ;)
107 title = re.findall("<title.*?>\n?(.+?)\n?</title>",
108 html, re.I | re.M | re.S)
109 # get name of device
110 model = item(title)
111 # get language support
112 self.set_support(model)
113 output().green("found")
114 except Exception as e:
115 output().errmsg("not found", e)
116
117 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
118 # get capabilities via HTTPS

Callers 1

__init__Method · 0.95

Calls 7

set_supportMethod · 0.95
itemFunction · 0.90
outputClass · 0.90
greenMethod · 0.80
errmsgMethod · 0.80
writeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected