import requests
Make a request to the server to access unlimited internet
def access_unlimited_internet(url): # Replace 'localhost:5000' with the server's actual address server_url = 'http://localhost:5000'
# Make a request to the server's endpoint with the desired URL
try:
response = requests.get(f'{server_url}/api/unlimited-internet?url={url}', headers=requests.utils.default_headers())
# Handle the response from the server
if response.ok:
# If the response is successful, display the result
print(response.content.decode())
else:
# If there's an error, display an appropriate message
print('Error:', response.status_code, response.reason)
except requests.RequestException as e:
# Handle any errors that occur during the request
print('Request failed:', str(e))
Usage example
url = 'https://example.com' # Replace with the desired URL access_unlimited_internet(url)