MobileBlur

Check-in [8cd4f18daf]
Login
Overview
Comment:Added support for multiple users to use the site simultaneously
Timelines: family | ancestors | descendants | both | develop
Files: files | file ages | folders
SHA1:8cd4f18daf81d3c9a082dfe1e20c829005b6d598
User & Date: spiffy on 2011-11-20 20:49:00
Other Links: manifest | tags
Context
2011-11-20
21:04
Added a catch to handle a failed Newsblur login check-in: 759f07e810 user: spiffy tags: develop
20:49
Added support for multiple users to use the site simultaneously check-in: 8cd4f18daf user: spiffy tags: develop
13:37
Merged in support for a real auth system, not a one-user DB kludge check-in: 57cc1847b3 user: spiffy tags: develop
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Modified applications/mobileblur/controllers/default.py from [b38b4efcae] to [5b9444c25f].

1

2
3
4
5
6
7
8
..
15
16
17
18
19
20
21
22
23
24
25
26
27
from pprint import pprint


def index():
    raw_feeds = newsblur.feeds(flat=True)["feeds"]
    feeds = {}
    for feed in raw_feeds.itervalues():
        for i in range(threshold, 2):
            if feed[thresholds[i]] > 0:
................................................................................
def login():
    login_form = SQLFORM.factory(
        Field("username", requires=IS_NOT_EMPTY()),
        Field("password", "password", requires=IS_NOT_EMPTY())
    )
    if login_form.accepts(request):
        results = newsblur.login(login_form.vars["username"], login_form.vars["password"])
        response.cookies["nb_cookie"] = newsblur.cookies
        response.cookies["nb_cookie"]["path"] = "/"
        print "cookie =", newsblur.cookies
        redirect(URL("index"))

    return dict(login_form=login_form)

>







 







|





1
2
3
4
5
6
7
8
9
..
16
17
18
19
20
21
22
23
24
25
26
27
28
from pprint import pprint
import simplejson

def index():
    raw_feeds = newsblur.feeds(flat=True)["feeds"]
    feeds = {}
    for feed in raw_feeds.itervalues():
        for i in range(threshold, 2):
            if feed[thresholds[i]] > 0:
................................................................................
def login():
    login_form = SQLFORM.factory(
        Field("username", requires=IS_NOT_EMPTY()),
        Field("password", "password", requires=IS_NOT_EMPTY())
    )
    if login_form.accepts(request):
        results = newsblur.login(login_form.vars["username"], login_form.vars["password"])
        response.cookies["nb_cookie"] = newsblur.cookies["newsblur_sessionid"]
        response.cookies["nb_cookie"]["path"] = "/"
        print "cookie =", newsblur.cookies
        redirect(URL("index"))

    return dict(login_form=login_form)

Modified applications/mobileblur/models/0_helpers.py from [6363f858c9] to [c67dbf684a].

1

2
3
4
5
6
7
8
9

10
11
12
newsblur = local_import("newsblur")


threshold = 0
thresholds = ["nt", "ps", "ng"]  # indices -1, 0, 1 for negative, neutral, and positive intelligence filters

#import ipdb
#ipdb.set_trace()
if "nb_cookie" not in request.cookies.keys():
    if [request.application, request.controller, request.function] != [request.application, "default", "login"]:

        redirect(URL("default", "login"))
#else:
#    newsblur.cookies = request.cookies["nb_cookie"]

>




<
<
|
|
>

|
|
1
2
3
4
5
6


7
8
9
10
11
12
newsblur = local_import("newsblur")
newsblur = newsblur.NewsBlur()

threshold = 0
thresholds = ["nt", "ps", "ng"]  # indices -1, 0, 1 for negative, neutral, and positive intelligence filters



print request.cookies
if [request.application, request.controller, request.function] != [request.application, "default", "login"]:
    if "nb_cookie" not in request.cookies.keys():
        redirect(URL("default", "login"))
    else:
        newsblur.cookies["newsblur_sessionid"] = request.cookies["nb_cookie"].value

Modified applications/mobileblur/modules/newsblur.py from [d2476742fe] to [f65190f3ac].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336



#!/usr/bin/python

"""newsblur.py - An API wrapper library for newsblur.com"""

import simplejson

import requests

__author__ = 'Dananjaya Ramanayake <dananjaya86@gmail.com>, spiffytech <spiffytechgmail.com>'
__version__ = "0.1"

