More API
This commit is contained in:
parent
8547fdeece
commit
63001a7279
9 changed files with 85 additions and 15 deletions
|
|
@ -3,7 +3,7 @@ import urllib2
|
|||
import time
|
||||
import threading
|
||||
from flask import json, Markup
|
||||
from werkzeug import url_encode, parse_date
|
||||
from werkzeug import url_encode, parse_date, http_date
|
||||
|
||||
|
||||
class SearchResult(object):
|
||||
|
|
@ -17,6 +17,12 @@ class SearchResult(object):
|
|||
self.type = result['metadata']['result_type']
|
||||
self.retweets = result['metadata'].get('recent_retweets') or 0
|
||||
|
||||
def to_json(self):
|
||||
rv = vars(self).copy()
|
||||
rv['pub_date'] = http_date(rv['pub_date'])
|
||||
rv['via'] = unicode(rv['via'])
|
||||
return rv
|
||||
|
||||
|
||||
class SearchQuery(object):
|
||||
fetch_timeout = 10
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue