8

求教转发本地应用网络请求的方法

 2 years ago
source link: https://www.v2ex.com/t/844170
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

用本地服务代替网络服务, 使得需要依赖网络运行的一款第三方应用能够脱机运行。

已实现的阶段目标

使用 RESTful 架构的 falcon 包实现了基本的网络请求响应,在依赖的资源文件完整的情况下,程序可以脱机运行。 但是遇到资源文件缺失,需要通过网络下载补足的情况就会报错。

本地文件请求:GET http://127.0.0.1:8686/Download/example.zip

文件远程真实地址:GET http://down.domain.com/Download/example.zip

用什么方法能在 python 程序接收到本地文件请求时,由 python重定向连接到文件远程真实地址,并将响应数据原样发回给本地第三方应用。类似于本地应用通过代理的方式取得了文件。

用关键词redirect在 Github 搜索了一些 python 项目,没找到特别适用的。

希望大侠不吝赐教,万分感谢。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK