This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import Queue | |
import multiprocessing | |
import urllib2 | |
import feedparser | |
import socket | |
feeds = ['http://today.reuters.com/rss/topNews', | |
'http://today.reuters.com/rss/domesticNews', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.route('/users/<username>', methods = ['GET', 'POST', 'PATCH', 'DELETE']) | |
@requires_auth | |
def api_user(username): | |
current_user = User.get(request.authorization.username) | |
app.logger.debug("req.auth.username = %s", request.authorization.username) | |
# Only "SELF" can access/modify user info | |
if current_user.username != username: | |
return unauthorized() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from xml.dom import minidom | |
xmlstr = """<item> | |
<category>Category1</category> | |
<category>Category2</category> | |
<category>Category3</category> | |
</item>""" | |
dom = minidom.parseString(xmlstr) | |
items = dom.getElementsByTagName('item') | |
for item in items: | |
cats = item.getElementsByTagName('category') |