Exemplo n.º 1
0
  def get(self):
    #get query
    query = self.request.get('q')
    sinceid = self.request.get('since')
    rpp = 25
    
    #get tweets
    url = picfallHelper.constructPicSearch(query, sinceid, rpp)
    results = twitter.performSearch(url)
    resultsData = twitter.resultsFromJSON(results)
    tweets = picfallHelper.parseResults(resultsData['results'])
    ##just extract the pics
    #from itertools import chain
    #listofpics = [tweet.pics for tweet in tweets]
    #justpics = list(chain(*listofpics))
    
    #setup template
    urlAsHTML = '<a href="' +url + '">' + url + '</a>'
    template_values = {
      'trend': query,
      'tweets': tweets,
    }

    #path = os.path.join(os.path.dirname(__file__), 'justpics.html')
    path = os.path.join(os.path.dirname(__file__), 'pictweets.html')
    self.response.out.write(template.render(path, template_values))
Exemplo n.º 2
0
 def getPicTweets(self, query):
   url = self.constructPicSearch(query)
   results = twitter.performSearch(url)
   resultsData = twitter.resultsFromJSON(results)
   tweets = self.parseResults(resultsData['results'])
   
   return tweets
Exemplo n.º 3
0
 def get(self):
   #get query
   query = self.request.get('q')
   sinceid = self.request.get('since')
   
   numTweets = defaultNumTweets
   
   #get tweets
   url = picfallHelper.constructPicSearch(query, sinceid, numTweets)
   results = twitter.performSearch(url)
   resultsData = twitter.resultsFromJSON(results)
   tweets = picfallHelper.parseResults(resultsData['results'])
   
   #setup template
   urlAsHTML = '<a href="' +url + '">' + url + '</a>'
   template_values = {
       'title': "Twitter Search",
       #'tweets': resultsData['results'],
       'tweets': tweets,
       'query': query,
       'searchType': "pics",
       'searchTechData': [
         {'name': 'url', 'data': urlAsHTML},
         {'name': 'json', 'data': results},
         ],
   }
   
   path = os.path.join(os.path.dirname(__file__), 'search.html')
   self.response.out.write(template.render(path, template_values))
Exemplo n.º 4
0
 def __init__(self,):
   #set request time
   requestedat = now()
   #get tweets
   url = flitter.constructPicSearch(query)
   results = twitter.performSearch(url)
   resultsData = twitter.resultsFromJSON(results)
   tweets = flitter.parseResults(resultsData['results'])
   
   return tweets