ice578
ice578

Reputation: 7

python https authentication error?

I've been trying to print time data from this site: clockofeidolon.com and I found that the hour, minutes and seconds are stored in "span class="big-x" tags and have tried to get the data with this

from bs4 import BeautifulSoup
from requests import Session

session = Session()
session.headers['user-agent'] = (
    'Mozilla/5.0 (Windows NT 10.0; Win64; x64) '
    'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/'
    '66.0.3359.181 Safari/537.36'
)

url = 'https://clockofeidolon'
response = session.get(url=url)

data = response.text
soup = BeautifulSoup(data, "html.parser")
spans = soup.find('<span class="big')
print(data)
print([span.text for span in spans])

I keep getting authentication erros though

socket.gaierror: [Errno 11001] getaddrinfo failed

Upvotes: 0

Views: 68

Answers (2)

Peter Chuang
Peter Chuang

Reputation: 94

The host clockofeidolon did not resolve to an IP. You were probably looking for clockofeidolon.com.

Upvotes: 0

MarvMan
MarvMan

Reputation: 41

This error is occuring because you are trying to access an URL that doesn't exist (https://clockofeidolon) or Python can't reach.

Look at this question, which explains what that error means:

"getaddrinfo failed", what does that mean?

Upvotes: 1

Related Questions