Spaces:
Sleeping
Sleeping
Update tools/visit_webpage.py
Browse files- tools/visit_webpage.py +0 -9
tools/visit_webpage.py
CHANGED
|
@@ -25,19 +25,10 @@ class VisitWebpageTool(Tool):
|
|
| 25 |
) from e
|
| 26 |
try:
|
| 27 |
# Send a GET request to the URL with a 20-second timeout
|
| 28 |
-
# req = Request(
|
| 29 |
-
# url=url,
|
| 30 |
-
# headers={'User-Agent': 'Mozilla/5.0'}
|
| 31 |
-
# )
|
| 32 |
-
# response = urlopen(req).read().decode('utf-8')
|
| 33 |
-
# print(response)
|
| 34 |
headers = {
|
| 35 |
'User-Agent': 'Mozilla/5.0'
|
| 36 |
}
|
| 37 |
-
|
| 38 |
-
|
| 39 |
response = requests.get(url, headers=headers, timeout=20)
|
| 40 |
-
#response = requests.get(url, timeout=20)
|
| 41 |
response.raise_for_status() # Raise an exception for bad status codes
|
| 42 |
|
| 43 |
# Convert the HTML content to Markdown
|
|
|
|
| 25 |
) from e
|
| 26 |
try:
|
| 27 |
# Send a GET request to the URL with a 20-second timeout
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
headers = {
|
| 29 |
'User-Agent': 'Mozilla/5.0'
|
| 30 |
}
|
|
|
|
|
|
|
| 31 |
response = requests.get(url, headers=headers, timeout=20)
|
|
|
|
| 32 |
response.raise_for_status() # Raise an exception for bad status codes
|
| 33 |
|
| 34 |
# Convert the HTML content to Markdown
|