Ejemplo n.º 1
0
 def post(self):
     test = self.request.get('test')
     if test == 'source':
         type = self.request.get('type')
         from api import ensure_source
         url = self.request.get('url')
         source = ensure_source(url, suppress_immediate_fetch=True)
         if type == 'content':
             from source_fetch import _source_fetch
             self.response.headers.add_header('Content-Type', 'text/plain')
             pprint(_source_fetch(source), self.response.out)
         elif type == 'json':
             from source_fetch import source_fetch
             source_fetch(source)
             send_json(self, source.json())
Ejemplo n.º 2
0
 def post(self):
     print "URL:", self.request.get('url')
     source = api.ensure_source(self.request.get('url'))
     self.redirect('sources/' + source.key.urlsafe())