nb_url = "http://www.newsblur.com/"
cookies = None

def login(username,password):
    '''
    Login as an existing user.
    If a user has no password set, you cannot just send any old password. 
    Required parameters, username and password, must be of string type.
    '''

    url = nb_url + 'api/login'
    results = requests.post(url, data={"username": username, "password": password})
    global cookies
    cookies = results.cookies
    return simplejson.loads(results.content)

def logout():
    '''
    Logout the currently logged in user.
    '''

    url = nb_url + 'api/logout'
    results = requests.get(url, cookies=cookies)
    return simplejson.loads(results.content)

def signup(username,password,email):
    '''
    Create a new user.
    All three required parameters must be of type string.
    '''

    url = nb_url + 'api/signup'
    payload = {'signup_username':username,'signup_password':password,'signup_email':email}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def search_feed(address,offset=1):
    '''
    
    Retrieve information about a feed from its website or RSS address.
    Parameter address must be of type string while parameter offset must be an integer.
    Will return a feed.
    
    '''

    url = nb_url + 'rss_feeds/search_feed'
    payload = {'address':address,'offset':offset}
    results = results.get(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def feeds(include_favicons=True,flat=False):
    '''
    Retrieve a list of feeds to which a user is actively subscribed.
    Includes the 3 unread counts (positive, neutral, negative), as well as optional favicons.
    '''
    
    url = nb_url + 'reader/feeds'
    payload = {'include_favicons':include_favicons,'flat':flat}
    results = requests.get(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)


def favicons(feeds=[1,2,3]):
    '''
    Retrieve a list of favicons for a list of feeds. 
    Used when combined with /reader/feeds and include_favicons=false, so the feeds request contains far less data. 
    Useful for mobile devices, but requires a second request. 
    '''
    
    url = nb_url + 'reader/favicons'
    payload = {'feeds':feeds}
    results = requests.get(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)
    
def id(id_no):
    '''
    Retrieve the original page from a single feed.
    '''
    
    url = nb_url + 'reader/page/' % id_no
    payload = {}
    results = requests.get(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def refresh_feeds():
    '''
    Up-to-the-second unread counts for each active feed.
    Poll for these counts no more than once a minute.
    '''

    url = nb_url + 'reader/refresh_feeds'
    results = requests.get(url, cookies=cookies)
    return simplejson.loads(results.content)

def feeds_trainer(feed_id):
    '''
    Retrieves all popular and known intelligence classifiers.
    Also includes user's own classifiers.
    '''

    url = nb_url + 'reader/feeds_trainer'
    payload = {'feed_id':feed_id}
    results = requests.get(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def statistics(id_no):
    '''
    If you only want a user's classifiers, use /classifiers/:id.
    Omit the feed_id to get all classifiers for all subscriptions.
    '''

    url = nb_url + 'rss_feeds/statistics/%d' % id_no
    results = requests.get(url, cookies=cookies)
    return simplejson.loads(results.content)

def feed_autocomplete(term):
    '''
    Get a list of feeds that contain a search phrase.
    Searches by feed address, feed url, and feed title, in that order.
    Will only show sites with 2+ subscribers.
    '''

    url = nb_url + 'rss_feeds/feed_autocomplete?%'
    payload = {'term':term}
    results = requests.get(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def feed(id):
    '''
    Retrieve stories from a single feed.
    '''

    url = nb_url + 'reader/feed/%s' % id
    results = requests.get(url, cookies=cookies)
    return simplejson.loads(results.content)

def starred_stories(page=1):
    '''
    Retrieve a user's starred stories.
    '''
    
    url = nb_url + 'reader/starred_stories'
    payload = {'page':page}
    results = requests.get(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def river_stories(feeds,page=1,read_stories_count=0):
    '''
    Retrieve stories from a collection of feeds. This is known as the River of News.
    Stories are ordered in reverse chronological order.
    '''

    url = nb_url + 'reader/river_stories'
    payload = {'feeds':feeds,'page':page,'read_stories_count':read_stories_count}
    results = urllib2.urlopen(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def mark_story_as_read(story_id,feed_id):
    '''
    Mark stories as read.
    Multiple story ids can be sent at once.
    Each story must be from the same feed.
    '''

    url = nb_url + 'reader/mark_story_as_read'
    payload = {'story_id':story_id,'feed_id':feed_id}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def mark_story_as_starred(story_id,feed_id):
    '''
    Mark a story as starred (saved).
    '''
    
    url = nb_url + 'reader/mark_story_as_starred'
    payload = {'story_id':story_id,'feed_id':feed_id}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def mark_all_as_read(days=0):
    '''
    Mark all stories in *all* feeds read.
    '''
    
    url = nb_url + 'reader/mark_all_as_read'
    payload = {'days':days}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def add_url(url,folder='[Top Level]'):
    '''
    Add a feed by its URL. 
    Can be either the RSS feed or the website itself.
    '''
    
    url = nb_url + 'reader/add_url'
    payload = {'url':url,'folder':folder}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)


def add_folder(folder,parent_folder='[Top Level]'):
    '''
    Add a new folder.
    '''
    
    url = nb_url + 'reader/add_folder'
    payload = {'folder':folder,'parent_folder':parent_folder}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def rename_feed(feed_title,feed_id):
    '''
    Rename a feed title. Only the current user will see the new title.
    '''
    
    url = nb_url + 'reader/rename_feed'
    payload = {'feed_title':feed_title,'feed_id':feed_id}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def delete_feed(feed_id,in_folder):
    '''
    Unsubscribe from a feed. Removes it from the folder.
    Set the in_folder parameter to remove a feed from the correct folder, in case the user is subscribed to the feed in multiple folders.
    '''    

    url = nb_url + 'reader/delete_feed'
    payload = {'feed_id':feed_id,'in_folder':in_folder}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def rename_folder(folder_to_rename,new_folder_name,in_folder):
    '''
    Rename a folder.
    '''
    
    url = nb_url + 'reader/rename_folder'
    payload = {'folder_to_rename':folder_to_rename,'new_folder_name':new_folder_name,'in_folder':in_folder}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)

def delete_folder(folder_to_delete,in_folder,feed_id):
    '''
    Delete a folder and unsubscribe from all feeds inside.
    '''
    
    url = nb_url + 'reader/delete_folder'
    payload = {'folder_to_delete':folder_to_delete,'in_folder':in_folder,'feed_id':feed_id}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)


def mark_feed_as_read(feed_id):
    '''
    Mark a list of feeds as read.
    '''
    
    url = nb_url + 'reader/mark_feed_as_read'
    payload = {'feed_id':feed_id}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)


def save_feed_order(folders):
    '''
    Reorder feeds and move them around between folders.
    The entire folder structure needs to be serialized.
    '''

    url = nb_url + 'reader/save_feed_order'
    payload = {'folders':folders}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)


def classifier(id_no):
    '''
    Get the intelligence classifiers for a user's site.
    Only includes the user's own classifiers. 
    Use /reader/feeds_trainer for popular classifiers.
    '''

    url = nb_url + 'classifier/%d' % id_no
    results = requests.get(url)
    return simplejson.loads(results.content)


def classifier_save(like_type,dislike_type,remove_like_type,remove_dislike_type):
    '''
    Save intelligence classifiers (tags, titles, authors, and the feed) for a feed.
    '''
    
    url = nb_url + 'classifier/save'
    payload = {'like_[TYPE]':like_type,
                   'dislike_[TYPE]':dislike_type,
                    'remove_like_[TYPE]':remove_like_type,
                   'remove_dislike_[TYPE]':remove_dislike_type}
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)


