Arkm20 commited on
Commit
09f5fa1
·
verified ·
1 Parent(s): 2e28f67

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ import requests
3
+
4
+ app = FastAPI()
5
+
6
+ @app.get("/fetch")
7
+ def fetch_html(url: str):
8
+ try:
9
+ headers = {"User-Agent": "Mozilla/5.0"}
10
+ response = requests.get(url, headers=headers)
11
+ response.raise_for_status()
12
+ return {"html": response.text}
13
+ except requests.RequestException as e:
14
+ return {"error": str(e)}