~nhanb/gae-proxy

a459ec0edde953307111993cbd6292b73257df86 — Bùi Thành Nhân 2 years ago 31bc73d
experiment with timings
1 files changed, 21 insertions(+), 18 deletions(-)

M send.py
M send.py => send.py +21 -18
@@ 1,4 1,5 @@
import os
from datetime import datetime as dt

import requests



@@ 8,22 9,24 @@ Lazy quick test script

PASSWORD = os.environ["GAEPROXY_PASSWORD"]

while True:
    start = dt.now()
    resp = requests.post(
        "https://nhansproxy.df.r.appspot.com/proxy",
        json={
            "url": "https://httpbin.org/ip",
            "method": "get",
            "body": None,
            "headers": {"Foo-Bar": "ehhhh"},
            "password": PASSWORD,
        },
    )

resp = requests.post(
    "https://nhansproxy.df.r.appspot.com/proxy",
    json={
        "url": "https://httpbin.org/ip",
        "method": "get",
        "body": None,
        "headers": {"Foo-Bar": "ehhhh"},
        "password": PASSWORD,
    },
)

"""
print(resp.status_code)
for hkey, hval in resp.headers.items():
    print(hkey, ":", hval)
"""

print(resp.text)
    """
    print(resp.status_code)
    for hkey, hval in resp.headers.items():
        print(hkey, ":", hval)
    """
    end = dt.now()
    print(resp.status_code)
    print((end - start).total_seconds())