{"action":"created","comment":{"url":"https://api.github.com/repos/nio-blocks/instagram/pulls/comments/22908116","id":22908116,"diff_hunk":"@@ -0,0 +1,154 @@\n+from .http_blocks.rest.rest_block import RESTPolling\n+from nio.metadata.properties.string import StringProperty\n+from nio.metadata.properties.timedelta import TimeDeltaProperty\n+from nio.common.signal.base import Signal\n+from datetime import datetime\n+import requests\n+\n+\n+class InstagramSearchByBase(RESTPolling):\n+\n+    \"\"\" This block polls the Instagram API, searching for all posts\n+    by the specified users.\n+\n+    Params:\n+        client_id (string): api credentials.\n+        lookback (timedelta): amount of time to lookback for posts on start.\n+\n+    \"\"\"\n+\n+    client_id = StringProperty(name=\"Client ID\",\n+                               default=\"[[INSTAGRAM_CLIENT_ID]]\")\n+    lookback = TimeDeltaProperty()\n+\n+    def __init__(self):\n+        super().__init__()\n+        self._created_field = 'created_time'\n+\n+    def configure(self, context):\n+        super().configure(context)\n+        lb = self._unix_time(datetime.utcnow() - self.lookback)\n+        self._freshest = [lb] * self._n_queries\n+        # Convert queries from usernames to ids.\n+        self.queries = [i for i in [self._process_query(q)\n+                        for q in self.queries] if i]\n+        # reset n in case some usernames did not convert to ids.\n+        self._n_queries = len(self.queries) or 1","path":"instagram_search_by.py","position":36,"original_position":36,"commit_id":"8c9937e5d92536019340030b9c75b28251a375eb","original_commit_id":"8c9937e5d92536019340030b9c75b28251a375eb","user":{"login":"hansmosh","id":5524215,"avatar_url":"https://avatars.githubusercontent.com/u/5524215?v=3","gravatar_id":"","url":"https://api.github.com/users/hansmosh","html_url":"https://github.com/hansmosh","followers_url":"https://api.github.com/users/hansmosh/followers","following_url":"https://api.github.com/users/hansmosh/following{/other_user}","gists_url":"https://api.github.com/users/hansmosh/gists{/gist_id}","starred_url":"https://api.github.com/users/hansmosh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hansmosh/subscriptions","organizations_url":"https://api.github.com/users/hansmosh/orgs","repos_url":"https://api.github.com/users/hansmosh/repos","events_url":"https://api.github.com/users/hansmosh/events{/privacy}","received_events_url":"https://api.github.com/users/hansmosh/received_events","type":"User","site_admin":false},"body":"I think this \"or 1\" used to exist in the rest polling block and was copied over from that, but I don't think it really makes sense. If their are no queries then it should be 0.","created_at":"2015-01-14T00:29:14Z","updated_at":"2015-01-14T00:29:14Z","html_url":"https://github.com/nio-blocks/instagram/pull/17#discussion_r22908116","pull_request_url":"https://api.github.com/repos/nio-blocks/instagram/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/nio-blocks/instagram/pulls/comments/22908116"},"html":{"href":"https://github.com/nio-blocks/instagram/pull/17#discussion_r22908116"},"pull_request":{"href":"https://api.github.com/repos/nio-blocks/instagram/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/nio-blocks/instagram/pulls/17","id":27075498,"html_url":"https://github.com/nio-blocks/instagram/pull/17","diff_url":"https://github.com/nio-blocks/instagram/pull/17.diff","patch_url":"https://github.com/nio-blocks/instagram/pull/17.patch","issue_url":"https://api.github.com/repos/nio-blocks/instagram/issues/17","number":17,"state":"open","locked":false,"title":"#15, #16, #14 - Refactors InstaGramSearchBy* and adds SearchByLocation","user":{"login":"oleiman","id":1635704,"avatar_url":"https://avatars.githubusercontent.com/u/1635704?v=3","gravatar_id":"","url":"https://api.github.com/users/oleiman","html_url":"https://github.com/oleiman","followers_url":"https://api.github.com/users/oleiman/followers","following_url":"https://api.github.com/users/oleiman/following{/other_user}","gists_url":"https://api.github.com/users/oleiman/gists{/gist_id}","starred_url":"https://api.github.com/users/oleiman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oleiman/subscriptions","organizations_url":"https://api.github.com/users/oleiman/orgs","repos_url":"https://api.github.com/users/oleiman/repos","events_url":"https://api.github.com/users/oleiman/events{/privacy}","received_events_url":"https://api.github.com/users/oleiman/received_events","type":"User","site_admin":false},"body":"Signed-off-by: Oren Leiman <oleiman@neutral.io>","created_at":"2015-01-09T01:58:42Z","updated_at":"2015-01-14T00:29:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b2d4d9824a7fe89152aede394dc0d4eab0be9654","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nio-blocks/instagram/pulls/17/commits","review_comments_url":"https://api.github.com/repos/nio-blocks/instagram/pulls/17/comments","review_comment_url":"https://api.github.com/repos/nio-blocks/instagram/pulls/comments/{number}","comments_url":"https://api.github.com/repos/nio-blocks/instagram/issues/17/comments","statuses_url":"https://api.github.com/repos/nio-blocks/instagram/statuses/8c9937e5d92536019340030b9c75b28251a375eb","head":{"label":"nio-blocks:feature/location_search_and_refactor","ref":"feature/location_search_and_refactor","sha":"8c9937e5d92536019340030b9c75b28251a375eb","user":{"login":"nio-blocks","id":7684467,"avatar_url":"https://avatars.githubusercontent.com/u/7684467?v=3","gravatar_id":"","url":"https://api.github.com/users/nio-blocks","html_url":"https://github.com/nio-blocks","followers_url":"https://api.github.com/users/nio-blocks/followers","following_url":"https://api.github.com/users/nio-blocks/following{/other_user}","gists_url":"https://api.github.com/users/nio-blocks/gists{/gist_id}","starred_url":"https://api.github.com/users/nio-blocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nio-blocks/subscriptions","organizations_url":"https://api.github.com/users/nio-blocks/orgs","repos_url":"https://api.github.com/users/nio-blocks/repos","events_url":"https://api.github.com/users/nio-blocks/events{/privacy}","received_events_url":"https://api.github.com/users/nio-blocks/received_events","type":"Organization","site_admin":false},"repo":{"id":20943751,"name":"instagram","full_name":"nio-blocks/instagram","owner":{"login":"nio-blocks","id":7684467,"avatar_url":"https://avatars.githubusercontent.com/u/7684467?v=3","gravatar_id":"","url":"https://api.github.com/users/nio-blocks","html_url":"https://github.com/nio-blocks","followers_url":"https://api.github.com/users/nio-blocks/followers","following_url":"https://api.github.com/users/nio-blocks/following{/other_user}","gists_url":"https://api.github.com/users/nio-blocks/gists{/gist_id}","starred_url":"https://api.github.com/users/nio-blocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nio-blocks/subscriptions","organizations_url":"https://api.github.com/users/nio-blocks/orgs","repos_url":"https://api.github.com/users/nio-blocks/repos","events_url":"https://api.github.com/users/nio-blocks/events{/privacy}","received_events_url":"https://api.github.com/users/nio-blocks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nio-blocks/instagram","description":"","fork":false,"url":"https://api.github.com/repos/nio-blocks/instagram","forks_url":"https://api.github.com/repos/nio-blocks/instagram/forks","keys_url":"https://api.github.com/repos/nio-blocks/instagram/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nio-blocks/instagram/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nio-blocks/instagram/teams","hooks_url":"https://api.github.com/repos/nio-blocks/instagram/hooks","issue_events_url":"https://api.github.com/repos/nio-blocks/instagram/issues/events{/number}","events_url":"https://api.github.com/repos/nio-blocks/instagram/events","assignees_url":"https://api.github.com/repos/nio-blocks/instagram/assignees{/user}","branches_url":"https://api.github.com/repos/nio-blocks/instagram/branches{/branch}","tags_url":"https://api.github.com/repos/nio-blocks/instagram/tags","blobs_url":"https://api.github.com/repos/nio-blocks/instagram/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nio-blocks/instagram/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nio-blocks/instagram/git/refs{/sha}","trees_url":"https://api.github.com/repos/nio-blocks/instagram/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nio-blocks/instagram/statuses/{sha}","languages_url":"https://api.github.com/repos/nio-blocks/instagram/languages","stargazers_url":"https://api.github.com/repos/nio-blocks/instagram/stargazers","contributors_url":"https://api.github.com/repos/nio-blocks/instagram/contributors","subscribers_url":"https://api.github.com/repos/nio-blocks/instagram/subscribers","subscription_url":"https://api.github.com/repos/nio-blocks/instagram/subscription","commits_url":"https://api.github.com/repos/nio-blocks/instagram/commits{/sha}","git_commits_url":"https://api.github.com/repos/nio-blocks/instagram/git/commits{/sha}","comments_url":"https://api.github.com/repos/nio-blocks/instagram/comments{/number}","issue_comment_url":"https://api.github.com/repos/nio-blocks/instagram/issues/comments/{number}","contents_url":"https://api.github.com/repos/nio-blocks/instagram/contents/{+path}","compare_url":"https://api.github.com/repos/nio-blocks/instagram/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nio-blocks/instagram/merges","archive_url":"https://api.github.com/repos/nio-blocks/instagram/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nio-blocks/instagram/downloads","issues_url":"https://api.github.com/repos/nio-blocks/instagram/issues{/number}","pulls_url":"https://api.github.com/repos/nio-blocks/instagram/pulls{/number}","milestones_url":"https://api.github.com/repos/nio-blocks/instagram/milestones{/number}","notifications_url":"https://api.github.com/repos/nio-blocks/instagram/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nio-blocks/instagram/labels{/name}","releases_url":"https://api.github.com/repos/nio-blocks/instagram/releases{/id}","created_at":"2014-06-18T00:18:53Z","updated_at":"2015-01-10T01:47:54Z","pushed_at":"2015-01-14T00:09:18Z","git_url":"git://github.com/nio-blocks/instagram.git","ssh_url":"git@github.com:nio-blocks/instagram.git","clone_url":"https://github.com/nio-blocks/instagram.git","svn_url":"https://github.com/nio-blocks/instagram","homepage":null,"size":792,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"nio-blocks:master","ref":"master","sha":"04e6d486425e6767e3224d83675c160824210510","user":{"login":"nio-blocks","id":7684467,"avatar_url":"https://avatars.githubusercontent.com/u/7684467?v=3","gravatar_id":"","url":"https://api.github.com/users/nio-blocks","html_url":"https://github.com/nio-blocks","followers_url":"https://api.github.com/users/nio-blocks/followers","following_url":"https://api.github.com/users/nio-blocks/following{/other_user}","gists_url":"https://api.github.com/users/nio-blocks/gists{/gist_id}","starred_url":"https://api.github.com/users/nio-blocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nio-blocks/subscriptions","organizations_url":"https://api.github.com/users/nio-blocks/orgs","repos_url":"https://api.github.com/users/nio-blocks/repos","events_url":"https://api.github.com/users/nio-blocks/events{/privacy}","received_events_url":"https://api.github.com/users/nio-blocks/received_events","type":"Organization","site_admin":false},"repo":{"id":20943751,"name":"instagram","full_name":"nio-blocks/instagram","owner":{"login":"nio-blocks","id":7684467,"avatar_url":"https://avatars.githubusercontent.com/u/7684467?v=3","gravatar_id":"","url":"https://api.github.com/users/nio-blocks","html_url":"https://github.com/nio-blocks","followers_url":"https://api.github.com/users/nio-blocks/followers","following_url":"https://api.github.com/users/nio-blocks/following{/other_user}","gists_url":"https://api.github.com/users/nio-blocks/gists{/gist_id}","starred_url":"https://api.github.com/users/nio-blocks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nio-blocks/subscriptions","organizations_url":"https://api.github.com/users/nio-blocks/orgs","repos_url":"https://api.github.com/users/nio-blocks/repos","events_url":"https://api.github.com/users/nio-blocks/events{/privacy}","received_events_url":"https://api.github.com/users/nio-blocks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nio-blocks/instagram","description":"","fork":false,"url":"https://api.github.com/repos/nio-blocks/instagram","forks_url":"https://api.github.com/repos/nio-blocks/instagram/forks","keys_url":"https://api.github.com/repos/nio-blocks/instagram/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nio-blocks/instagram/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nio-blocks/instagram/teams","hooks_url":"https://api.github.com/repos/nio-blocks/instagram/hooks","issue_events_url":"https://api.github.com/repos/nio-blocks/instagram/issues/events{/number}","events_url":"https://api.github.com/repos/nio-blocks/instagram/events","assignees_url":"https://api.github.com/repos/nio-blocks/instagram/assignees{/user}","branches_url":"https://api.github.com/repos/nio-blocks/instagram/branches{/branch}","tags_url":"https://api.github.com/repos/nio-blocks/instagram/tags","blobs_url":"https://api.github.com/repos/nio-blocks/instagram/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nio-blocks/instagram/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nio-blocks/instagram/git/refs{/sha}","trees_url":"https://api.github.com/repos/nio-blocks/instagram/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nio-blocks/instagram/statuses/{sha}","languages_url":"https://api.github.com/repos/nio-blocks/instagram/languages","stargazers_url":"https://api.github.com/repos/nio-blocks/instagram/stargazers","contributors_url":"https://api.github.com/repos/nio-blocks/instagram/contributors","subscribers_url":"https://api.github.com/repos/nio-blocks/instagram/subscribers","subscription_url":"https://api.github.com/repos/nio-blocks/instagram/subscription","commits_url":"https://api.github.com/repos/nio-blocks/instagram/commits{/sha}","git_commits_url":"https://api.github.com/repos/nio-blocks/instagram/git/commits{/sha}","comments_url":"https://api.github.com/repos/nio-blocks/instagram/comments{/number}","issue_comment_url":"https://api.github.com/repos/nio-blocks/instagram/issues/comments/{number}","contents_url":"https://api.github.com/repos/nio-blocks/instagram/contents/{+path}","compare_url":"https://api.github.com/repos/nio-blocks/instagram/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nio-blocks/instagram/merges","archive_url":"https://api.github.com/repos/nio-blocks/instagram/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nio-blocks/instagram/downloads","issues_url":"https://api.github.com/repos/nio-blocks/instagram/issues{/number}","pulls_url":"https://api.github.com/repos/nio-blocks/instagram/pulls{/number}","milestones_url":"https://api.github.com/repos/nio-blocks/instagram/milestones{/number}","notifications_url":"https://api.github.com/repos/nio-blocks/instagram/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nio-blocks/instagram/labels{/name}","releases_url":"https://api.github.com/repos/nio-blocks/instagram/releases{/id}","created_at":"2014-06-18T00:18:53Z","updated_at":"2015-01-10T01:47:54Z","pushed_at":"2015-01-14T00:09:18Z","git_url":"git://github.com/nio-blocks/instagram.git","ssh_url":"git@github.com:nio-blocks/instagram.git","clone_url":"https://github.com/nio-blocks/instagram.git","svn_url":"https://github.com/nio-blocks/instagram","homepage":null,"size":792,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nio-blocks/instagram/pulls/17"},"html":{"href":"https://github.com/nio-blocks/instagram/pull/17"},"issue":{"href":"https://api.github.com/repos/nio-blocks/instagram/issues/17"},"comments":{"href":"https://api.github.com/repos/nio-blocks/instagram/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/nio-blocks/instagram/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/nio-blocks/instagram/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/nio-blocks/instagram/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/nio-blocks/instagram/statuses/8c9937e5d92536019340030b9c75b28251a375eb"}}}}