From ba7843e3f56b3f7a2c6dd5faafc1976226aa527b Mon Sep 17 00:00:00 2001 From: Lertsenem Date: Tue, 7 Jul 2020 16:11:51 +0200 Subject: [PATCH] Fix run_query() use of args by adding arguments run_query() was copied from elsewhere and relied on args being available to get the token and proxy config. Those are now passed as function arguments. --- lokrez/smashgg.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lokrez/smashgg.py b/lokrez/smashgg.py index 154baca..466ee6b 100644 --- a/lokrez/smashgg.py +++ b/lokrez/smashgg.py @@ -203,16 +203,20 @@ numEntrants: {nbe}""" \ name = self.name, date = self.startAt, loc = self.venueName, + addr = self.venueAddress, + city = self.city, + ctry = self.countryCode, slug = self.slug, nbe = self.numEntrants, ) - # ============================================================================= def run_query( query_name, variables = {}, + token = "", + proxy = None, query_dir = "queries", query_extension = "gql", api_url = API_URL, @@ -240,7 +244,7 @@ def run_query( # Build headers headers = { - "Authorization": "Bearer {token}".format(token = args.token), + "Authorization": "Bearer {token}".format(token = token), "Accept": "application/json", "Content-Type": "application/json" } @@ -256,7 +260,7 @@ def run_query( API_URL, json.dumps(payload).encode("utf-8"), headers = headers, - proxies = {"http": args.proxy, "https": args.proxy}, + proxies = {"http": proxy, "https": proxy}, ) try: