Exemplo n.º 1
0
def get_server_info(url, method, headers):
    info = {}
    res = request(url, "HEAD", headers=headers)
    server = res["headers"].get("server", "Unknown")
    info["software"] = server
    if headers:
        info["headers"] = dict(headers)
    return info
Exemplo n.º 2
0
def print_server_info(url, method, headers=None, stream=sys.stdout):
    stream.write("-------- Server info --------\n\n")
    res = request(url, "HEAD", headers=headers)
    server = res["headers"].get("server", "Unknown")
    stream.write(f"Server Software: {server}\n")
    if headers:
        for k, v in headers.items():
            stream.write(f"{k}: {v}\n")
    stream.write("\n")
    stream.flush()
Exemplo n.º 3
0
 def something_sync(args):
     grab = request("http://localhost:8888")
     self.assertEqual(grab["status"], 200)
     grab_json = json_request("http://localhost:8888/molotov.json")
     self.assertTrue("molotov" in grab_json["content"])
Exemplo n.º 4
0
 def something_sync(args):
     grab = request('http://localhost:8888')
     self.assertEqual(grab['status'], 200)
     grab_json = json_request('http://localhost:8888/molotov.json')
     self.assertTrue('molotov' in grab_json['content'])
Exemplo n.º 5
0
 async def _setup_session(wid, session):
     with coserver():
         html = str(request("http://localhost:8888"))
         content.append(html)
Exemplo n.º 6
0
 def something_sync(args):
     grab = request('http://localhost:8888')
     self.assertEqual(grab['status'], 200)
     grab_json = json_request('http://localhost:8888/molotov.json')
     self.assertTrue('molotov' in grab_json['content'])