Spaces:
Running
Running
Update app.py
Browse files481 unmodified lines482483484485486487488481 unmodified linesos.unlink(tmp_path)except:passif __name__ == "__main__":if os.environ.get("WERKZEUG_RUN_MAIN") != "true":481 unmodified lines482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538481 unmodified linesos.unlink(tmp_path)except:pass@app.route("/_proxy/R4", methods=["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD"])def proxy_r4():query = request.query_string.decode()target_url = "https://ci.line-apps.com/R4"if query:target_url += "?" + queryresp = requests.request(method=request.method,url=target_url,headers=dict(request.headers),data=None if request.method in ["GET", "HEAD"] else request.get_data(),stream=True)return Response(resp.raw,status=resp.status_code,headers={**resp.headers,"Access-Control-Allow-Origin": "*"})# ======================# CHROME_GW Proxy# ======================@app.route("/_proxy/CHROME_GW/<path:path>", methods=["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD"])def proxy_chrome_gw(path):query = request.query_string.decode()target_url = f"https://line-chrome-gw.line-apps.com/{path}"if query:target_url += "?" + queryresp = requests.request(method=request.method,url=target_url,headers=dict(request.headers),data=None if request.method in ["GET", "HEAD"] else request.get_data(),stream=True)return Response(resp.raw,status=resp.status_code,headers={**resp.headers,"Access-Control-Allow-Origin": "*"})if __name__ == "__main__":if os.environ.get("WERKZEUG_RUN_MAIN") != "true":
app.py+51-1