From 5aa1f0eed4373ffa3c21cfcee07ab1b6301b9cea Mon Sep 17 00:00:00 2001 From: Jed Dougherty Date: Tue, 6 Sep 2016 16:21:53 -0400 Subject: [PATCH 1/2] Cycle through multiple pages Update to cycle through multiple pages when a screen name has more than 5000 followers. Also, since a client can request this information for any screen name, not just their own, includes a `screen_name` variable. --- .../sonra_twitter_plugin_compute_followers_info/recipe.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/twitter-tools/custom-recipes/sonra_twitter_plugin_compute_followers_info/recipe.py b/twitter-tools/custom-recipes/sonra_twitter_plugin_compute_followers_info/recipe.py index 59f70538..07b5f296 100644 --- a/twitter-tools/custom-recipes/sonra_twitter_plugin_compute_followers_info/recipe.py +++ b/twitter-tools/custom-recipes/sonra_twitter_plugin_compute_followers_info/recipe.py @@ -19,6 +19,7 @@ output_dataset_name = get_output_names_for_role('main')[0] client = get_client() DEFAULT_INTERVAL=int(get_recipe_config()['default_interval']) +SCREEN_NAME=get_recipe_config()['screen_name'] def get_followers(): # get followers @@ -29,7 +30,7 @@ def get_followers(): try: # get followers print "Get followers list: "+str(cursor) - response = client.api.followers.ids.get() + response = client.api.followers.ids.get(screen_name = SCREEN_NAME, cursor = cursor) # update cursor cursor = response.data.next_cursor From d8ded5fd6ddb9c294b82e1c1c9627115ba7fd2d3 Mon Sep 17 00:00:00 2001 From: Jed Dougherty Date: Tue, 6 Sep 2016 16:24:31 -0400 Subject: [PATCH 2/2] Add Screen Name Parameter --- .../recipe.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/twitter-tools/custom-recipes/sonra_twitter_plugin_compute_followers_info/recipe.json b/twitter-tools/custom-recipes/sonra_twitter_plugin_compute_followers_info/recipe.json index beeca77f..690e10a9 100644 --- a/twitter-tools/custom-recipes/sonra_twitter_plugin_compute_followers_info/recipe.json +++ b/twitter-tools/custom-recipes/sonra_twitter_plugin_compute_followers_info/recipe.json @@ -31,6 +31,14 @@ "type": "STRING", "mandatory" : true }, + { + "name": "screen_name", + "label" : "Twitter Screen Name", + "description" : "Name of the Twitter User", + "type": "STRING", + "mandatory" : true + }, + //{ "type" : "SEPARATOR", "label" : "Advanced" }, { "name": "dataiku_url",