def opml_export():
    '''
    Download a backup of feeds and folders as an OPML file.
    Contains folders and feeds in XML; useful for importing in another RSS reader.
    '''
    
    url = nb_url + 'import/opml_export'
    results = requests.get(url)
    return simplejson.loads(results.content)



def opml_upload(opml_file):
    '''
    Upload an OPML file.
    '''
    
    url = nb_url + 'import/opml_upload'
    f = open(opml_file)
    payload = {'file':f}
    f.close()
    results = requests.post(url, data=payload, cookies=cookies)
    return simplejson.loads(results.content)








|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
#!/usr/bin/python

"""newsblur.py - An API wrapper library for newsblur.com"""

import simplejson
import requests

__author__ = 'Dananjaya Ramanayake <dananjaya86@gmail.com>, spiffytech <spiffytechgmail.com>'
__version__ = "0.1"

nb_url = "http://www.newsblur.com/"

class NewsBlur():
    def __init__(self):
        self.cookies = {}

    def login(self, username,password):
        '''
        Login as an existing user.
        If a user has no password set, you cannot just send any old password. 
        Required parameters, username and password, must be of string type.
        '''

        url = nb_url + 'api/login'
        results = requests.post(url, data={"username": username, "password": password})
        print "results.cookies =", results.cookies
        print type(results.cookies)
        self.cookies = results.cookies
        return simplejson.loads(results.content)

    def logout(self, ):
        '''
        Logout the currently logged in user.
        '''

        url = nb_url + 'api/logout'
        results = requests.get(url, cookies=self.cookies)
        return simplejson.loads(results.content)

    def signup(self, username,password,email):
        '''
        Create a new user.
        All three required parameters must be of type string.
        '''

        url = nb_url + 'api/signup'
        payload = {'signup_username':username,'signup_password':password,'signup_email':email}
        results = requests.post(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)

    def search_feed(self, address,offset=1):
        '''
        
        Retrieve information about a feed from its website or RSS address.
        Parameter address must be of type string while parameter offset must be an integer.
        Will return a feed.
        
        '''

        url = nb_url + 'rss_feeds/search_feed'
        payload = {'address':address,'offset':offset}
        results = results.get(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)

    def feeds(self, include_favicons=True,flat=False):
        '''
        Retrieve a list of feeds to which a user is actively subscribed.
        Includes the 3 unread counts (positive, neutral, negative), as well as optional favicons.
        '''
        
        url = nb_url + 'reader/feeds'
        payload = {'include_favicons':include_favicons,'flat':flat}
        results = requests.get(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)


    def favicons(self, feeds=[1,2,3]):
        '''
        Retrieve a list of favicons for a list of feeds. 
        Used when combined with /reader/feeds and include_favicons=false, so the feeds request contains far less data. 
        Useful for mobile devices, but requires a second request. 
        '''
        
        url = nb_url + 'reader/favicons'
        payload = {'feeds':feeds}
        results = requests.get(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)
        
    def id(self, id_no):
        '''
        Retrieve the original page from a single feed.
        '''
        
        url = nb_url + 'reader/page/' % id_no
        payload = {}
        results = requests.get(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)

    def refresh_feeds(self, ):
        '''
        Up-to-the-second unread counts for each active feed.
        Poll for these counts no more than once a minute.
        '''

        url = nb_url + 'reader/refresh_feeds'
        results = requests.get(url, cookies=self.cookies)
        return simplejson.loads(results.content)

    def feeds_trainer(self, feed_id):
        '''
        Retrieves all popular and known intelligence classifiers.
        Also includes user's own classifiers.
        '''

        url = nb_url + 'reader/feeds_trainer'
        payload = {'feed_id':feed_id}
        results = requests.get(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)

    def statistics(self, id_no):
        '''
        If you only want a user's classifiers, use /classifiers/:id.
        Omit the feed_id to get all classifiers for all subscriptions.
        '''

        url = nb_url + 'rss_feeds/statistics/%d' % id_no
        results = requests.get(url, cookies=self.cookies)
        return simplejson.loads(results.content)

    def feed_autocomplete(self, term):
        '''
        Get a list of feeds that contain a search phrase.
        Searches by feed address, feed url, and feed title, in that order.
        Will only show sites with 2+ subscribers.
        '''

        url = nb_url + 'rss_feeds/feed_autocomplete?%'
        payload = {'term':term}
        results = requests.get(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)

    def feed(self, id):
        '''
        Retrieve stories from a single feed.
        '''

        url = nb_url + 'reader/feed/%s' % id
        results = requests.get(url, cookies=self.cookies)
        return simplejson.loads(results.content)

    def starred_stories(self, page=1):
        '''
        Retrieve a user's starred stories.
        '''
        
        url = nb_url + 'reader/starred_stories'
        payload = {'page':page}
        results = requests.get(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)

    def river_stories(self, feeds,page=1,read_stories_count=0):
        '''
        Retrieve stories from a collection of feeds. This is known as the River of News.
        Stories are ordered in reverse chronological order.
        '''

        url = nb_url + 'reader/river_stories'
        payload = {'feeds':feeds,'page':page,'read_stories_count':read_stories_count}
        results = urllib2.urlopen(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)

    def mark_story_as_read(self, story_id,feed_id):
        '''
        Mark stories as read.
        Multiple story ids can be sent at once.
        Each story must be from the same feed.
        '''

        url = nb_url + 'reader/mark_story_as_read'
        payload = {'story_id':story_id,'feed_id':feed_id}
        results = requests.post(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)

    def mark_story_as_starred(self, story_id,feed_id):
        '''
        Mark a story as starred (saved).
        '''
        
        url = nb_url + 'reader/mark_story_as_starred'
        payload = {'story_id':story_id,'feed_id':feed_id}
        results = requests.post(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)

    def mark_all_as_read(self, days=0):
        '''
        Mark all stories in *all* feeds read.
        '''
        
        url = nb_url + 'reader/mark_all_as_read'
        payload = {'days':days}
        results = requests.post(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)

    def add_url(self, url,folder='[Top Level]'):
        '''
        Add a feed by its URL. 
        Can be either the RSS feed or the website itself.
        '''
        
        url = nb_url + 'reader/add_url'
        payload = {'url':url,'folder':folder}
        results = requests.post(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)


    def add_folder(self, folder,parent_folder='[Top Level]'):
        '''
        Add a new folder.
        '''
        
        url = nb_url + 'reader/add_folder'
        payload = {'folder':folder,'parent_folder':parent_folder}
        results = requests.post(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)

    def rename_feed(self, feed_title,feed_id):
        '''
        Rename a feed title. Only the current user will see the new title.
        '''
        
        url = nb_url + 'reader/rename_feed'
        payload = {'feed_title':feed_title,'feed_id':feed_id}
        results = requests.post(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)

    def delete_feed(self, feed_id,in_folder):
        '''
        Unsubscribe from a feed. Removes it from the folder.
        Set the in_folder parameter to remove a feed from the correct folder, in case the user is subscribed to the feed in multiple folders.
        '''    

        url = nb_url + 'reader/delete_feed'
        payload = {'feed_id':feed_id,'in_folder':in_folder}
        results = requests.post(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)

    def rename_folder(self, folder_to_rename,new_folder_name,in_folder):
        '''
        Rename a folder.
        '''
        
        url = nb_url + 'reader/rename_folder'
        payload = {'folder_to_rename':folder_to_rename,'new_folder_name':new_folder_name,'in_folder':in_folder}
        results = requests.post(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)

    def delete_folder(self, folder_to_delete,in_folder,feed_id):
        '''
        Delete a folder and unsubscribe from all feeds inside.
        '''
        
        url = nb_url + 'reader/delete_folder'
        payload = {'folder_to_delete':folder_to_delete,'in_folder':in_folder,'feed_id':feed_id}
        results = requests.post(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)


    def mark_feed_as_read(self, feed_id):
        '''
        Mark a list of feeds as read.
        '''
        
        url = nb_url + 'reader/mark_feed_as_read'
        payload = {'feed_id':feed_id}
        results = requests.post(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)


    def save_feed_order(self, folders):
        '''
        Reorder feeds and move them around between folders.
        The entire folder structure needs to be serialized.
        '''

        url = nb_url + 'reader/save_feed_order'
        payload = {'folders':folders}
        results = requests.post(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)


    def classifier(self, id_no):
        '''
        Get the intelligence classifiers for a user's site.
        Only includes the user's own classifiers. 
        Use /reader/feeds_trainer for popular classifiers.
        '''

        url = nb_url + 'classifier/%d' % id_no
        results = requests.get(url)
        return simplejson.loads(results.content)


    def classifier_save(self, like_type,dislike_type,remove_like_type,remove_dislike_type):
        '''
        Save intelligence classifiers (tags, titles, authors, and the feed) for a feed.
        '''
        
        url = nb_url + 'classifier/save'
        payload = {'like_[TYPE]':like_type,
                       'dislike_[TYPE]':dislike_type,
                        'remove_like_[TYPE]':remove_like_type,
                       'remove_dislike_[TYPE]':remove_dislike_type}
        results = requests.post(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)


    def opml_export(self, ):
        '''
        Download a backup of feeds and folders as an OPML file.
        Contains folders and feeds in XML; useful for importing in another RSS reader.
        '''
        
        url = nb_url + 'import/opml_export'
        results = requests.get(url)
        return simplejson.loads(results.content)



    def opml_upload(self, opml_file):
        '''
        Upload an OPML file.
        '''
        
        url = nb_url + 'import/opml_upload'
        f = open(opml_file)
        payload = {'file':f}
        f.close()
        results = requests.post(url, data=payload, cookies=self.cookies)
        return simplejson.loads(results.content)

