0Time commited on
Commit
5508dd5
·
verified ·
1 Parent(s): 3bc1855
Files changed (2) hide show
  1. Dockerfile +4 -0
  2. app.py +17 -0
Dockerfile ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+ RUN pip install --no-cache-dir flask requests
3
+ COPY app.py /app.py
4
+ CMD ["python","/app.py"]
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask,request
2
+ import requests
3
+ app=Flask(__name__)
4
+ @app.route('/')
5
+ def index():
6
+ u=request.args.get('u'); s=request.args.get('s')
7
+ if not u:return 'usage u s'
8
+ try:
9
+ r=requests.put(u,headers={'x-amz-copy-source':s} if s else {},data=b'')
10
+ return 'R%d %s'%(r.status_code,r.text[:4000])
11
+ except Exception as e:return 'ERR '+repr(e)
12
+ @app.route('/get')
13
+ def get():
14
+ try:
15
+ u=request.args['u'];r=requests.get(u);return (r.content, r.status_code, {'Content-Type':'application/octet-stream'})
16
+ except Exception as e:return repr(e)
17
+ app.run(host='0.0.0.0',port=7860)