From 953168a452f97eb7b7a8a613a2ebd1b9a59ecc56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Wo=C5=BAniak?= Date: Thu, 29 Oct 2020 15:22:31 +0100 Subject: [PATCH] Added argv to python script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcin Woźniak --- gettoken.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gettoken.py b/gettoken.py index 31b18da..9a39ccc 100755 --- a/gettoken.py +++ b/gettoken.py @@ -5,7 +5,11 @@ from urllib.parse import parse_qs import sys import requests as r -API_ADDRESS = "http://localhost:1285" +if len(sys.argv) > 1 : + API_ADDRESS = "http://" + sys.argv[1] + ":1285" +else: + API_ADDRESS = "http://localhost:1285" + PORT = 3000 @@ -24,7 +28,6 @@ class S(BaseHTTPRequestHandler): self.wfile.write("Your token: {}".format( response.text).encode('utf-8')) - def wait_for_request(server_class=HTTPServer, handler_class=S): server_address = ('localhost', PORT)