Below is the code to capture a network traffic in python
import requests
def check_web_traffic(url):
try:
response = requests.get(url)
if response.status_code == 200:
print(f"Web traffic for {url} is good.")
else:
print(f"Web traffic for {url} is not as expected. Status code: {response.status_code}")
except requests.RequestException as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
url = 'Put website url here'
check_web_traffic(url)
Comments
Post a Comment