{"action":"opened","issue":{"url":"https://api.github.com/repos/kelp404/bs4/issues/1","labels_url":"https://api.github.com/repos/kelp404/bs4/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/kelp404/bs4/issues/1/comments","events_url":"https://api.github.com/repos/kelp404/bs4/issues/1/events","html_url":"https://github.com/kelp404/bs4/issues/1","id":126653496,"number":1,"title":"find_all error when used in function","user":{"login":"jtexnl","id":6758591,"avatar_url":"https://avatars.githubusercontent.com/u/6758591?v=3","gravatar_id":"","url":"https://api.github.com/users/jtexnl","html_url":"https://github.com/jtexnl","followers_url":"https://api.github.com/users/jtexnl/followers","following_url":"https://api.github.com/users/jtexnl/following{/other_user}","gists_url":"https://api.github.com/users/jtexnl/gists{/gist_id}","starred_url":"https://api.github.com/users/jtexnl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jtexnl/subscriptions","organizations_url":"https://api.github.com/users/jtexnl/orgs","repos_url":"https://api.github.com/users/jtexnl/repos","events_url":"https://api.github.com/users/jtexnl/events{/privacy}","received_events_url":"https://api.github.com/users/jtexnl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-14T13:20:34Z","updated_at":"2016-01-14T13:20:34Z","closed_at":null,"body":"I'm trying to build a pretty simple scraper to harvest links as part of a crawler project. I've set up the following function to do the scraping:\r\n\r\n    import requests as rq \r\n    from bs4 import BeautifulSoup\r\n\r\n    def getHomepageLinks(page):\r\n        homepageLinks = []\r\n        response = rq.get(page)\r\n        text = response.text\r\n        soup = BeautifulSoup(text)\r\n        for a in soup.find_all('a'):\r\n            homepageLinks.append(a['href'])\r\n        return homepageLinks'\r\nI saved this file as \"scraper2.py\". When I try to run the code, I get the following error:\r\n\r\n>>> import scraper2 as sc\r\n>>> sc.getHomepageLinks('http://washingtonpost.com')\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"scraper2.py\", line 9, in getHomepageLinks\r\n    for a in soup.find_all('a'):\r\nTypeError: 'NoneType' object is not callable\r\n\r\nNow for the odd part: If I try to debug the code and just print the response, it works fine:\r\n\r\n>>> response = rq.get('http://washingtonpost.com')\r\n>>> text = response.text\r\n>>> soup = BeautifulSoup(text)\r\n>>> for a in soup.find_all('a'):\r\n...     print(a['href'])\r\n... \r\nhttps://www.washingtonpost.com\r\n#\r\n#\r\nhttp://www.washingtonpost.com/politics/\r\nhttps://www.washingtonpost.com/opinions/\r\nhttp://www.washingtonpost.com/sports/\r\nhttp://www.washingtonpost.com/local/\r\nhttp://www.washingtonpost.com/national/\r\nhttp://www.washingtonpost.com/world/\r\n...\r\n\r\nIf I'm reading the error messages correctly, the problem is occurring with soup.find_all, but only when the find_all is part of a function. \r\n\r\nI've posted the question on StackOverflow, but nobody has an answer, so I thought this might be a bug. Has anyone else experienced this issue?"}}