0Time commited on
Commit
0790a6d
·
verified ·
1 Parent(s): baab8ac
Files changed (3) hide show
  1. Dockerfile +4 -0
  2. README.md +2 -7
  3. app.py +14 -0
Dockerfile ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ FROM python:3.11
2
+ RUN pip install flask requests
3
+ COPY app.py /app.py
4
+ CMD ["python","/app.py"]
README.md CHANGED
@@ -1,10 +1,5 @@
1
  ---
2
- title: Latnetnew
3
- emoji: 🌍
4
- colorFrom: red
5
- colorTo: gray
6
  sdk: docker
7
- pinned: false
8
  ---
9
-
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: lat
 
 
 
3
  sdk: docker
4
+ app_port: 7860
5
  ---
 
 
app.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask,request,Response
2
+ import requests,json,base64
3
+ app=Flask(__name__)
4
+ @app.route('/')
5
+ def idx(): return 'ok'
6
+ @app.route('/go',methods=['GET','POST'])
7
+ def go():
8
+ try:
9
+ url=request.args.get('url');met=request.args.get('m','GET'); heads=json.loads(request.args.get('headers','{}')); body=request.get_data()
10
+ if request.args.get('body64'): body=base64.b64decode(request.args['body64'])
11
+ r=requests.request(met,url,headers=heads,data=body,timeout=180)
12
+ return Response(r.content,status=r.status_code,headers={'Content-Type':r.headers.get('Content-Type','text/plain'),'x-head':str(dict(r.headers))[:5000]})
13
+ except Exception as e:return repr(e),500
14
+ if __name__=='__main__':app.run(host='0.0.0.0',port=7860)