From 1c550fdc51d16ec15c39edb346c28d5f07a2a425 Mon Sep 17 00:00:00 2001 From: schneefux Date: Sat, 25 Feb 2017 13:43:39 +0100 Subject: add VAINSOCIAL_APIKEY env variable --- api.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'api.py') diff --git a/api.py b/api.py index 1cfa918..89573ce 100644 --- a/api.py +++ b/api.py @@ -28,7 +28,9 @@ def iso2date(d): class Apigrabber(object): - def __init__(self, regions, first_fetch=None, last_fetch=None): + def __init__(self, regions, apitoken, + first_fetch=None, last_fetch=None): + self._apitoken = apitoken self.update_live = False # TODO refactor this if first_fetch is None: @@ -138,7 +140,7 @@ class Apigrabber(object): async def crawl_timeframe(self, region, jobid, jobstart, jobend): """Crawl a time frame forwards from `date` in `region`.""" async with self._pool.acquire() as con: - api = crawler.Crawler() + api = crawler.Crawler(self._apitoken) async with con.transaction(): params = { "filter[createdAt-start]": date2iso(jobstart), @@ -267,6 +269,7 @@ class Apigrabber(object): async def startup(): apigrabber = Apigrabber( + apitoken=os.environ["VAINSOCIAL_APITOKEN"], regions=os.environ["VAINSOCIAL_REGIONS"].split(","), first_fetch=os.environ.get("VAINSOCIAL_STARTDATE"), last_fetch=os.environ.get("VAINSOCIAL_ENDDATE") -- cgit v1.3.1