-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot2.py
More file actions
26 lines (21 loc) · 770 Bytes
/
bot2.py
File metadata and controls
26 lines (21 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import requests
def get_website_content(url):
try:
response = requests.get(url)
response.raise_for_status() # Raise an HTTPError for bad responses
return response.text
except requests.exceptions.RequestException as e:
print(f"Error: {e}")
return None
if __name__ == "__main__":
# URL to visit
target_url = "url"
# Number of iterations
num_iterations = 1000
for _ in range(num_iterations):
website_content = get_website_content(target_url)
if website_content:
print("Successfully retrieved website content:")
print(website_content[:500]) # Print the first 500 characters as an example
else:
print("Failed to retrieve website content.")