%global _empty_manifest_terminate_build 0 Name: python-httpx-socks Version: 0.7.5 Release: 1 Summary: Proxy (HTTP, SOCKS) transports for httpx License: Apache 2 URL: https://github.com/romis2012/httpx-socks Source0: https://mirrors.nju.edu.cn/pypi/web/packages/8b/5d/9a60e05acab027ae88e777599738d374be9967df3cea66c12e72967cbd58/httpx-socks-0.7.5.tar.gz BuildArch: noarch Requires: python3-httpx Requires: python3-httpcore Requires: python3-socks Requires: python3-async-timeout Requires: python3-trio %description # httpx-socks [![Build Status](https://api.travis-ci.com/romis2012/httpx-socks.svg?branch=master)](https://travis-ci.com/github/romis2012/httpx-socks) [![Coverage Status](https://coveralls.io/repos/github/romis2012/httpx-socks/badge.svg?branch=master&_=q)](https://coveralls.io/github/romis2012/httpx-socks?branch=master) [![PyPI version](https://badge.fury.io/py/httpx-socks.svg)](https://badge.fury.io/py/httpx-socks) The `httpx-socks` package provides proxy transports for [httpx](https://github.com/encode/httpx) client. SOCKS4(a), SOCKS5(h), HTTP (tunneling) proxy supported. It uses [python-socks](https://github.com/romis2012/python-socks) for core proxy functionality. ## Requirements - Python >= 3.6 - httpx>=0.21.0 - python-socks>=2.0.0 - async-timeout>=3.0.1 (optional) - trio>=0.16.0 (optional) ## Installation only sync proxy support: ``` pip install httpx-socks ``` to include optional asyncio support (it requires async-timeout): ``` pip install httpx-socks[asyncio] ``` to include optional trio support: ``` pip install httpx-socks[trio] ``` ## Usage #### sync transport ```python import httpx from httpx_socks import SyncProxyTransport def fetch(url): transport = SyncProxyTransport.from_url('socks5://user:password@127.0.0.1:1080') with httpx.Client(transport=transport) as client: res = client.get(url) return res.text ``` #### async transport (asyncio, trio) ```python import httpx from httpx_socks import AsyncProxyTransport async def fetch(url): transport = AsyncProxyTransport.from_url('socks5://user:password@127.0.0.1:1080') async with httpx.AsyncClient(transport=transport) as client: res = await client.get(url) return res.text ``` #### secure proxy connections (aka "HTTPS proxies", experimental feature, both sync and async support) ```python import ssl import httpx from httpx_socks import AsyncProxyTransport async def fetch(url): proxy_ssl = ssl.SSLContext(ssl.PROTOCOL_TLS) proxy_ssl.verify_mode = ssl.CERT_REQUIRED proxy_ssl.load_verify_locations(...) transport = AsyncProxyTransport.from_url('http://user:password@127.0.0.1:8080', proxy_ssl=proxy_ssl) async with httpx.AsyncClient(transport=transport) as client: res = await client.get(url) return res.text ``` %package -n python3-httpx-socks Summary: Proxy (HTTP, SOCKS) transports for httpx Provides: python-httpx-socks BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-httpx-socks # httpx-socks [![Build Status](https://api.travis-ci.com/romis2012/httpx-socks.svg?branch=master)](https://travis-ci.com/github/romis2012/httpx-socks) [![Coverage Status](https://coveralls.io/repos/github/romis2012/httpx-socks/badge.svg?branch=master&_=q)](https://coveralls.io/github/romis2012/httpx-socks?branch=master) [![PyPI version](https://badge.fury.io/py/httpx-socks.svg)](https://badge.fury.io/py/httpx-socks) The `httpx-socks` package provides proxy transports for [httpx](https://github.com/encode/httpx) client. SOCKS4(a), SOCKS5(h), HTTP (tunneling) proxy supported. It uses [python-socks](https://github.com/romis2012/python-socks) for core proxy functionality. ## Requirements - Python >= 3.6 - httpx>=0.21.0 - python-socks>=2.0.0 - async-timeout>=3.0.1 (optional) - trio>=0.16.0 (optional) ## Installation only sync proxy support: ``` pip install httpx-socks ``` to include optional asyncio support (it requires async-timeout): ``` pip install httpx-socks[asyncio] ``` to include optional trio support: ``` pip install httpx-socks[trio] ``` ## Usage #### sync transport ```python import httpx from httpx_socks import SyncProxyTransport def fetch(url): transport = SyncProxyTransport.from_url('socks5://user:password@127.0.0.1:1080') with httpx.Client(transport=transport) as client: res = client.get(url) return res.text ``` #### async transport (asyncio, trio) ```python import httpx from httpx_socks import AsyncProxyTransport async def fetch(url): transport = AsyncProxyTransport.from_url('socks5://user:password@127.0.0.1:1080') async with httpx.AsyncClient(transport=transport) as client: res = await client.get(url) return res.text ``` #### secure proxy connections (aka "HTTPS proxies", experimental feature, both sync and async support) ```python import ssl import httpx from httpx_socks import AsyncProxyTransport async def fetch(url): proxy_ssl = ssl.SSLContext(ssl.PROTOCOL_TLS) proxy_ssl.verify_mode = ssl.CERT_REQUIRED proxy_ssl.load_verify_locations(...) transport = AsyncProxyTransport.from_url('http://user:password@127.0.0.1:8080', proxy_ssl=proxy_ssl) async with httpx.AsyncClient(transport=transport) as client: res = await client.get(url) return res.text ``` %package help Summary: Development documents and examples for httpx-socks Provides: python3-httpx-socks-doc %description help # httpx-socks [![Build Status](https://api.travis-ci.com/romis2012/httpx-socks.svg?branch=master)](https://travis-ci.com/github/romis2012/httpx-socks) [![Coverage Status](https://coveralls.io/repos/github/romis2012/httpx-socks/badge.svg?branch=master&_=q)](https://coveralls.io/github/romis2012/httpx-socks?branch=master) [![PyPI version](https://badge.fury.io/py/httpx-socks.svg)](https://badge.fury.io/py/httpx-socks) The `httpx-socks` package provides proxy transports for [httpx](https://github.com/encode/httpx) client. SOCKS4(a), SOCKS5(h), HTTP (tunneling) proxy supported. It uses [python-socks](https://github.com/romis2012/python-socks) for core proxy functionality. ## Requirements - Python >= 3.6 - httpx>=0.21.0 - python-socks>=2.0.0 - async-timeout>=3.0.1 (optional) - trio>=0.16.0 (optional) ## Installation only sync proxy support: ``` pip install httpx-socks ``` to include optional asyncio support (it requires async-timeout): ``` pip install httpx-socks[asyncio] ``` to include optional trio support: ``` pip install httpx-socks[trio] ``` ## Usage #### sync transport ```python import httpx from httpx_socks import SyncProxyTransport def fetch(url): transport = SyncProxyTransport.from_url('socks5://user:password@127.0.0.1:1080') with httpx.Client(transport=transport) as client: res = client.get(url) return res.text ``` #### async transport (asyncio, trio) ```python import httpx from httpx_socks import AsyncProxyTransport async def fetch(url): transport = AsyncProxyTransport.from_url('socks5://user:password@127.0.0.1:1080') async with httpx.AsyncClient(transport=transport) as client: res = await client.get(url) return res.text ``` #### secure proxy connections (aka "HTTPS proxies", experimental feature, both sync and async support) ```python import ssl import httpx from httpx_socks import AsyncProxyTransport async def fetch(url): proxy_ssl = ssl.SSLContext(ssl.PROTOCOL_TLS) proxy_ssl.verify_mode = ssl.CERT_REQUIRED proxy_ssl.load_verify_locations(...) transport = AsyncProxyTransport.from_url('http://user:password@127.0.0.1:8080', proxy_ssl=proxy_ssl) async with httpx.AsyncClient(transport=transport) as client: res = await client.get(url) return res.text ``` %prep %autosetup -n httpx-socks-0.7.5 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-httpx-socks -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Mon Apr 10 2023 Python_Bot - 0.7.5-1 - Package Spec generated