class TwitterTest(unittest.TestCase): def setUp(self): self.scraper = Twitter() def test_connection(self): self.assertEqual(self.scraper.connection(), True) def test_grab_user(self): self.scraper.connection() self.assertEqual(self.scraper.grab_user(profile='ribeiroit'), True) self.assertEqual(self.scraper.profile['nm'], 'Thiago Ribeiro')
def scrap_profile(p_type, profile): print 'Processing profile %s' % profile if p_type == 'f': scrap = Facebook() elif p_type == 't': scrap = Twitter() scrap.connection() scrap.grab_user(profile) if scrap.profile['nm']: p = Profile( nm=scrap.profile['nm'], im=scrap.profile['im'], dc=scrap.profile['dc'], pi=scrap.profile['pi'], fr=scrap.profile['fr'], pr=scrap.profile['pr'] ) p.save()
def setUp(self): self.scraper = Twitter()