Modified gluon/__init__.pyc from [4b1dda92da] to [5cc6bba7a9].

cannot compute difference between binary files

Modified gluon/admin.pyc from [f384b2f33c] to [79ffa4f52b].

cannot compute difference between binary files

Modified gluon/cache.pyc from [4c62f4a468] to [ee2fd24717].

cannot compute difference between binary files

Modified gluon/cfs.pyc from [c27431a52a] to [53702fcc9d].

cannot compute difference between binary files

Modified gluon/compileapp.pyc from [fde14323b3] to [dcbe76af54].

cannot compute difference between binary files

Modified gluon/contenttype.pyc from [e29ed3a249] to [c1d12f37e3].

cannot compute difference between binary files

Modified gluon/custom_import.pyc from [df735202af] to [00151440cf].

cannot compute difference between binary files

Modified gluon/dal.pyc from [20a5258c74] to [ef3f83ebfe].

cannot compute difference between binary files

Modified gluon/decoder.pyc from [7da62cc626] to [35a33e2b2b].

cannot compute difference between binary files

Modified gluon/fileutils.pyc from [f01ef6af2e] to [01211dcf79].

cannot compute difference between binary files

Modified gluon/globals.pyc from [3c7f502a11] to [04ca4032e7].

cannot compute difference between binary files

