Proxy server, used for browser proxy access, supports dynamic proxy switching
Project description
快捷使用
安装库
- pip install ApiProxy
编译库
- python ./setup.py sdist bdist_wheel
- pip install .\ApiProxy-1.0-py3-none-any.whl
上传库
- twine upload dist/*
卸载库
- pip uninstall ApiProxy
场景1-设置dp代理,支持socks代理
from DrissionPage import ChromiumPage,ChromiumOptions
from ApiProxy import Proxy
a=Proxy(8993,8996)
data=a.setproxyIp("http://183.158.146.144:40023")
proxyurl=data["url"]
print("proxyurl:",proxyurl)
co=ChromiumOptions()
co.set_proxy(proxyurl)
page=ChromiumPage(addr_or_opts=co)
page.get("https://www.baidu.com")
input("等待输入")
场景2-使用dp动态代理切换,支持socks代理
from DrissionPage import ChromiumPage,ChromiumOptions
from ApiProxy import Proxy
a=Proxy(8993,8996)
data=a.setproxyIp("http://183.158.146.144:40023")
proxyurl=data["url"]
print("proxyurl:",proxyurl)
co=ChromiumOptions()
co.set_proxy(proxyurl)
page=ChromiumPage(addr_or_opts=co)
page.get("https://www.ip138.com")
input("第一次切换ip")
# 再次切换代理
a.switchproxyIp("http://49.87.97.136:40007")
page.get("https://www.ip138.com")
input("第二次切换ip")
打包避坑指南(二选一)
- 使用PyInstaller的add_data参数,将dependencies依赖文件打包进去,否则无法使用proxy.py中的代码
- 编辑打包的spec文件,将datas字段赋值如下:datas = [('dependencies','dependencies')] ,第二个dependencies填写本库的依赖文件夹路径
接下来计划
- 重构apiproxy,使apiproxy支持代理链,sock5代理,全局上游代理,动态更换代理,以及对指定url进行切换代理
- 支持tls随机指纹
- 支持整个代理端的所有接口监听,比起dp原生监听不会存在多个嵌套页面接口漏的情况
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ApiProxy-0.0.5.tar.gz
(54.0 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
ApiProxy-0.0.5-py3-none-any.whl
(54.3 MB
view details)
File details
Details for the file ApiProxy-0.0.5.tar.gz.
File metadata
- Download URL: ApiProxy-0.0.5.tar.gz
- Upload date:
- Size: 54.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c21fb424291db187190d25663a21a2f9d80e79717cab4c0a838525129f105fa
|
|
| MD5 |
97da15b8e9874b934ad0d5902e9a625b
|
|
| BLAKE2b-256 |
9369499941a5c886ba547e530cd04f282d5be2699c8c23560c643ada7b864191
|
File details
Details for the file ApiProxy-0.0.5-py3-none-any.whl.
File metadata
- Download URL: ApiProxy-0.0.5-py3-none-any.whl
- Upload date:
- Size: 54.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f944387ce91a9a64d54a4663daaf5d7037a23005ff760367de86c0e5447769a2
|
|
| MD5 |
4e9e9ecfaccef45712e8e94f5df3037f
|
|
| BLAKE2b-256 |
f32cc02fc61eec988693e6209fcf903c67e60730c83d57e0f64d96bcc6934608
|