{"action":"created","comment":{"url":"https://api.github.com/repos/scrapy/scrapy/pulls/comments/23169093","id":23169093,"diff_hunk":"@@ -63,6 +63,32 @@ def __call__(self, values):\n         return values\n \n \n+class JsonProcessor(object):\n+    \"\"\"\n+        Given a jmespath, will search for it in the set of scraped values\n+        Requires : jmespath, ast modules\n+    \"\"\"\n+    def __init__(self,jpath):\n+        self.json_path = jpath\n+        \n+    def __call__(self,values):\n+        jsonValues = []\n+        try:\n+            import jmespath,ast,json\n+        except:\n+            print \"JsonProcessor module requires the jmespath library to function. No processing will happen in its abscence\"","path":"scrapy/contrib/loader/processor.py","position":17,"original_position":17,"commit_id":"3b09d2d7576fdb465a08a8740399b62ad92dd4aa","original_commit_id":"3b09d2d7576fdb465a08a8740399b62ad92dd4aa","user":{"login":"nramirezuy","id":1042865,"avatar_url":"https://avatars.githubusercontent.com/u/1042865?v=3","gravatar_id":"","url":"https://api.github.com/users/nramirezuy","html_url":"https://github.com/nramirezuy","followers_url":"https://api.github.com/users/nramirezuy/followers","following_url":"https://api.github.com/users/nramirezuy/following{/other_user}","gists_url":"https://api.github.com/users/nramirezuy/gists{/gist_id}","starred_url":"https://api.github.com/users/nramirezuy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nramirezuy/subscriptions","organizations_url":"https://api.github.com/users/nramirezuy/orgs","repos_url":"https://api.github.com/users/nramirezuy/repos","events_url":"https://api.github.com/users/nramirezuy/events{/privacy}","received_events_url":"https://api.github.com/users/nramirezuy/received_events","type":"User","site_admin":false},"body":"When I said `required`, I meant for the Scrapy library. So it should raise the exception on the import of this Processor.","created_at":"2015-01-19T16:12:30Z","updated_at":"2015-01-19T16:12:30Z","html_url":"https://github.com/scrapy/scrapy/pull/1016#discussion_r23169093","pull_request_url":"https://api.github.com/repos/scrapy/scrapy/pulls/1016","_links":{"self":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/comments/23169093"},"html":{"href":"https://github.com/scrapy/scrapy/pull/1016#discussion_r23169093"},"pull_request":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1016"}}},"pull_request":{"url":"https://api.github.com/repos/scrapy/scrapy/pulls/1016","id":27593818,"html_url":"https://github.com/scrapy/scrapy/pull/1016","diff_url":"https://github.com/scrapy/scrapy/pull/1016.diff","patch_url":"https://github.com/scrapy/scrapy/pull/1016.patch","issue_url":"https://api.github.com/repos/scrapy/scrapy/issues/1016","number":1016,"state":"open","locked":false,"title":"Added a json processor ","user":{"login":"SudShekhar","id":3371824,"avatar_url":"https://avatars.githubusercontent.com/u/3371824?v=3","gravatar_id":"","url":"https://api.github.com/users/SudShekhar","html_url":"https://github.com/SudShekhar","followers_url":"https://api.github.com/users/SudShekhar/followers","following_url":"https://api.github.com/users/SudShekhar/following{/other_user}","gists_url":"https://api.github.com/users/SudShekhar/gists{/gist_id}","starred_url":"https://api.github.com/users/SudShekhar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SudShekhar/subscriptions","organizations_url":"https://api.github.com/users/SudShekhar/orgs","repos_url":"https://api.github.com/users/SudShekhar/repos","events_url":"https://api.github.com/users/SudShekhar/events{/privacy}","received_events_url":"https://api.github.com/users/SudShekhar/received_events","type":"User","site_admin":false},"body":"Created the first implementation of Json processor, any comments/edits are welcome.\r\n\r\nI am currently using the jmespath (https://github.com/boto/jmespath) module to search for paths in the given list of values. I have added some sample test cases too.\r\nThe processor will return the list of values unchanged in case the jmespath module isn't installed. \r\nI wasn't sure how to show a warning message in such a case and thus, have used the python print statement for now. ","created_at":"2015-01-19T09:29:39Z","updated_at":"2015-01-19T16:12:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f5ba4faa21d8c1587d7f526c23b45b5bbeaa1b2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scrapy/scrapy/pulls/1016/commits","review_comments_url":"https://api.github.com/repos/scrapy/scrapy/pulls/1016/comments","review_comment_url":"https://api.github.com/repos/scrapy/scrapy/pulls/comments/{number}","comments_url":"https://api.github.com/repos/scrapy/scrapy/issues/1016/comments","statuses_url":"https://api.github.com/repos/scrapy/scrapy/statuses/3b09d2d7576fdb465a08a8740399b62ad92dd4aa","head":{"label":"SudShekhar:jsonProcessor","ref":"jsonProcessor","sha":"3b09d2d7576fdb465a08a8740399b62ad92dd4aa","user":{"login":"SudShekhar","id":3371824,"avatar_url":"https://avatars.githubusercontent.com/u/3371824?v=3","gravatar_id":"","url":"https://api.github.com/users/SudShekhar","html_url":"https://github.com/SudShekhar","followers_url":"https://api.github.com/users/SudShekhar/followers","following_url":"https://api.github.com/users/SudShekhar/following{/other_user}","gists_url":"https://api.github.com/users/SudShekhar/gists{/gist_id}","starred_url":"https://api.github.com/users/SudShekhar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SudShekhar/subscriptions","organizations_url":"https://api.github.com/users/SudShekhar/orgs","repos_url":"https://api.github.com/users/SudShekhar/repos","events_url":"https://api.github.com/users/SudShekhar/events{/privacy}","received_events_url":"https://api.github.com/users/SudShekhar/received_events","type":"User","site_admin":false},"repo":{"id":29210470,"name":"scrapy","full_name":"SudShekhar/scrapy","owner":{"login":"SudShekhar","id":3371824,"avatar_url":"https://avatars.githubusercontent.com/u/3371824?v=3","gravatar_id":"","url":"https://api.github.com/users/SudShekhar","html_url":"https://github.com/SudShekhar","followers_url":"https://api.github.com/users/SudShekhar/followers","following_url":"https://api.github.com/users/SudShekhar/following{/other_user}","gists_url":"https://api.github.com/users/SudShekhar/gists{/gist_id}","starred_url":"https://api.github.com/users/SudShekhar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SudShekhar/subscriptions","organizations_url":"https://api.github.com/users/SudShekhar/orgs","repos_url":"https://api.github.com/users/SudShekhar/repos","events_url":"https://api.github.com/users/SudShekhar/events{/privacy}","received_events_url":"https://api.github.com/users/SudShekhar/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/SudShekhar/scrapy","description":"Scrapy, a fast high-level screen scraping and web crawling framework for Python.","fork":true,"url":"https://api.github.com/repos/SudShekhar/scrapy","forks_url":"https://api.github.com/repos/SudShekhar/scrapy/forks","keys_url":"https://api.github.com/repos/SudShekhar/scrapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SudShekhar/scrapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SudShekhar/scrapy/teams","hooks_url":"https://api.github.com/repos/SudShekhar/scrapy/hooks","issue_events_url":"https://api.github.com/repos/SudShekhar/scrapy/issues/events{/number}","events_url":"https://api.github.com/repos/SudShekhar/scrapy/events","assignees_url":"https://api.github.com/repos/SudShekhar/scrapy/assignees{/user}","branches_url":"https://api.github.com/repos/SudShekhar/scrapy/branches{/branch}","tags_url":"https://api.github.com/repos/SudShekhar/scrapy/tags","blobs_url":"https://api.github.com/repos/SudShekhar/scrapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SudShekhar/scrapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SudShekhar/scrapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/SudShekhar/scrapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SudShekhar/scrapy/statuses/{sha}","languages_url":"https://api.github.com/repos/SudShekhar/scrapy/languages","stargazers_url":"https://api.github.com/repos/SudShekhar/scrapy/stargazers","contributors_url":"https://api.github.com/repos/SudShekhar/scrapy/contributors","subscribers_url":"https://api.github.com/repos/SudShekhar/scrapy/subscribers","subscription_url":"https://api.github.com/repos/SudShekhar/scrapy/subscription","commits_url":"https://api.github.com/repos/SudShekhar/scrapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/SudShekhar/scrapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/SudShekhar/scrapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/SudShekhar/scrapy/issues/comments/{number}","contents_url":"https://api.github.com/repos/SudShekhar/scrapy/contents/{+path}","compare_url":"https://api.github.com/repos/SudShekhar/scrapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SudShekhar/scrapy/merges","archive_url":"https://api.github.com/repos/SudShekhar/scrapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SudShekhar/scrapy/downloads","issues_url":"https://api.github.com/repos/SudShekhar/scrapy/issues{/number}","pulls_url":"https://api.github.com/repos/SudShekhar/scrapy/pulls{/number}","milestones_url":"https://api.github.com/repos/SudShekhar/scrapy/milestones{/number}","notifications_url":"https://api.github.com/repos/SudShekhar/scrapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SudShekhar/scrapy/labels{/name}","releases_url":"https://api.github.com/repos/SudShekhar/scrapy/releases{/id}","created_at":"2015-01-13T20:52:41Z","updated_at":"2015-01-19T09:08:13Z","pushed_at":"2015-01-19T10:18:04Z","git_url":"git://github.com/SudShekhar/scrapy.git","ssh_url":"git@github.com:SudShekhar/scrapy.git","clone_url":"https://github.com/SudShekhar/scrapy.git","svn_url":"https://github.com/SudShekhar/scrapy","homepage":"http://scrapy.org","size":22145,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"scrapy:master","ref":"master","sha":"f3110aaed138cde754d107ffc59ab3ca4fb22e6c","user":{"login":"scrapy","id":733635,"avatar_url":"https://avatars.githubusercontent.com/u/733635?v=3","gravatar_id":"","url":"https://api.github.com/users/scrapy","html_url":"https://github.com/scrapy","followers_url":"https://api.github.com/users/scrapy/followers","following_url":"https://api.github.com/users/scrapy/following{/other_user}","gists_url":"https://api.github.com/users/scrapy/gists{/gist_id}","starred_url":"https://api.github.com/users/scrapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrapy/subscriptions","organizations_url":"https://api.github.com/users/scrapy/orgs","repos_url":"https://api.github.com/users/scrapy/repos","events_url":"https://api.github.com/users/scrapy/events{/privacy}","received_events_url":"https://api.github.com/users/scrapy/received_events","type":"Organization","site_admin":false},"repo":{"id":529502,"name":"scrapy","full_name":"scrapy/scrapy","owner":{"login":"scrapy","id":733635,"avatar_url":"https://avatars.githubusercontent.com/u/733635?v=3","gravatar_id":"","url":"https://api.github.com/users/scrapy","html_url":"https://github.com/scrapy","followers_url":"https://api.github.com/users/scrapy/followers","following_url":"https://api.github.com/users/scrapy/following{/other_user}","gists_url":"https://api.github.com/users/scrapy/gists{/gist_id}","starred_url":"https://api.github.com/users/scrapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scrapy/subscriptions","organizations_url":"https://api.github.com/users/scrapy/orgs","repos_url":"https://api.github.com/users/scrapy/repos","events_url":"https://api.github.com/users/scrapy/events{/privacy}","received_events_url":"https://api.github.com/users/scrapy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scrapy/scrapy","description":"Scrapy, a fast high-level screen scraping and web crawling framework for Python.","fork":false,"url":"https://api.github.com/repos/scrapy/scrapy","forks_url":"https://api.github.com/repos/scrapy/scrapy/forks","keys_url":"https://api.github.com/repos/scrapy/scrapy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scrapy/scrapy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scrapy/scrapy/teams","hooks_url":"https://api.github.com/repos/scrapy/scrapy/hooks","issue_events_url":"https://api.github.com/repos/scrapy/scrapy/issues/events{/number}","events_url":"https://api.github.com/repos/scrapy/scrapy/events","assignees_url":"https://api.github.com/repos/scrapy/scrapy/assignees{/user}","branches_url":"https://api.github.com/repos/scrapy/scrapy/branches{/branch}","tags_url":"https://api.github.com/repos/scrapy/scrapy/tags","blobs_url":"https://api.github.com/repos/scrapy/scrapy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scrapy/scrapy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scrapy/scrapy/git/refs{/sha}","trees_url":"https://api.github.com/repos/scrapy/scrapy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scrapy/scrapy/statuses/{sha}","languages_url":"https://api.github.com/repos/scrapy/scrapy/languages","stargazers_url":"https://api.github.com/repos/scrapy/scrapy/stargazers","contributors_url":"https://api.github.com/repos/scrapy/scrapy/contributors","subscribers_url":"https://api.github.com/repos/scrapy/scrapy/subscribers","subscription_url":"https://api.github.com/repos/scrapy/scrapy/subscription","commits_url":"https://api.github.com/repos/scrapy/scrapy/commits{/sha}","git_commits_url":"https://api.github.com/repos/scrapy/scrapy/git/commits{/sha}","comments_url":"https://api.github.com/repos/scrapy/scrapy/comments{/number}","issue_comment_url":"https://api.github.com/repos/scrapy/scrapy/issues/comments/{number}","contents_url":"https://api.github.com/repos/scrapy/scrapy/contents/{+path}","compare_url":"https://api.github.com/repos/scrapy/scrapy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scrapy/scrapy/merges","archive_url":"https://api.github.com/repos/scrapy/scrapy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scrapy/scrapy/downloads","issues_url":"https://api.github.com/repos/scrapy/scrapy/issues{/number}","pulls_url":"https://api.github.com/repos/scrapy/scrapy/pulls{/number}","milestones_url":"https://api.github.com/repos/scrapy/scrapy/milestones{/number}","notifications_url":"https://api.github.com/repos/scrapy/scrapy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scrapy/scrapy/labels{/name}","releases_url":"https://api.github.com/repos/scrapy/scrapy/releases{/id}","created_at":"2010-02-22T02:01:14Z","updated_at":"2015-01-19T15:57:19Z","pushed_at":"2015-01-19T15:57:18Z","git_url":"git://github.com/scrapy/scrapy.git","ssh_url":"git@github.com:scrapy/scrapy.git","clone_url":"https://github.com/scrapy/scrapy.git","svn_url":"https://github.com/scrapy/scrapy","homepage":"http://scrapy.org","size":22145,"stargazers_count":7104,"watchers_count":7104,"language":"Python","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":1981,"mirror_url":null,"open_issues_count":208,"forks":1981,"open_issues":208,"watchers":7104,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1016"},"html":{"href":"https://github.com/scrapy/scrapy/pull/1016"},"issue":{"href":"https://api.github.com/repos/scrapy/scrapy/issues/1016"},"comments":{"href":"https://api.github.com/repos/scrapy/scrapy/issues/1016/comments"},"review_comments":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1016/comments"},"review_comment":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/scrapy/scrapy/pulls/1016/commits"},"statuses":{"href":"https://api.github.com/repos/scrapy/scrapy/statuses/3b09d2d7576fdb465a08a8740399b62ad92dd4aa"}}}}