#!/usr/bin/python3

import requests
from requests.structures import CaseInsensitiveDict

site = 'http://fam-tille.de/leblauf.html'

# https://stackoverflow.com/questions/55872164/how-to-rotate-proxies-on-a-python-requests/68451842#68451842
#from requests_ip_rotator import ApiGateway, EXTRA_REGIONS

#gateway = ApiGateway(site)
#gateway.start()

#session = requests.Session()
#session.mount(site) # , gateway)

#https://reqbin.com/req/python/gplpbyk6/get-request-like-mozilla-firefox
headers = CaseInsensitiveDict()
headers["Connection"] = "keep-alive"
#headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0"
headers["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:96.0) Gecko/20100101 Firefox/96.0"
headers["Upgrade-Insecure-Requests"] = "1"
headers["Accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"

response = requests.get(site, headers = headers)
if response.status_code == 404:
    print("Failed to access %s. Exit." % site)
    # gateway.shutdown() 
    exit(1)
if response.status_code != 200:
    print("Non-default response status code: ", response.status_code)
print(response.text)
# gateway.shutdown() 
