MobileBlur

default.py~ at tip
Login

default.py~ at tip

File applications/mobileblur/controllers/default.py~ from the latest check-in


# -*- 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()