{"action":"created","comment":{"url":"https://api.github.com/repos/pennlabs/penn-sdk-python/pulls/comments/44678468","id":44678468,"diff_hunk":"@@ -25,37 +29,41 @@ def all_status(self):\n         >>> all_laundry = l.all_status()\n         \"\"\"\n         r = requests.get(ALL_URL)\n-        if r.status_code == 200:\n-            parsed = BeautifulSoup(r.text)\n-            info_table = parsed.find_all('table')[2]\n-\n-            hall_dict = dict()\n-\n-            # This bit of code generates a dict of hallname->hall number by\n-            # parsing the link href of each room\n-            for link in info_table.find_all('a', class_='buttlink'):\n-                def get_hall_no(href):\n-                    return int(re.search(r\"Halls=(\\d+)\", href).group(1))\n-                hall_dict[link.get_text().strip()] = get_hall_no(link.get('href'))\n-\n-            # Parse the table into the relevant data\n-            data = [list(filter(lambda x: len(x) > 0, [val.get_text().strip() for val in row.find_all('td')])) for row in info_table.find_all('tr')]\n-\n-            # Remove the header row and all empty rows\n-            data_improved = list(filter(lambda x: len(list(x)) > 0, data))[1:]\n-\n-            # Construct the final JSON\n-            laundry_rooms = []\n-            for row in data_improved[1:]:\n-                room_dict = dict()\n-                room_dict['washers_available'] = int(row[1])\n-                room_dict['dryers_available'] = int(row[2])\n-                room_dict['washers_in_use'] = int(row[3])\n-                room_dict['dryers_in_use'] = int(row[4])\n-                room_dict['hall_no'] = hall_dict[row[0]]\n-                room_dict['name'] = row[0]\n-                laundry_rooms.append(room_dict)\n-            return laundry_rooms\n+        if not r.status_code == 200:\n+            return {'error': 'The laundry api is currently unavailable.'}\n+\n+        parsed = BeautifulSoup(r.text)\n+        info_table = parsed.find_all('table')[2]\n+\n+        # This bit of code generates a dict of hallname->hall number by\n+        # parsing the link href of each room\n+        hall_dict = {}\n+        for link in info_table.find_all('a', class_='buttlink'):\n+            clean_link = link.get_text().strip()\n+            hall_dict[clean_link] = self.get_hall_no(link.get('href'))\n+\n+        # Parse the table into the relevant data\n+        data = []\n+        for row in info_table.find_all('tr'):\n+            row_data = (val.get_text().strip() for val in row.find_all('td'))\n+            clean_row = [val for val in row_data if len(val) > 0]\n+            data.append(clean_row)\n+\n+        # Remove the header row and all empty rows\n+        data_improved = [row for row in data if len(row) > 0][1:]\n+\n+        # Construct the final JSON\n+        laundry_rooms = []\n+        for row in data_improved[1:]:","path":"penn/laundry.py","position":71,"original_position":71,"commit_id":"6a2fb450eb51d46fe4ab53dd4095527ecdcc9266","original_commit_id":"6a2fb450eb51d46fe4ab53dd4095527ecdcc9266","user":{"login":"dlakata","id":3457673,"avatar_url":"https://avatars.githubusercontent.com/u/3457673?v=3","gravatar_id":"","url":"https://api.github.com/users/dlakata","html_url":"https://github.com/dlakata","followers_url":"https://api.github.com/users/dlakata/followers","following_url":"https://api.github.com/users/dlakata/following{/other_user}","gists_url":"https://api.github.com/users/dlakata/gists{/gist_id}","starred_url":"https://api.github.com/users/dlakata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dlakata/subscriptions","organizations_url":"https://api.github.com/users/dlakata/orgs","repos_url":"https://api.github.com/users/dlakata/repos","events_url":"https://api.github.com/users/dlakata/events{/privacy}","received_events_url":"https://api.github.com/users/dlakata/received_events","type":"User","site_admin":false},"body":"any reason why ```data_improved``` is sliced both here and on 53?","created_at":"2015-11-12T16:26:52Z","updated_at":"2015-11-12T16:26:52Z","html_url":"https://github.com/pennlabs/penn-sdk-python/pull/46#discussion_r44678468","pull_request_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/pulls/46","_links":{"self":{"href":"https://api.github.com/repos/pennlabs/penn-sdk-python/pulls/comments/44678468"},"html":{"href":"https://github.com/pennlabs/penn-sdk-python/pull/46#discussion_r44678468"},"pull_request":{"href":"https://api.github.com/repos/pennlabs/penn-sdk-python/pulls/46"}}},"pull_request":{"url":"https://api.github.com/repos/pennlabs/penn-sdk-python/pulls/46","id":50530699,"html_url":"https://github.com/pennlabs/penn-sdk-python/pull/46","diff_url":"https://github.com/pennlabs/penn-sdk-python/pull/46.diff","patch_url":"https://github.com/pennlabs/penn-sdk-python/pull/46.patch","issue_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/issues/46","number":46,"state":"open","locked":false,"title":"Laundry refactor","user":{"login":"adelq","id":929309,"avatar_url":"https://avatars.githubusercontent.com/u/929309?v=3","gravatar_id":"","url":"https://api.github.com/users/adelq","html_url":"https://github.com/adelq","followers_url":"https://api.github.com/users/adelq/followers","following_url":"https://api.github.com/users/adelq/following{/other_user}","gists_url":"https://api.github.com/users/adelq/gists{/gist_id}","starred_url":"https://api.github.com/users/adelq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adelq/subscriptions","organizations_url":"https://api.github.com/users/adelq/orgs","repos_url":"https://api.github.com/users/adelq/repos","events_url":"https://api.github.com/users/adelq/events{/privacy}","received_events_url":"https://api.github.com/users/adelq/received_events","type":"User","site_admin":false},"body":"Much easier to read and has more rigorous testing now.","created_at":"2015-11-12T16:13:13Z","updated_at":"2015-11-12T16:26:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f432fd47f8b7b45104b867e713ca426214ffabd7","assignee":{"login":"afischer","id":5422397,"avatar_url":"https://avatars.githubusercontent.com/u/5422397?v=3","gravatar_id":"","url":"https://api.github.com/users/afischer","html_url":"https://github.com/afischer","followers_url":"https://api.github.com/users/afischer/followers","following_url":"https://api.github.com/users/afischer/following{/other_user}","gists_url":"https://api.github.com/users/afischer/gists{/gist_id}","starred_url":"https://api.github.com/users/afischer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afischer/subscriptions","organizations_url":"https://api.github.com/users/afischer/orgs","repos_url":"https://api.github.com/users/afischer/repos","events_url":"https://api.github.com/users/afischer/events{/privacy}","received_events_url":"https://api.github.com/users/afischer/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/pulls/46/commits","review_comments_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/pulls/46/comments","review_comment_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/issues/46/comments","statuses_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/statuses/6a2fb450eb51d46fe4ab53dd4095527ecdcc9266","head":{"label":"pennlabs:laundry-refactor","ref":"laundry-refactor","sha":"6a2fb450eb51d46fe4ab53dd4095527ecdcc9266","user":{"login":"pennlabs","id":1159028,"avatar_url":"https://avatars.githubusercontent.com/u/1159028?v=3","gravatar_id":"","url":"https://api.github.com/users/pennlabs","html_url":"https://github.com/pennlabs","followers_url":"https://api.github.com/users/pennlabs/followers","following_url":"https://api.github.com/users/pennlabs/following{/other_user}","gists_url":"https://api.github.com/users/pennlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/pennlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pennlabs/subscriptions","organizations_url":"https://api.github.com/users/pennlabs/orgs","repos_url":"https://api.github.com/users/pennlabs/repos","events_url":"https://api.github.com/users/pennlabs/events{/privacy}","received_events_url":"https://api.github.com/users/pennlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":12604160,"name":"penn-sdk-python","full_name":"pennlabs/penn-sdk-python","owner":{"login":"pennlabs","id":1159028,"avatar_url":"https://avatars.githubusercontent.com/u/1159028?v=3","gravatar_id":"","url":"https://api.github.com/users/pennlabs","html_url":"https://github.com/pennlabs","followers_url":"https://api.github.com/users/pennlabs/followers","following_url":"https://api.github.com/users/pennlabs/following{/other_user}","gists_url":"https://api.github.com/users/pennlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/pennlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pennlabs/subscriptions","organizations_url":"https://api.github.com/users/pennlabs/orgs","repos_url":"https://api.github.com/users/pennlabs/repos","events_url":"https://api.github.com/users/pennlabs/events{/privacy}","received_events_url":"https://api.github.com/users/pennlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pennlabs/penn-sdk-python","description":"A Python wrapper for the Penn OpenData APIs","fork":false,"url":"https://api.github.com/repos/pennlabs/penn-sdk-python","forks_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/forks","keys_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/teams","hooks_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/hooks","issue_events_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/issues/events{/number}","events_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/events","assignees_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/assignees{/user}","branches_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/branches{/branch}","tags_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/tags","blobs_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/statuses/{sha}","languages_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/languages","stargazers_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/stargazers","contributors_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/contributors","subscribers_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/subscribers","subscription_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/subscription","commits_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/contents/{+path}","compare_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/merges","archive_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/downloads","issues_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/issues{/number}","pulls_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/pulls{/number}","milestones_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/milestones{/number}","notifications_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/labels{/name}","releases_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/releases{/id}","created_at":"2013-09-04T23:06:34Z","updated_at":"2015-04-09T01:22:13Z","pushed_at":"2015-11-12T16:23:56Z","git_url":"git://github.com/pennlabs/penn-sdk-python.git","ssh_url":"git@github.com:pennlabs/penn-sdk-python.git","clone_url":"https://github.com/pennlabs/penn-sdk-python.git","svn_url":"https://github.com/pennlabs/penn-sdk-python","homepage":"","size":489,"stargazers_count":12,"watchers_count":12,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":8,"forks":5,"open_issues":8,"watchers":12,"default_branch":"master"}},"base":{"label":"pennlabs:master","ref":"master","sha":"cac0423d37f98474981042ff2096bd5c9c58f437","user":{"login":"pennlabs","id":1159028,"avatar_url":"https://avatars.githubusercontent.com/u/1159028?v=3","gravatar_id":"","url":"https://api.github.com/users/pennlabs","html_url":"https://github.com/pennlabs","followers_url":"https://api.github.com/users/pennlabs/followers","following_url":"https://api.github.com/users/pennlabs/following{/other_user}","gists_url":"https://api.github.com/users/pennlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/pennlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pennlabs/subscriptions","organizations_url":"https://api.github.com/users/pennlabs/orgs","repos_url":"https://api.github.com/users/pennlabs/repos","events_url":"https://api.github.com/users/pennlabs/events{/privacy}","received_events_url":"https://api.github.com/users/pennlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":12604160,"name":"penn-sdk-python","full_name":"pennlabs/penn-sdk-python","owner":{"login":"pennlabs","id":1159028,"avatar_url":"https://avatars.githubusercontent.com/u/1159028?v=3","gravatar_id":"","url":"https://api.github.com/users/pennlabs","html_url":"https://github.com/pennlabs","followers_url":"https://api.github.com/users/pennlabs/followers","following_url":"https://api.github.com/users/pennlabs/following{/other_user}","gists_url":"https://api.github.com/users/pennlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/pennlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pennlabs/subscriptions","organizations_url":"https://api.github.com/users/pennlabs/orgs","repos_url":"https://api.github.com/users/pennlabs/repos","events_url":"https://api.github.com/users/pennlabs/events{/privacy}","received_events_url":"https://api.github.com/users/pennlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pennlabs/penn-sdk-python","description":"A Python wrapper for the Penn OpenData APIs","fork":false,"url":"https://api.github.com/repos/pennlabs/penn-sdk-python","forks_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/forks","keys_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/teams","hooks_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/hooks","issue_events_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/issues/events{/number}","events_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/events","assignees_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/assignees{/user}","branches_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/branches{/branch}","tags_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/tags","blobs_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/statuses/{sha}","languages_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/languages","stargazers_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/stargazers","contributors_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/contributors","subscribers_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/subscribers","subscription_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/subscription","commits_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/contents/{+path}","compare_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/merges","archive_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/downloads","issues_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/issues{/number}","pulls_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/pulls{/number}","milestones_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/milestones{/number}","notifications_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/labels{/name}","releases_url":"https://api.github.com/repos/pennlabs/penn-sdk-python/releases{/id}","created_at":"2013-09-04T23:06:34Z","updated_at":"2015-04-09T01:22:13Z","pushed_at":"2015-11-12T16:23:56Z","git_url":"git://github.com/pennlabs/penn-sdk-python.git","ssh_url":"git@github.com:pennlabs/penn-sdk-python.git","clone_url":"https://github.com/pennlabs/penn-sdk-python.git","svn_url":"https://github.com/pennlabs/penn-sdk-python","homepage":"","size":489,"stargazers_count":12,"watchers_count":12,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"open_issues_count":8,"forks":5,"open_issues":8,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pennlabs/penn-sdk-python/pulls/46"},"html":{"href":"https://github.com/pennlabs/penn-sdk-python/pull/46"},"issue":{"href":"https://api.github.com/repos/pennlabs/penn-sdk-python/issues/46"},"comments":{"href":"https://api.github.com/repos/pennlabs/penn-sdk-python/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/pennlabs/penn-sdk-python/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/pennlabs/penn-sdk-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pennlabs/penn-sdk-python/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/pennlabs/penn-sdk-python/statuses/6a2fb450eb51d46fe4ab53dd4095527ecdcc9266"}}}}