diff options
author | Ben Sima <ben@bsima.me> | 2020-04-07 15:08:54 -0700 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-04-07 15:08:54 -0700 |
commit | 8edc5c72a76ac227cac97bb39a15b194f618cc1c (patch) | |
tree | 737b421aa9166035f04902306bb2fa2aeebf3acc /Run | |
parent | e52018857e47862f8b1c2cc069ef90a487b6e707 (diff) |
Add user agent header to que client
Diffstat (limited to 'Run')
-rwxr-xr-x | Run/Que/client.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Run/Que/client.py b/Run/Que/client.py index 8d90e7a..6a91d0c 100755 --- a/Run/Que/client.py +++ b/Run/Que/client.py @@ -55,19 +55,25 @@ def main(argv=None): # loop until ^C while not time.sleep(1): with request.urlopen( - f"{args.host}/{args.target}", data=data, timeout=MAX_TIMEOUT + f"{args.host}/{args.target}", + data=data, + timeout=MAX_TIMEOUT, + headers={"User-Agent": "Que/Client"}, ) as req: pass else: with request.urlopen( - f"{args.host}/{args.target}", data=data, timeout=MAX_TIMEOUT + f"{args.host}/{args.target}", + data=data, + timeout=MAX_TIMEOUT, + headers={"User-Agent": "Que/Client"}, ) as req: pass else: # no input data, do a read instead params = urllib.parse.urlencode({"poll": args.poll}) url = f"{args.host}/{args.target}?{params}" - with request.urlopen(url) as req: + with request.urlopen(url, headers={"User-Agent": "Que/Client"}) as req: if args.poll: while not time.sleep(1): msg = req.readline().decode("utf-8").strip() |