{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/bedrock/pulls/comments/24852122","id":24852122,"diff_hunk":"@@ -0,0 +1,36 @@\n+from django.conf import settings\n+\n+from feedparser import parse\n+\n+from bedrock.firefox.models import FirefoxOSFeedLink\n+\n+\n+def create_or_update_fxos_feed_link(locale, link, title):\n+    try:\n+        feed_link = FirefoxOSFeedLink.objects.get(\n+            locale=locale, link=link)\n+    except FirefoxOSFeedLink.DoesNotExist:\n+        FirefoxOSFeedLink.objects.create(locale=locale, link=link,\n+                                         title=title)\n+    else:\n+        if title != feed_link.title:\n+            feed_link.title = title\n+            feed_link.save(update_fields=['title'])\n+\n+\n+def create_or_update_fxos_feed_links(locale, parsed_feed):\n+    for entry in parsed_feed.get('entries', []):\n+        link = entry.get('link')\n+        title = entry.get('title')\n+        if link and title:\n+            create_or_update_fxos_feed_link(locale, link, title)\n+\n+\n+def run(*args):\n+    for locale, url in settings.FIREFOX_OS_FEEDS:\n+        try:\n+            parsed_feed = parse(url)\n+        except:\n+            print ('Unable to fetch and parse ' + url)","path":"scripts/update_firefox_os_feeds.py","position":34,"original_position":34,"commit_id":"3fb7b17f82544439f33232b65288262de4f7ecbf","original_commit_id":"3fb7b17f82544439f33232b65288262de4f7ecbf","user":{"login":"jgmize","id":161718,"avatar_url":"https://avatars.githubusercontent.com/u/161718?v=3","gravatar_id":"","url":"https://api.github.com/users/jgmize","html_url":"https://github.com/jgmize","followers_url":"https://api.github.com/users/jgmize/followers","following_url":"https://api.github.com/users/jgmize/following{/other_user}","gists_url":"https://api.github.com/users/jgmize/gists{/gist_id}","starred_url":"https://api.github.com/users/jgmize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgmize/subscriptions","organizations_url":"https://api.github.com/users/jgmize/orgs","repos_url":"https://api.github.com/users/jgmize/repos","events_url":"https://api.github.com/users/jgmize/events{/privacy}","received_events_url":"https://api.github.com/users/jgmize/received_events","type":"User","site_admin":false},"body":"Good point, I like importing from the future. :)","created_at":"2015-02-17T20:44:48Z","updated_at":"2015-02-17T20:44:48Z","html_url":"https://github.com/mozilla/bedrock/pull/2721#discussion_r24852122","pull_request_url":"https://api.github.com/repos/mozilla/bedrock/pulls/2721","_links":{"self":{"href":"https://api.github.com/repos/mozilla/bedrock/pulls/comments/24852122"},"html":{"href":"https://github.com/mozilla/bedrock/pull/2721#discussion_r24852122"},"pull_request":{"href":"https://api.github.com/repos/mozilla/bedrock/pulls/2721"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/bedrock/pulls/2721","id":29070826,"html_url":"https://github.com/mozilla/bedrock/pull/2721","diff_url":"https://github.com/mozilla/bedrock/pull/2721.diff","patch_url":"https://github.com/mozilla/bedrock/pull/2721.patch","issue_url":"https://api.github.com/repos/mozilla/bedrock/issues/2721","number":2721,"state":"open","locked":false,"title":"Add backend for fxos feed links","user":{"login":"jgmize","id":161718,"avatar_url":"https://avatars.githubusercontent.com/u/161718?v=3","gravatar_id":"","url":"https://api.github.com/users/jgmize","html_url":"https://github.com/jgmize","followers_url":"https://api.github.com/users/jgmize/followers","following_url":"https://api.github.com/users/jgmize/following{/other_user}","gists_url":"https://api.github.com/users/jgmize/gists{/gist_id}","starred_url":"https://api.github.com/users/jgmize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgmize/subscriptions","organizations_url":"https://api.github.com/users/jgmize/orgs","repos_url":"https://api.github.com/users/jgmize/repos","events_url":"https://api.github.com/users/jgmize/events{/privacy}","received_events_url":"https://api.github.com/users/jgmize/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-02-11T06:36:07Z","updated_at":"2015-02-17T20:44:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4097419dd65d2343538a28aa5ba131d8b6eafb01","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/bedrock/pulls/2721/commits","review_comments_url":"https://api.github.com/repos/mozilla/bedrock/pulls/2721/comments","review_comment_url":"https://api.github.com/repos/mozilla/bedrock/pulls/comments/{number}","comments_url":"https://api.github.com/repos/mozilla/bedrock/issues/2721/comments","statuses_url":"https://api.github.com/repos/mozilla/bedrock/statuses/3fb7b17f82544439f33232b65288262de4f7ecbf","head":{"label":"jgmize:firefox-os-feeds","ref":"firefox-os-feeds","sha":"3fb7b17f82544439f33232b65288262de4f7ecbf","user":{"login":"jgmize","id":161718,"avatar_url":"https://avatars.githubusercontent.com/u/161718?v=3","gravatar_id":"","url":"https://api.github.com/users/jgmize","html_url":"https://github.com/jgmize","followers_url":"https://api.github.com/users/jgmize/followers","following_url":"https://api.github.com/users/jgmize/following{/other_user}","gists_url":"https://api.github.com/users/jgmize/gists{/gist_id}","starred_url":"https://api.github.com/users/jgmize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgmize/subscriptions","organizations_url":"https://api.github.com/users/jgmize/orgs","repos_url":"https://api.github.com/users/jgmize/repos","events_url":"https://api.github.com/users/jgmize/events{/privacy}","received_events_url":"https://api.github.com/users/jgmize/received_events","type":"User","site_admin":false},"repo":{"id":11715015,"name":"bedrock","full_name":"jgmize/bedrock","owner":{"login":"jgmize","id":161718,"avatar_url":"https://avatars.githubusercontent.com/u/161718?v=3","gravatar_id":"","url":"https://api.github.com/users/jgmize","html_url":"https://github.com/jgmize","followers_url":"https://api.github.com/users/jgmize/followers","following_url":"https://api.github.com/users/jgmize/following{/other_user}","gists_url":"https://api.github.com/users/jgmize/gists{/gist_id}","starred_url":"https://api.github.com/users/jgmize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgmize/subscriptions","organizations_url":"https://api.github.com/users/jgmize/orgs","repos_url":"https://api.github.com/users/jgmize/repos","events_url":"https://api.github.com/users/jgmize/events{/privacy}","received_events_url":"https://api.github.com/users/jgmize/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jgmize/bedrock","description":"Making mozilla.org awesome, one pebble at a time","fork":true,"url":"https://api.github.com/repos/jgmize/bedrock","forks_url":"https://api.github.com/repos/jgmize/bedrock/forks","keys_url":"https://api.github.com/repos/jgmize/bedrock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jgmize/bedrock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jgmize/bedrock/teams","hooks_url":"https://api.github.com/repos/jgmize/bedrock/hooks","issue_events_url":"https://api.github.com/repos/jgmize/bedrock/issues/events{/number}","events_url":"https://api.github.com/repos/jgmize/bedrock/events","assignees_url":"https://api.github.com/repos/jgmize/bedrock/assignees{/user}","branches_url":"https://api.github.com/repos/jgmize/bedrock/branches{/branch}","tags_url":"https://api.github.com/repos/jgmize/bedrock/tags","blobs_url":"https://api.github.com/repos/jgmize/bedrock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jgmize/bedrock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jgmize/bedrock/git/refs{/sha}","trees_url":"https://api.github.com/repos/jgmize/bedrock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jgmize/bedrock/statuses/{sha}","languages_url":"https://api.github.com/repos/jgmize/bedrock/languages","stargazers_url":"https://api.github.com/repos/jgmize/bedrock/stargazers","contributors_url":"https://api.github.com/repos/jgmize/bedrock/contributors","subscribers_url":"https://api.github.com/repos/jgmize/bedrock/subscribers","subscription_url":"https://api.github.com/repos/jgmize/bedrock/subscription","commits_url":"https://api.github.com/repos/jgmize/bedrock/commits{/sha}","git_commits_url":"https://api.github.com/repos/jgmize/bedrock/git/commits{/sha}","comments_url":"https://api.github.com/repos/jgmize/bedrock/comments{/number}","issue_comment_url":"https://api.github.com/repos/jgmize/bedrock/issues/comments/{number}","contents_url":"https://api.github.com/repos/jgmize/bedrock/contents/{+path}","compare_url":"https://api.github.com/repos/jgmize/bedrock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jgmize/bedrock/merges","archive_url":"https://api.github.com/repos/jgmize/bedrock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jgmize/bedrock/downloads","issues_url":"https://api.github.com/repos/jgmize/bedrock/issues{/number}","pulls_url":"https://api.github.com/repos/jgmize/bedrock/pulls{/number}","milestones_url":"https://api.github.com/repos/jgmize/bedrock/milestones{/number}","notifications_url":"https://api.github.com/repos/jgmize/bedrock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jgmize/bedrock/labels{/name}","releases_url":"https://api.github.com/repos/jgmize/bedrock/releases{/id}","created_at":"2013-07-28T04:15:17Z","updated_at":"2015-02-12T23:03:01Z","pushed_at":"2015-02-13T07:26:38Z","git_url":"git://github.com/jgmize/bedrock.git","ssh_url":"git@github.com:jgmize/bedrock.git","clone_url":"https://github.com/jgmize/bedrock.git","svn_url":"https://github.com/jgmize/bedrock","homepage":"http://mozilla.org","size":298272,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"mozilla:master","ref":"master","sha":"2703b6ce7d477c91fe2d9355a0873da90c74f5ac","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":1616665,"name":"bedrock","full_name":"mozilla/bedrock","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/bedrock","description":"Making mozilla.org awesome, one pebble at a time","fork":false,"url":"https://api.github.com/repos/mozilla/bedrock","forks_url":"https://api.github.com/repos/mozilla/bedrock/forks","keys_url":"https://api.github.com/repos/mozilla/bedrock/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/bedrock/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/bedrock/teams","hooks_url":"https://api.github.com/repos/mozilla/bedrock/hooks","issue_events_url":"https://api.github.com/repos/mozilla/bedrock/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/bedrock/events","assignees_url":"https://api.github.com/repos/mozilla/bedrock/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/bedrock/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/bedrock/tags","blobs_url":"https://api.github.com/repos/mozilla/bedrock/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/bedrock/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/bedrock/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/bedrock/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/bedrock/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/bedrock/languages","stargazers_url":"https://api.github.com/repos/mozilla/bedrock/stargazers","contributors_url":"https://api.github.com/repos/mozilla/bedrock/contributors","subscribers_url":"https://api.github.com/repos/mozilla/bedrock/subscribers","subscription_url":"https://api.github.com/repos/mozilla/bedrock/subscription","commits_url":"https://api.github.com/repos/mozilla/bedrock/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/bedrock/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/bedrock/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/bedrock/issues/comments/{number}","contents_url":"https://api.github.com/repos/mozilla/bedrock/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/bedrock/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/bedrock/merges","archive_url":"https://api.github.com/repos/mozilla/bedrock/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/bedrock/downloads","issues_url":"https://api.github.com/repos/mozilla/bedrock/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/bedrock/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/bedrock/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/bedrock/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/bedrock/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/bedrock/releases{/id}","created_at":"2011-04-14T22:57:57Z","updated_at":"2015-02-17T18:26:41Z","pushed_at":"2015-02-17T18:26:40Z","git_url":"git://github.com/mozilla/bedrock.git","ssh_url":"git@github.com:mozilla/bedrock.git","clone_url":"https://github.com/mozilla/bedrock.git","svn_url":"https://github.com/mozilla/bedrock","homepage":"http://mozilla.org","size":328536,"stargazers_count":215,"watchers_count":215,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":300,"mirror_url":null,"open_issues_count":21,"forks":300,"open_issues":21,"watchers":215,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/bedrock/pulls/2721"},"html":{"href":"https://github.com/mozilla/bedrock/pull/2721"},"issue":{"href":"https://api.github.com/repos/mozilla/bedrock/issues/2721"},"comments":{"href":"https://api.github.com/repos/mozilla/bedrock/issues/2721/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/bedrock/pulls/2721/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/bedrock/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/mozilla/bedrock/pulls/2721/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/bedrock/statuses/3fb7b17f82544439f33232b65288262de4f7ecbf"}}}}