{"action":"created","comment":{"url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/pulls/comments/92670475","pull_request_review_id":13190512,"id":92670475,"diff_hunk":"@@ -0,0 +1,104 @@\n+import os\n+import json\n+import datetime\n+import time\n+import pandas as pd\n+from unicodedata import normalize\n+from selenium import webdriver\n+from bs4 import BeautifulSoup\n+\n+\n+def selenium_driver_path():\n+    for path in ['chromedriver.exe', 'chromedriver']:\n+        if os.path.exists(path):\n+            return path\n+    raise BaseException('ChromeDriver not found')\n+\n+\n+def normalize_name(name):\n+    return normalize('NFKD', name).encode('ASCII', 'ignore').decode('utf-8').lower()\n+\n+\n+def make_google_cache_url(name):\n+    return 'http://webcache.googleusercontent.com/search?btnG=Search&q=cache:www.consultasocio.com/q/sa/%s' % \\\n+           normalize_name(name).replace(' ', '-')\n+\n+\n+def make_consulta_socio_url(name):\n+    return 'http://www.consultasocio.com/q/sa/%s' % normalize_name(name).replace(' ', '-')\n+\n+\n+def extract_info_from_page(url, info, driver, error_msg):\n+    # Open the page using Selenium in order to collect the full HTML to be parsed by BeautifulSoup\n+    driver.get(url)\n+    driver.switch_to.default_content()\n+    soup = BeautifulSoup(driver.page_source, 'html.parser')\n+\n+    # Somethimes google can ask for captcha, so you should type it!\n+    if 'To continue, please type the characters below:' in soup.text:\n+        while 'To continue, please type the characters below:' in soup.text:\n+            driver.switch_to.default_content()\n+            soup = BeautifulSoup(driver.page_source, 'html.parser')\n+            time.sleep(1)","path":"src/fetch_business_partners_info.py","position":42,"original_position":42,"commit_id":"bc841dc2e013f06f41706a45eecd737b6bf1a288","original_commit_id":"bc841dc2e013f06f41706a45eecd737b6bf1a288","user":{"login":"thiagobrito","id":4764040,"avatar_url":"https://avatars.githubusercontent.com/u/4764040?v=3","gravatar_id":"","url":"https://api.github.com/users/thiagobrito","html_url":"https://github.com/thiagobrito","followers_url":"https://api.github.com/users/thiagobrito/followers","following_url":"https://api.github.com/users/thiagobrito/following{/other_user}","gists_url":"https://api.github.com/users/thiagobrito/gists{/gist_id}","starred_url":"https://api.github.com/users/thiagobrito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thiagobrito/subscriptions","organizations_url":"https://api.github.com/users/thiagobrito/orgs","repos_url":"https://api.github.com/users/thiagobrito/repos","events_url":"https://api.github.com/users/thiagobrito/events{/privacy}","received_events_url":"https://api.github.com/users/thiagobrito/received_events","type":"User","site_admin":false},"body":"In this case, with google captcha, it's hard to automate. It's the only way that I found in order to fix it.","created_at":"2016-12-15T18:32:05Z","updated_at":"2016-12-15T18:32:05Z","html_url":"https://github.com/datasciencebr/serenata-de-amor/pull/168#discussion_r92670475","pull_request_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/pulls/168","_links":{"self":{"href":"https://api.github.com/repos/datasciencebr/serenata-de-amor/pulls/comments/92670475"},"html":{"href":"https://github.com/datasciencebr/serenata-de-amor/pull/168#discussion_r92670475"},"pull_request":{"href":"https://api.github.com/repos/datasciencebr/serenata-de-amor/pulls/168"}}},"pull_request":{"url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/pulls/168","id":98147541,"html_url":"https://github.com/datasciencebr/serenata-de-amor/pull/168","diff_url":"https://github.com/datasciencebr/serenata-de-amor/pull/168.diff","patch_url":"https://github.com/datasciencebr/serenata-de-amor/pull/168.patch","issue_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/issues/168","number":168,"state":"open","locked":false,"title":"Find expenses made with companies of relatives","user":{"login":"thiagobrito","id":4764040,"avatar_url":"https://avatars.githubusercontent.com/u/4764040?v=3","gravatar_id":"","url":"https://api.github.com/users/thiagobrito","html_url":"https://github.com/thiagobrito","followers_url":"https://api.github.com/users/thiagobrito/followers","following_url":"https://api.github.com/users/thiagobrito/following{/other_user}","gists_url":"https://api.github.com/users/thiagobrito/gists{/gist_id}","starred_url":"https://api.github.com/users/thiagobrito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thiagobrito/subscriptions","organizations_url":"https://api.github.com/users/thiagobrito/orgs","repos_url":"https://api.github.com/users/thiagobrito/repos","events_url":"https://api.github.com/users/thiagobrito/events{/privacy}","received_events_url":"https://api.github.com/users/thiagobrito/received_events","type":"User","site_admin":false},"body":"This pull request tries to close the issue #17.\r\n\r\nI created this notebook in order to show all the spends that are relative to family companies spends.\r\n\r\nIn order to collect the database you must use the files:\r\n\r\n- src/fetch_business_partners_info.py: This file collects all the information from ConsultaSocio.com using Google Cache and the website (until you get locked out).\r\n\r\nBecause takes a long time and work to download all ConsultaSocio.com and fetch all CNPJ information, I'll put my database as an attachment in this pull request and you should extract these files in ./data/ directory.\r\n\r\n[data.zip](https://github.com/datasciencebr/serenata-de-amor/files/654696/data.zip)\r\n\r\nThis is my first contribution and hope to have a lot more and more. I see a lot of space to improve some areas of the code and I'll work on this soon.\r\n\r\n\r\n","created_at":"2016-12-15T13:09:41Z","updated_at":"2016-12-15T18:32:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"adc9020216dc328e5cbefd1bbe3a27332a956bf3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/pulls/168/commits","review_comments_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/pulls/168/comments","review_comment_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/pulls/comments{/number}","comments_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/issues/168/comments","statuses_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/statuses/bc841dc2e013f06f41706a45eecd737b6bf1a288","head":{"label":"thiagobrito:nepotism-spends","ref":"nepotism-spends","sha":"bc841dc2e013f06f41706a45eecd737b6bf1a288","user":{"login":"thiagobrito","id":4764040,"avatar_url":"https://avatars.githubusercontent.com/u/4764040?v=3","gravatar_id":"","url":"https://api.github.com/users/thiagobrito","html_url":"https://github.com/thiagobrito","followers_url":"https://api.github.com/users/thiagobrito/followers","following_url":"https://api.github.com/users/thiagobrito/following{/other_user}","gists_url":"https://api.github.com/users/thiagobrito/gists{/gist_id}","starred_url":"https://api.github.com/users/thiagobrito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thiagobrito/subscriptions","organizations_url":"https://api.github.com/users/thiagobrito/orgs","repos_url":"https://api.github.com/users/thiagobrito/repos","events_url":"https://api.github.com/users/thiagobrito/events{/privacy}","received_events_url":"https://api.github.com/users/thiagobrito/received_events","type":"User","site_admin":false},"repo":{"id":75764619,"name":"serenata-de-amor","full_name":"thiagobrito/serenata-de-amor","owner":{"login":"thiagobrito","id":4764040,"avatar_url":"https://avatars.githubusercontent.com/u/4764040?v=3","gravatar_id":"","url":"https://api.github.com/users/thiagobrito","html_url":"https://github.com/thiagobrito","followers_url":"https://api.github.com/users/thiagobrito/followers","following_url":"https://api.github.com/users/thiagobrito/following{/other_user}","gists_url":"https://api.github.com/users/thiagobrito/gists{/gist_id}","starred_url":"https://api.github.com/users/thiagobrito/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thiagobrito/subscriptions","organizations_url":"https://api.github.com/users/thiagobrito/orgs","repos_url":"https://api.github.com/users/thiagobrito/repos","events_url":"https://api.github.com/users/thiagobrito/events{/privacy}","received_events_url":"https://api.github.com/users/thiagobrito/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/thiagobrito/serenata-de-amor","description":"🕵 Fighting corruption with data and SCIENCE!","fork":true,"url":"https://api.github.com/repos/thiagobrito/serenata-de-amor","forks_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/forks","keys_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/teams","hooks_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/hooks","issue_events_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/issues/events{/number}","events_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/events","assignees_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/assignees{/user}","branches_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/branches{/branch}","tags_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/tags","blobs_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/git/refs{/sha}","trees_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/statuses/{sha}","languages_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/languages","stargazers_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/stargazers","contributors_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/contributors","subscribers_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/subscribers","subscription_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/subscription","commits_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/commits{/sha}","git_commits_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/git/commits{/sha}","comments_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/comments{/number}","issue_comment_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/issues/comments{/number}","contents_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/contents/{+path}","compare_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/merges","archive_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/downloads","issues_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/issues{/number}","pulls_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/pulls{/number}","milestones_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/milestones{/number}","notifications_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/labels{/name}","releases_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/releases{/id}","deployments_url":"https://api.github.com/repos/thiagobrito/serenata-de-amor/deployments","created_at":"2016-12-06T19:36:43Z","updated_at":"2016-12-06T19:36:45Z","pushed_at":"2016-12-15T13:00:15Z","git_url":"git://github.com/thiagobrito/serenata-de-amor.git","ssh_url":"git@github.com:thiagobrito/serenata-de-amor.git","clone_url":"https://github.com/thiagobrito/serenata-de-amor.git","svn_url":"https://github.com/thiagobrito/serenata-de-amor","homepage":"http://serenata.datasciencebr.com/","size":27004,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"datasciencebr:master","ref":"master","sha":"a599fe339b4cd13a2b9c56e4f2521caa16f55973","user":{"login":"datasciencebr","id":20269426,"avatar_url":"https://avatars.githubusercontent.com/u/20269426?v=3","gravatar_id":"","url":"https://api.github.com/users/datasciencebr","html_url":"https://github.com/datasciencebr","followers_url":"https://api.github.com/users/datasciencebr/followers","following_url":"https://api.github.com/users/datasciencebr/following{/other_user}","gists_url":"https://api.github.com/users/datasciencebr/gists{/gist_id}","starred_url":"https://api.github.com/users/datasciencebr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datasciencebr/subscriptions","organizations_url":"https://api.github.com/users/datasciencebr/orgs","repos_url":"https://api.github.com/users/datasciencebr/repos","events_url":"https://api.github.com/users/datasciencebr/events{/privacy}","received_events_url":"https://api.github.com/users/datasciencebr/received_events","type":"Organization","site_admin":false},"repo":{"id":62087567,"name":"serenata-de-amor","full_name":"datasciencebr/serenata-de-amor","owner":{"login":"datasciencebr","id":20269426,"avatar_url":"https://avatars.githubusercontent.com/u/20269426?v=3","gravatar_id":"","url":"https://api.github.com/users/datasciencebr","html_url":"https://github.com/datasciencebr","followers_url":"https://api.github.com/users/datasciencebr/followers","following_url":"https://api.github.com/users/datasciencebr/following{/other_user}","gists_url":"https://api.github.com/users/datasciencebr/gists{/gist_id}","starred_url":"https://api.github.com/users/datasciencebr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/datasciencebr/subscriptions","organizations_url":"https://api.github.com/users/datasciencebr/orgs","repos_url":"https://api.github.com/users/datasciencebr/repos","events_url":"https://api.github.com/users/datasciencebr/events{/privacy}","received_events_url":"https://api.github.com/users/datasciencebr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/datasciencebr/serenata-de-amor","description":"🕵 Fighting corruption with data and SCIENCE!","fork":false,"url":"https://api.github.com/repos/datasciencebr/serenata-de-amor","forks_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/forks","keys_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/keys{/key_id}","collaborators_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/teams","hooks_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/hooks","issue_events_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/issues/events{/number}","events_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/events","assignees_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/assignees{/user}","branches_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/branches{/branch}","tags_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/tags","blobs_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/git/refs{/sha}","trees_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/git/trees{/sha}","statuses_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/statuses/{sha}","languages_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/languages","stargazers_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/stargazers","contributors_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/contributors","subscribers_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/subscribers","subscription_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/subscription","commits_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/commits{/sha}","git_commits_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/git/commits{/sha}","comments_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/comments{/number}","issue_comment_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/issues/comments{/number}","contents_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/contents/{+path}","compare_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/compare/{base}...{head}","merges_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/merges","archive_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/downloads","issues_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/issues{/number}","pulls_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/pulls{/number}","milestones_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/milestones{/number}","notifications_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/labels{/name}","releases_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/releases{/id}","deployments_url":"https://api.github.com/repos/datasciencebr/serenata-de-amor/deployments","created_at":"2016-06-27T20:55:11Z","updated_at":"2016-12-15T18:16:15Z","pushed_at":"2016-12-15T13:09:41Z","git_url":"git://github.com/datasciencebr/serenata-de-amor.git","ssh_url":"git@github.com:datasciencebr/serenata-de-amor.git","clone_url":"https://github.com/datasciencebr/serenata-de-amor.git","svn_url":"https://github.com/datasciencebr/serenata-de-amor","homepage":"http://serenata.datasciencebr.com/","size":26984,"stargazers_count":1421,"watchers_count":1421,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":263,"mirror_url":null,"open_issues_count":46,"forks":263,"open_issues":46,"watchers":1421,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/datasciencebr/serenata-de-amor/pulls/168"},"html":{"href":"https://github.com/datasciencebr/serenata-de-amor/pull/168"},"issue":{"href":"https://api.github.com/repos/datasciencebr/serenata-de-amor/issues/168"},"comments":{"href":"https://api.github.com/repos/datasciencebr/serenata-de-amor/issues/168/comments"},"review_comments":{"href":"https://api.github.com/repos/datasciencebr/serenata-de-amor/pulls/168/comments"},"review_comment":{"href":"https://api.github.com/repos/datasciencebr/serenata-de-amor/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/datasciencebr/serenata-de-amor/pulls/168/commits"},"statuses":{"href":"https://api.github.com/repos/datasciencebr/serenata-de-amor/statuses/bc841dc2e013f06f41706a45eecd737b6bf1a288"}}}}
{"actor":{"display_login":"thiagobrito"}}