Modified gluon/highlight.pyc from [7e17a5f9fa] to [5942d409ce].

cannot compute difference between binary files

Modified gluon/html.pyc from [8f42eff40f] to [824bd62037].

cannot compute difference between binary files

Modified gluon/http.pyc from [c8d52a9b33] to [534d9c72d6].

cannot compute difference between binary files

Modified gluon/languages.pyc from [cc4448c9de] to [0996aa7396].

cannot compute difference between binary files

Modified gluon/main.pyc from [7db36fceca] to [7ddd622055].

cannot compute difference between binary files

Modified gluon/myregex.pyc from [e888c61100] to [d69e0ed8e9].

cannot compute difference between binary files

Modified gluon/newcron.pyc from [ad7a061b21] to [0679b97e21].

cannot compute difference between binary files

Modified gluon/portalocker.pyc from [9f3bbb0a55] to [8635463535].

cannot compute difference between binary files

Modified gluon/restricted.pyc from [52584fef22] to [2508bf3173].

cannot compute difference between binary files

Modified gluon/rewrite.pyc from [1f6cf594b7] to [b08a9d9aa8].

cannot compute difference between binary files

Modified gluon/rocket.pyc from [30fb9fab51] to [97b6551760].

cannot compute difference between binary files

Modified gluon/sanitizer.pyc from [d789c7453f] to [b32ea719f3].

