fds
This commit is contained in:
parent
96aa343f64
commit
f7511c1031
1 changed files with 1 additions and 1 deletions
|
@ -362,7 +362,7 @@ def get_post_title(v):
|
||||||
|
|
||||||
#mimic chrome browser agent
|
#mimic chrome browser agent
|
||||||
headers = {"User-Agent": f"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36"}
|
headers = {"User-Agent": f"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.72 Safari/537.36"}
|
||||||
try: x = requests.get(url, headers=headers)
|
try: x = requests.get(url, headers=headers, timeout=5)
|
||||||
except BaseException: return {"error": "Could not reach page"}, 400
|
except BaseException: return {"error": "Could not reach page"}, 400
|
||||||
|
|
||||||
if not x.status_code == 200: return {"error": f"Page returned {x.status_code}"}, x.status_code
|
if not x.status_code == 200: return {"error": f"Page returned {x.status_code}"}, x.status_code
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue