def get(self): text = self.request.get('text', None) if not text: self.response.out.write('') # no input detected. else: tp = TextParser(text) self.response.out.write(json.dumps(tp.fetch_urls())) self.response.headers.add_header("Content-type", "application/json")
def test_shortened_links(self): text = ( "" "Check out this video of Eric Ries " "http://bit.ly/aVlV11 from " "Stanford University. It's a good start to understand Lean Startup. " "Here is a presentation " "you need to see as well " "http://slidesha.re/M2z64S ." "NYTIme recently covered him too " "http://nyti.ms/aICucz" "Steve" ) tp = TextParser(text) self.assertEqual(tp.fetch_urls(), self.default_response)
def test_embed_codes(self): tp = TextParser(self.text) self.assertEqual(tp.fetch_urls(), self.default_response)