code:
import requests
url = 'https://example.com'
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36', # User-Agent dla Chrome
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9'
} # Nagłówki HTTP
try:
response = requests.get(url, headers=headers) # Pobieranie strony
response.raise_for_status()
print(response.text) # Wyświetlenie kodu HTML
except requests.exceptions.RequestException as e:
print("Error", e)
On my pc this code working but on pythonanywhere i have errors