cannot compute difference between binary files

Modified gluon/serializers.pyc from [50c93bfb9c] to [96f33f4817].

cannot compute difference between binary files

Modified gluon/settings.pyc from [ee34a24607] to [e337445a3a].

cannot compute difference between binary files

Modified gluon/shell.pyc from [cb888418ec] to [28e6a5f56e].

cannot compute difference between binary files

Modified gluon/sqlhtml.pyc from [b9c43229a5] to [12f6acce05].

cannot compute difference between binary files

Modified gluon/storage.pyc from [a1d5b27c69] to [5ded006a69].

cannot compute difference between binary files

Modified gluon/streamer.pyc from [59d659d0b5] to [2a88153c65].

cannot compute difference between binary files

Modified gluon/template.pyc from [892f7ab761] to [461edee807].

cannot compute difference between binary files

Modified gluon/tools.pyc from [3a8feefb6f] to [366fc7ea69].

cannot compute difference between binary files

Modified gluon/utils.pyc from [59bcf5d046] to [16b3176237].

cannot compute difference between binary files

Modified gluon/validators.pyc from [4ee16a78b6] to [16128513c3].

cannot compute difference between binary files

Modified gluon/widget.pyc from [5fe6811bf3] to [4cc96f8ee2].

cannot compute difference between binary files

Modified gluon/xmlrpc.pyc from [6e66be7d0b] to [1ea37d7148].

cannot compute difference between binary files