Search code examples
pythontwitterbeautifulsoupkaggle

does anyone know why BeautifulSoup Connection-error appears in Kaggle


I am doing a sentiment analysis of the replies of a tweet from a specific user

when I write the code on google colab it works, but when I try it on Kaggle it throws me the error. In fact, no matter if I write other code about any other page using BeautifulSoup it gave me the same error

import requests
from bs4 import BeautifulSoup

url = 'https://twitter.com/jguaido/status/1163970836795207680'
source = requests.get(url).text
soup = BeautifulSoup(source,'html.parser')

replies=soup.find_all(class_="TweetTextSize")

ConnectionError: HTTPSConnectionPool(host='twitter.com', port=443): Max retries exceeded with url: /jguaido/status/1163970836795207680 (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',))

I expect that BeautifulSoup works on Kaggle.


Solution

  • Have you activated Internet Access for your kernel?

    Go to Settings -> Internet and select Internet connected. Your Kernels session restarts and the newly started session is enabled to access the Internet.

    https://www.kaggle.com/product-feedback/63544