Exemple #1
0
def req():
    client = HttpClient()
    try:
        resp = yield client.request('http://www.google.com/')
        print resp.code, resp.body
    finally:
        eventloop.halt()
Exemple #2
0
def req():
    client = HttpClient()
    try:
        yield client.connect("www.google.com", 80)
        resp = yield client.request('/')
        print resp.code, repr(resp.body)
        resp = yield client.request('http://www.google.com/')
        print resp.code, repr(resp.body)
        client.close()
        yield client.connect("localhost", 80)
        resp = yield client.request('/')
        print resp.code, repr(resp.body)
        resp = yield client.request('http://localhost/')
        print resp.code, repr(resp.body)
    finally:
        eventloop.halt()
Exemple #3
0
def req():
    client = HttpClient()
    try:
        yield client.connect("www.google.com", 80)
        resp = yield client.request('/')
        print resp.code, repr(resp.body)
        resp = yield client.request('http://www.google.com/')
        print resp.code, repr(resp.body)
        client.close()
        yield client.connect("localhost", 80)
        resp = yield client.request('/')
        print resp.code, repr(resp.body)
        resp = yield client.request('http://localhost/')
        print resp.code, repr(resp.body)
    finally:
        eventloop.halt()
Exemple #4
0
def example():
    client = HttpClient()
    yield client.connect("www.google.com", 443, "https")
    print("connected")
    resp = yield client.request('/')
    print("response code -> %s" % resp.code)
    print("page length -> %s" % len(repr(resp.body)))
    client.close()
Exemple #5
0
def req():
    client = HttpClient()
    yield client.connect("localhost", 12344, timeout=1)
Exemple #6
0
def main():
    c = HttpClient()
    yield c.connect('google.com', 443, scheme='https')
    resp = yield c.request('/')
    print(resp.body)
    c.close()
Exemple #7
0
def req():
    client = HttpClient()
    yield client.connect("localhost", 12344, timeout=1)