def test_create_account(self): t_empty = TuentiSocialMessenger() generate_random = lambda: ''.join(random.sample(string.ascii_lowercase, 6)) params = { 'email': '*****@*****.**' % generate_random(), 'name': generate_random(), 'last': generate_random(), 'gender': 1, 'installationId': t_empty.installation_id, 'deviceFamily': 'MDI3MDFmZjU4MGExNWM0YmEyYjA5MzRkODlmMjg0MTU6MC4yMjk5ODcwMCAxMzI0NDg5NjY0' } data = t_empty.request('Registration_createNewAccount', params) self.assertEqual(data['session']['newUser'], True) self.tuenti_logout(t_empty)
def main(): args_eng = argparse.ArgumentParser(description='Tuenti image downloader', add_help=True) args_eng.add_argument('user', help='Tuenti login email') args_eng.add_argument('pwd', help='Tuenti password') args = args_eng.parse_args() tsm = TuentiSocialMessenger.from_credentials(args.user, args.pwd) file_downloader = FileDownloader() collector = IDCollector() collector.add('') total_count = 0 saved_count = 0 for user_id in collector.iterate(): logger.debug("Inspecting user %s", user_id) collector.gen_log_message() for photo in get_user_album_photos(tsm, user_id): total_count += 1 if collector.is_photo_collectable(photo): collector.collect_ids(photo) saved_count += 1 file_downloader.save_photo(photo) if saved_count and not total_count % 100: logger.info("Downloaded %d/%d photos", saved_count, total_count)
def test_token_auth(self): auth_token, installation_id = self.t.get_auth_data() tuenti_token = TuentiSocialMessenger.from_auth_token( self.user, auth_token, installation_id) session_data = tuenti_token.request( 'Auth_getSessionInfo', {'installationId': self.t.installation_id}) self.assertTrue('userId' in session_data) self.tuenti_logout(tuenti_token)
def setUp(self): unittest.TestCase.setUp(self) self.user = os.environ.get('TUENTIUSER') or sys.argv[0] password = os.environ.get('TUENTIPASSWORD') or sys.argv[1] self.t = TuentiSocialMessenger.from_credentials(self.user, password)