How to block response from GET request

36 Views Asked by At

I'm using python requests library. I have to send GET request to a website. The response body weights a lot and I'm using a proxy and pay per-gb. I need to block response being received by a proxy server to save bandwidth. I cannot use head requests since they are restricted by the website.

Everything I was able to find is discarding the response body from memory but that has nothing with my issue.

1

There are 1 best solutions below

1
Cormac Hollingsworth On

If you don’t want to receive anything why are you sending a GET request? Are you actually trying to receive some different information?

For example if you were simply trying to test that the site is up you could use ping as perhow to ping in python

import os
hostname = "google.com" #example
response = os.system("ping -c 1 " + hostname)
#and then check the response...
if response == 0:
    print(f"{hostname} is up!")
else:
    print(f"{hostname} is down!")