aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/lib
diff options
context:
space:
mode:
authorFrançois Schmidts <francois.schmidts@gmail.com>2015-01-21 14:07:00 +0100
committerFrançois Schmidts <francois.schmidts@gmail.com>2015-03-03 22:22:46 +0100
commit4f0ad9e442e64f69d420dea4d737805eefaaf981 (patch)
tree8625aca6c0313243aab5143df916df400edc4385 /pyaggr3g470r/lib
parentfirst implementation of fetchable feeds (diff)
downloadnewspipe-4f0ad9e442e64f69d420dea4d737805eefaaf981.tar.gz
newspipe-4f0ad9e442e64f69d420dea4d737805eefaaf981.tar.bz2
newspipe-4f0ad9e442e64f69d420dea4d737805eefaaf981.zip
continuing refacto
Diffstat (limited to 'pyaggr3g470r/lib')
-rwxr-xr-xpyaggr3g470r/lib/client.py6
-rw-r--r--pyaggr3g470r/lib/crawler.py11
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)
bgstack15