diff options
Diffstat (limited to 'pyaggr3g470r/lib')
-rwxr-xr-x | pyaggr3g470r/lib/client.py | 6 | ||||
-rw-r--r-- | pyaggr3g470r/lib/crawler.py | 11 |
2 files changed, 14 insertions, 3 deletions
diff --git a/pyaggr3g470r/lib/client.py b/pyaggr3g470r/lib/client.py index da6b1727..6b2fc9ae 100755 --- a/pyaggr3g470r/lib/client.py +++ b/pyaggr3g470r/lib/client.py @@ -1,16 +1,16 @@ #!/usr/bin/env python import json import requests -URL = 'domain.net' +import conf def get_client(email, password): client = requests.session() - client.get(URL + 'api/csrf', verify=False, + client.get(conf.PLATFORM_URL + 'api/csrf', verify=False, data=json.dumps({'email': email, 'password': password})) return client def get_articles(client): - return client.get(URL + 'api/v1.0/articles/').json + return client.get(conf.PLATFORM_URL + 'api/v1.0/articles/').json diff --git a/pyaggr3g470r/lib/crawler.py b/pyaggr3g470r/lib/crawler.py new file mode 100644 index 00000000..1d7fca71 --- /dev/null +++ b/pyaggr3g470r/lib/crawler.py @@ -0,0 +1,11 @@ +import feedparser +import dateutil.parser.parse + + +def get_feed_content(feed): + etag = feed.get('etag', None) + last_modified = None + if feed.get('last_modified'): + last_modified = dateutil.parser.parse(feed['last_modified'])\ + .strftime('%a, %d %b %Y %H:%M:%S %Z') + return feedparser.parse(feed['link'], etag=etag, modified=last_modified) |