{"action":"created","comment":{"url":"https://api.github.com/repos/CoSoECP/CoSo/pulls/comments/100690513","pull_request_review_id":21405882,"id":100690513,"diff_hunk":"@@ -17,6 +28,75 @@ def sondage_2012(request):\n         if len(cells) == 14:\n             for i in range(len(data)):\n                 data[i].append(cells[i].get_text())\n+    return HttpResponse(\"Hello, we've done the scrapping\")\n+\n+\n+def import_trends(request_content):\n+\n+    vecteur = request_content[0]\n+    pays = request_content[1]\n+    date = request_content[2]\n+\n+    # connect to Google\n+    pytrend = TrendReq(google_username, google_password, custom_useragent='My Coso Script')\n+\n+\n+    trend_payload = {'q': vecteur, 'hl': 'fr-FR', 'geo': pays,'date': date + ' 2m'}\n+\n+    # trend\n+    trend = pytrend.trend(trend_payload)\n+    df = pytrend.trend(trend_payload, return_type='dataframe')\n+    return(df)\n+\n+\n+\n+def new_election():\n+    _place, created = Place.objects.get_or_create(country=\"France\")\n+    _election, created = Election.objects.get_or_create(date=datetime.datetime(2016,12,22), place_id = _place.id)\n+    _candidate1, created = Candidate.objects.get_or_create(name=\"Valls\", surname = \"Manuel\", birth_date=datetime.datetime(1968,12,05), birth_place_id= _place.id, nationality_id= _place.id)\n+    _candidate2, created = Candidate.objects.get_or_create(name=\"Peillon\", surname = \"Vincent\", birth_date=datetime.datetime(1968,12,05), birth_place_id= _place.id, nationality_id= _place.id)\n+    _result1, created = Result.objects.get_or_create(election_id = _election.id, candidate_id = _candidate1.id)\n+    _result2, created = Result.objects.get_or_create(election_id = _election.id, candidate_id = _candidate2.id)\n+    \n \n \n-    return HttpResponse(\"Hello, we've done the scrapping.\")\n+def analysis_from_google(request, election_id):\n+    #elections = Election.objects.all()\n+    elections = [Election.objects.get(id=election_id)]\n+    _twitter, created = TrendSource.objects.get_or_create(name = \"Twitter\")\n+    total = 0.00\n+    data=[]\n+    for election in elections:\n+        request_content = []\n+        liste_candidat = []\n+        candidats=election.candidates.all()\n+        for candidat in candidats:\n+            liste_candidat.append(candidat.surname + \" \" + candidat.name)\n+        vecteur_candidat=\", \".join(liste_candidat)\n+        date=election.date\n+        mois = date.month\n+        annee=date.year\n+        #if date.month > 1:\n+        #    mois = date.month - 1\n+        #    annee=date.year\n+        #else:\n+        #    mois = 12\n+        #    annee=date.year - 1\n+        date_temp=[str(mois),str(annee)]","path":"coso/polls/views.py","position":77,"original_position":77,"commit_id":"5173d9c29cf5165334a86b0052d71ae634410974","original_commit_id":"5173d9c29cf5165334a86b0052d71ae634410974","user":{"login":"melaniebrd","id":13996079,"avatar_url":"https://avatars.githubusercontent.com/u/13996079?v=3","gravatar_id":"","url":"https://api.github.com/users/melaniebrd","html_url":"https://github.com/melaniebrd","followers_url":"https://api.github.com/users/melaniebrd/followers","following_url":"https://api.github.com/users/melaniebrd/following{/other_user}","gists_url":"https://api.github.com/users/melaniebrd/gists{/gist_id}","starred_url":"https://api.github.com/users/melaniebrd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melaniebrd/subscriptions","organizations_url":"https://api.github.com/users/melaniebrd/orgs","repos_url":"https://api.github.com/users/melaniebrd/repos","events_url":"https://api.github.com/users/melaniebrd/events{/privacy}","received_events_url":"https://api.github.com/users/melaniebrd/received_events","type":"User","site_admin":false},"body":"Il faut retirer les commentaires :p ","created_at":"2017-02-12T12:17:07Z","updated_at":"2017-02-12T12:18:13Z","html_url":"https://github.com/CoSoECP/CoSo/pull/10#discussion_r100690513","pull_request_url":"https://api.github.com/repos/CoSoECP/CoSo/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/CoSoECP/CoSo/pulls/comments/100690513"},"html":{"href":"https://github.com/CoSoECP/CoSo/pull/10#discussion_r100690513"},"pull_request":{"href":"https://api.github.com/repos/CoSoECP/CoSo/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/CoSoECP/CoSo/pulls/10","id":105788872,"html_url":"https://github.com/CoSoECP/CoSo/pull/10","diff_url":"https://github.com/CoSoECP/CoSo/pull/10.diff","patch_url":"https://github.com/CoSoECP/CoSo/pull/10.patch","issue_url":"https://api.github.com/repos/CoSoECP/CoSo/issues/10","number":10,"state":"open","locked":false,"title":"Trends","user":{"login":"NicolasParent","id":9193905,"avatar_url":"https://avatars.githubusercontent.com/u/9193905?v=3","gravatar_id":"","url":"https://api.github.com/users/NicolasParent","html_url":"https://github.com/NicolasParent","followers_url":"https://api.github.com/users/NicolasParent/followers","following_url":"https://api.github.com/users/NicolasParent/following{/other_user}","gists_url":"https://api.github.com/users/NicolasParent/gists{/gist_id}","starred_url":"https://api.github.com/users/NicolasParent/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NicolasParent/subscriptions","organizations_url":"https://api.github.com/users/NicolasParent/orgs","repos_url":"https://api.github.com/users/NicolasParent/repos","events_url":"https://api.github.com/users/NicolasParent/events{/privacy}","received_events_url":"https://api.github.com/users/NicolasParent/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-02-12T12:04:39Z","updated_at":"2017-02-12T12:18:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe1c65b4571da77b8ac58c552cd3d453a98e7d31","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/CoSoECP/CoSo/pulls/10/commits","review_comments_url":"https://api.github.com/repos/CoSoECP/CoSo/pulls/10/comments","review_comment_url":"https://api.github.com/repos/CoSoECP/CoSo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CoSoECP/CoSo/issues/10/comments","statuses_url":"https://api.github.com/repos/CoSoECP/CoSo/statuses/5173d9c29cf5165334a86b0052d71ae634410974","head":{"label":"CoSoECP:trends","ref":"trends","sha":"5173d9c29cf5165334a86b0052d71ae634410974","user":{"login":"CoSoECP","id":24222269,"avatar_url":"https://avatars.githubusercontent.com/u/24222269?v=3","gravatar_id":"","url":"https://api.github.com/users/CoSoECP","html_url":"https://github.com/CoSoECP","followers_url":"https://api.github.com/users/CoSoECP/followers","following_url":"https://api.github.com/users/CoSoECP/following{/other_user}","gists_url":"https://api.github.com/users/CoSoECP/gists{/gist_id}","starred_url":"https://api.github.com/users/CoSoECP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CoSoECP/subscriptions","organizations_url":"https://api.github.com/users/CoSoECP/orgs","repos_url":"https://api.github.com/users/CoSoECP/repos","events_url":"https://api.github.com/users/CoSoECP/events{/privacy}","received_events_url":"https://api.github.com/users/CoSoECP/received_events","type":"Organization","site_admin":false},"repo":{"id":74959208,"name":"CoSo","full_name":"CoSoECP/CoSo","owner":{"login":"CoSoECP","id":24222269,"avatar_url":"https://avatars.githubusercontent.com/u/24222269?v=3","gravatar_id":"","url":"https://api.github.com/users/CoSoECP","html_url":"https://github.com/CoSoECP","followers_url":"https://api.github.com/users/CoSoECP/followers","following_url":"https://api.github.com/users/CoSoECP/following{/other_user}","gists_url":"https://api.github.com/users/CoSoECP/gists{/gist_id}","starred_url":"https://api.github.com/users/CoSoECP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CoSoECP/subscriptions","organizations_url":"https://api.github.com/users/CoSoECP/orgs","repos_url":"https://api.github.com/users/CoSoECP/repos","events_url":"https://api.github.com/users/CoSoECP/events{/privacy}","received_events_url":"https://api.github.com/users/CoSoECP/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CoSoECP/CoSo","description":"Software Engineering Project for School - Polls Behaviour (Comportement Sondage)","fork":false,"url":"https://api.github.com/repos/CoSoECP/CoSo","forks_url":"https://api.github.com/repos/CoSoECP/CoSo/forks","keys_url":"https://api.github.com/repos/CoSoECP/CoSo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CoSoECP/CoSo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CoSoECP/CoSo/teams","hooks_url":"https://api.github.com/repos/CoSoECP/CoSo/hooks","issue_events_url":"https://api.github.com/repos/CoSoECP/CoSo/issues/events{/number}","events_url":"https://api.github.com/repos/CoSoECP/CoSo/events","assignees_url":"https://api.github.com/repos/CoSoECP/CoSo/assignees{/user}","branches_url":"https://api.github.com/repos/CoSoECP/CoSo/branches{/branch}","tags_url":"https://api.github.com/repos/CoSoECP/CoSo/tags","blobs_url":"https://api.github.com/repos/CoSoECP/CoSo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CoSoECP/CoSo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CoSoECP/CoSo/git/refs{/sha}","trees_url":"https://api.github.com/repos/CoSoECP/CoSo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CoSoECP/CoSo/statuses/{sha}","languages_url":"https://api.github.com/repos/CoSoECP/CoSo/languages","stargazers_url":"https://api.github.com/repos/CoSoECP/CoSo/stargazers","contributors_url":"https://api.github.com/repos/CoSoECP/CoSo/contributors","subscribers_url":"https://api.github.com/repos/CoSoECP/CoSo/subscribers","subscription_url":"https://api.github.com/repos/CoSoECP/CoSo/subscription","commits_url":"https://api.github.com/repos/CoSoECP/CoSo/commits{/sha}","git_commits_url":"https://api.github.com/repos/CoSoECP/CoSo/git/commits{/sha}","comments_url":"https://api.github.com/repos/CoSoECP/CoSo/comments{/number}","issue_comment_url":"https://api.github.com/repos/CoSoECP/CoSo/issues/comments{/number}","contents_url":"https://api.github.com/repos/CoSoECP/CoSo/contents/{+path}","compare_url":"https://api.github.com/repos/CoSoECP/CoSo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CoSoECP/CoSo/merges","archive_url":"https://api.github.com/repos/CoSoECP/CoSo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CoSoECP/CoSo/downloads","issues_url":"https://api.github.com/repos/CoSoECP/CoSo/issues{/number}","pulls_url":"https://api.github.com/repos/CoSoECP/CoSo/pulls{/number}","milestones_url":"https://api.github.com/repos/CoSoECP/CoSo/milestones{/number}","notifications_url":"https://api.github.com/repos/CoSoECP/CoSo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CoSoECP/CoSo/labels{/name}","releases_url":"https://api.github.com/repos/CoSoECP/CoSo/releases{/id}","deployments_url":"https://api.github.com/repos/CoSoECP/CoSo/deployments","created_at":"2016-11-28T09:52:23Z","updated_at":"2016-12-04T21:53:02Z","pushed_at":"2017-02-12T12:04:39Z","git_url":"git://github.com/CoSoECP/CoSo.git","ssh_url":"git@github.com:CoSoECP/CoSo.git","clone_url":"https://github.com/CoSoECP/CoSo.git","svn_url":"https://github.com/CoSoECP/CoSo","homepage":"","size":1020,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"CoSoECP:master","ref":"master","sha":"3dd348ea5271114caef06364213b6ebfc24e86de","user":{"login":"CoSoECP","id":24222269,"avatar_url":"https://avatars.githubusercontent.com/u/24222269?v=3","gravatar_id":"","url":"https://api.github.com/users/CoSoECP","html_url":"https://github.com/CoSoECP","followers_url":"https://api.github.com/users/CoSoECP/followers","following_url":"https://api.github.com/users/CoSoECP/following{/other_user}","gists_url":"https://api.github.com/users/CoSoECP/gists{/gist_id}","starred_url":"https://api.github.com/users/CoSoECP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CoSoECP/subscriptions","organizations_url":"https://api.github.com/users/CoSoECP/orgs","repos_url":"https://api.github.com/users/CoSoECP/repos","events_url":"https://api.github.com/users/CoSoECP/events{/privacy}","received_events_url":"https://api.github.com/users/CoSoECP/received_events","type":"Organization","site_admin":false},"repo":{"id":74959208,"name":"CoSo","full_name":"CoSoECP/CoSo","owner":{"login":"CoSoECP","id":24222269,"avatar_url":"https://avatars.githubusercontent.com/u/24222269?v=3","gravatar_id":"","url":"https://api.github.com/users/CoSoECP","html_url":"https://github.com/CoSoECP","followers_url":"https://api.github.com/users/CoSoECP/followers","following_url":"https://api.github.com/users/CoSoECP/following{/other_user}","gists_url":"https://api.github.com/users/CoSoECP/gists{/gist_id}","starred_url":"https://api.github.com/users/CoSoECP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CoSoECP/subscriptions","organizations_url":"https://api.github.com/users/CoSoECP/orgs","repos_url":"https://api.github.com/users/CoSoECP/repos","events_url":"https://api.github.com/users/CoSoECP/events{/privacy}","received_events_url":"https://api.github.com/users/CoSoECP/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CoSoECP/CoSo","description":"Software Engineering Project for School - Polls Behaviour (Comportement Sondage)","fork":false,"url":"https://api.github.com/repos/CoSoECP/CoSo","forks_url":"https://api.github.com/repos/CoSoECP/CoSo/forks","keys_url":"https://api.github.com/repos/CoSoECP/CoSo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CoSoECP/CoSo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CoSoECP/CoSo/teams","hooks_url":"https://api.github.com/repos/CoSoECP/CoSo/hooks","issue_events_url":"https://api.github.com/repos/CoSoECP/CoSo/issues/events{/number}","events_url":"https://api.github.com/repos/CoSoECP/CoSo/events","assignees_url":"https://api.github.com/repos/CoSoECP/CoSo/assignees{/user}","branches_url":"https://api.github.com/repos/CoSoECP/CoSo/branches{/branch}","tags_url":"https://api.github.com/repos/CoSoECP/CoSo/tags","blobs_url":"https://api.github.com/repos/CoSoECP/CoSo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CoSoECP/CoSo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CoSoECP/CoSo/git/refs{/sha}","trees_url":"https://api.github.com/repos/CoSoECP/CoSo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CoSoECP/CoSo/statuses/{sha}","languages_url":"https://api.github.com/repos/CoSoECP/CoSo/languages","stargazers_url":"https://api.github.com/repos/CoSoECP/CoSo/stargazers","contributors_url":"https://api.github.com/repos/CoSoECP/CoSo/contributors","subscribers_url":"https://api.github.com/repos/CoSoECP/CoSo/subscribers","subscription_url":"https://api.github.com/repos/CoSoECP/CoSo/subscription","commits_url":"https://api.github.com/repos/CoSoECP/CoSo/commits{/sha}","git_commits_url":"https://api.github.com/repos/CoSoECP/CoSo/git/commits{/sha}","comments_url":"https://api.github.com/repos/CoSoECP/CoSo/comments{/number}","issue_comment_url":"https://api.github.com/repos/CoSoECP/CoSo/issues/comments{/number}","contents_url":"https://api.github.com/repos/CoSoECP/CoSo/contents/{+path}","compare_url":"https://api.github.com/repos/CoSoECP/CoSo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CoSoECP/CoSo/merges","archive_url":"https://api.github.com/repos/CoSoECP/CoSo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CoSoECP/CoSo/downloads","issues_url":"https://api.github.com/repos/CoSoECP/CoSo/issues{/number}","pulls_url":"https://api.github.com/repos/CoSoECP/CoSo/pulls{/number}","milestones_url":"https://api.github.com/repos/CoSoECP/CoSo/milestones{/number}","notifications_url":"https://api.github.com/repos/CoSoECP/CoSo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CoSoECP/CoSo/labels{/name}","releases_url":"https://api.github.com/repos/CoSoECP/CoSo/releases{/id}","deployments_url":"https://api.github.com/repos/CoSoECP/CoSo/deployments","created_at":"2016-11-28T09:52:23Z","updated_at":"2016-12-04T21:53:02Z","pushed_at":"2017-02-12T12:04:39Z","git_url":"git://github.com/CoSoECP/CoSo.git","ssh_url":"git@github.com:CoSoECP/CoSo.git","clone_url":"https://github.com/CoSoECP/CoSo.git","svn_url":"https://github.com/CoSoECP/CoSo","homepage":"","size":1020,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CoSoECP/CoSo/pulls/10"},"html":{"href":"https://github.com/CoSoECP/CoSo/pull/10"},"issue":{"href":"https://api.github.com/repos/CoSoECP/CoSo/issues/10"},"comments":{"href":"https://api.github.com/repos/CoSoECP/CoSo/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/CoSoECP/CoSo/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/CoSoECP/CoSo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CoSoECP/CoSo/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/CoSoECP/CoSo/statuses/5173d9c29cf5165334a86b0052d71ae634410974"}}}}
{"actor":{"display_login":"melaniebrd"}}