MobileBlur

default.py~ at [b33aaf3ac3]
Login

default.py~ at [b33aaf3ac3]

File applications/mobileblur/controllers/default.py~ artifact 554e7bd08a part of check-in b33aaf3ac3


# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations

from pprint import pprint
import simplejson
import urllib

base = "http://newsblur.com/"
username = "spiffytech"
password = "JYRKJM9UuQg9"
threshold = 0

def index():
    login()
    data = urllib.urlencode({"flat": "true"})
    u = urllib.urlopen(base + "reader/feeds?" % data)
    print u.read()
    raw_feeds = simplejson.loads(u.read())
    pprint(raw_feeds)
    feeds = {}
    for feed in raw_feeds:
        if not (feed["ng"] == 0 and feed["nt"] == 0 and feed["ps"] == 0):
            feeds[feed["feed_title"]] = feed

    return feeds
    
def login():
    data = urllib.urlencode({"login_username": username, "login_password": password})
    u = urllib.urlopen(base + "api/login", data)
    print u.read()