%global _empty_manifest_terminate_build 0 Name: python-clients Version: 1.4 Release: 1 Summary: High-level HTTP clients for Python. License: Copyright 2022 Aric Coady Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. URL: https://github.com/coady/clients Source0: https://mirrors.nju.edu.cn/pypi/web/packages/91/fa/9431217566695496e7b406ef95b752c0ec717dd8dadb94f59949af7b5679/clients-1.4.tar.gz BuildArch: noarch Requires: python3-httpx %description [![image](https://img.shields.io/pypi/v/clients.svg)](https://pypi.org/project/clients/) ![image](https://img.shields.io/pypi/pyversions/clients.svg) [![image](https://pepy.tech/badge/clients)](https://pepy.tech/project/clients) ![image](https://img.shields.io/pypi/status/clients.svg) [![image](https://github.com/coady/clients/workflows/build/badge.svg)](https://github.com/coady/clients/actions) [![image](https://codecov.io/gh/coady/clients/branch/main/graph/badge.svg)](https://codecov.io/gh/coady/clients/) [![image](https://github.com/coady/clients/workflows/codeql/badge.svg)](https://github.com/coady/clients/security/code-scanning) [![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://pypi.org/project/black/) [![image](http://mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/) Clients originally provided [requests](https://python-requests.org) wrappers to encourage best practices, particularly always using Sessions to connect to the same host or api endpoint. The primary goals were: * provide a `Client` object with a convenient constructor * support a base url so that requests can provide a relative path * provide the same interface for asyncio Since then [httpx](https://www.encode.io/httpx) has emerged as the successor to `requests`, and supports the above features natively. So `clients.Client` can be replaced with `httpx.Client` for most use cases. The project will continue to be maintained for additional features, such as the `Resource` object. ## Usage Typical `requests` usage is redundant and inefficient, by not taking advantage of connection pooling. ```python r = requests.get('https://api.github.com/user', headers={'authorization': token}) r = requests.get('https://api.github.com/user/repos', headers={'authorization': token}) ``` Using sessions is the better approach, but more verbose and in practice requires manual url joining. ```python s = requests.Session() s.headers['authorization'] = token r = s.get('https://api.github.com/user') r = s.get('https://api.github.com/user/repos') ``` ### Client Clients make using sessions easier, with implicit url joining. ```python client = clients.Client('https://api.github.com/', headers={'authorization': token}) r = client.get('user') r = client.get('user/repos') ``` ### Resource Resources extend Clients to implicitly handle response content, with proper checking of status_code and content-type. ```python github = clients.Resource('https://api.github.com/', headers={'authorization': token}) for repo in github.get('user/repos', params={'visibility': 'public'}): ... ``` Resources also implement syntactic support for methods such as __getattr__ and __call__, providing most of the benefits of custom clients as is. ```python for repo in github.user.repos(visibility='public'): ... ``` Asynchronous variants of all client types are provided, e.g., `AsyncClient`. Additional clients for [RPC](https://en.wikipedia.org/wiki/Remote_procedure_call), [GraphQL](http://graphql.org), and proxies also provided. ## Installation ```console % pip install clients ``` ## Dependencies * httpx >=0.23 ## Tests 100% branch coverage. ```console % pytest [--cov] ``` ## Changes 1.4 * `requests` removed * Python >=3.7 required * httpx >=0.23 required 1.3 * httpx >=0.15 required * requests deprecated 1.2 * Python 3 required * httpx >=0.11 required 1.1 * Async switched to httpx 1.0 * Allow missing content-type * Oauth access tokens supported in authorization header 0.5 * `AsyncClient` default params * `Remote` and `AsyncRemote` procedure calls * `Graph` and `AsyncGraph` execute GraphQL queries * `Proxy` and `AsyncProxy` clients 0.4 * Asynchronous clients and resources 0.3 * `singleton` decorator 0.2 * Resource attribute upcasts back to a `client` * `iter` and `download` implement GET requests with streamed content * `create` implements POST request and returns Location header * `update` implements PATCH request with json params * `__call__` implements GET request with params %package -n python3-clients Summary: High-level HTTP clients for Python. Provides: python-clients BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-clients [![image](https://img.shields.io/pypi/v/clients.svg)](https://pypi.org/project/clients/) ![image](https://img.shields.io/pypi/pyversions/clients.svg) [![image](https://pepy.tech/badge/clients)](https://pepy.tech/project/clients) ![image](https://img.shields.io/pypi/status/clients.svg) [![image](https://github.com/coady/clients/workflows/build/badge.svg)](https://github.com/coady/clients/actions) [![image](https://codecov.io/gh/coady/clients/branch/main/graph/badge.svg)](https://codecov.io/gh/coady/clients/) [![image](https://github.com/coady/clients/workflows/codeql/badge.svg)](https://github.com/coady/clients/security/code-scanning) [![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://pypi.org/project/black/) [![image](http://mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/) Clients originally provided [requests](https://python-requests.org) wrappers to encourage best practices, particularly always using Sessions to connect to the same host or api endpoint. The primary goals were: * provide a `Client` object with a convenient constructor * support a base url so that requests can provide a relative path * provide the same interface for asyncio Since then [httpx](https://www.encode.io/httpx) has emerged as the successor to `requests`, and supports the above features natively. So `clients.Client` can be replaced with `httpx.Client` for most use cases. The project will continue to be maintained for additional features, such as the `Resource` object. ## Usage Typical `requests` usage is redundant and inefficient, by not taking advantage of connection pooling. ```python r = requests.get('https://api.github.com/user', headers={'authorization': token}) r = requests.get('https://api.github.com/user/repos', headers={'authorization': token}) ``` Using sessions is the better approach, but more verbose and in practice requires manual url joining. ```python s = requests.Session() s.headers['authorization'] = token r = s.get('https://api.github.com/user') r = s.get('https://api.github.com/user/repos') ``` ### Client Clients make using sessions easier, with implicit url joining. ```python client = clients.Client('https://api.github.com/', headers={'authorization': token}) r = client.get('user') r = client.get('user/repos') ``` ### Resource Resources extend Clients to implicitly handle response content, with proper checking of status_code and content-type. ```python github = clients.Resource('https://api.github.com/', headers={'authorization': token}) for repo in github.get('user/repos', params={'visibility': 'public'}): ... ``` Resources also implement syntactic support for methods such as __getattr__ and __call__, providing most of the benefits of custom clients as is. ```python for repo in github.user.repos(visibility='public'): ... ``` Asynchronous variants of all client types are provided, e.g., `AsyncClient`. Additional clients for [RPC](https://en.wikipedia.org/wiki/Remote_procedure_call), [GraphQL](http://graphql.org), and proxies also provided. ## Installation ```console % pip install clients ``` ## Dependencies * httpx >=0.23 ## Tests 100% branch coverage. ```console % pytest [--cov] ``` ## Changes 1.4 * `requests` removed * Python >=3.7 required * httpx >=0.23 required 1.3 * httpx >=0.15 required * requests deprecated 1.2 * Python 3 required * httpx >=0.11 required 1.1 * Async switched to httpx 1.0 * Allow missing content-type * Oauth access tokens supported in authorization header 0.5 * `AsyncClient` default params * `Remote` and `AsyncRemote` procedure calls * `Graph` and `AsyncGraph` execute GraphQL queries * `Proxy` and `AsyncProxy` clients 0.4 * Asynchronous clients and resources 0.3 * `singleton` decorator 0.2 * Resource attribute upcasts back to a `client` * `iter` and `download` implement GET requests with streamed content * `create` implements POST request and returns Location header * `update` implements PATCH request with json params * `__call__` implements GET request with params %package help Summary: Development documents and examples for clients Provides: python3-clients-doc %description help [![image](https://img.shields.io/pypi/v/clients.svg)](https://pypi.org/project/clients/) ![image](https://img.shields.io/pypi/pyversions/clients.svg) [![image](https://pepy.tech/badge/clients)](https://pepy.tech/project/clients) ![image](https://img.shields.io/pypi/status/clients.svg) [![image](https://github.com/coady/clients/workflows/build/badge.svg)](https://github.com/coady/clients/actions) [![image](https://codecov.io/gh/coady/clients/branch/main/graph/badge.svg)](https://codecov.io/gh/coady/clients/) [![image](https://github.com/coady/clients/workflows/codeql/badge.svg)](https://github.com/coady/clients/security/code-scanning) [![image](https://img.shields.io/badge/code%20style-black-000000.svg)](https://pypi.org/project/black/) [![image](http://mypy-lang.org/static/mypy_badge.svg)](http://mypy-lang.org/) Clients originally provided [requests](https://python-requests.org) wrappers to encourage best practices, particularly always using Sessions to connect to the same host or api endpoint. The primary goals were: * provide a `Client` object with a convenient constructor * support a base url so that requests can provide a relative path * provide the same interface for asyncio Since then [httpx](https://www.encode.io/httpx) has emerged as the successor to `requests`, and supports the above features natively. So `clients.Client` can be replaced with `httpx.Client` for most use cases. The project will continue to be maintained for additional features, such as the `Resource` object. ## Usage Typical `requests` usage is redundant and inefficient, by not taking advantage of connection pooling. ```python r = requests.get('https://api.github.com/user', headers={'authorization': token}) r = requests.get('https://api.github.com/user/repos', headers={'authorization': token}) ``` Using sessions is the better approach, but more verbose and in practice requires manual url joining. ```python s = requests.Session() s.headers['authorization'] = token r = s.get('https://api.github.com/user') r = s.get('https://api.github.com/user/repos') ``` ### Client Clients make using sessions easier, with implicit url joining. ```python client = clients.Client('https://api.github.com/', headers={'authorization': token}) r = client.get('user') r = client.get('user/repos') ``` ### Resource Resources extend Clients to implicitly handle response content, with proper checking of status_code and content-type. ```python github = clients.Resource('https://api.github.com/', headers={'authorization': token}) for repo in github.get('user/repos', params={'visibility': 'public'}): ... ``` Resources also implement syntactic support for methods such as __getattr__ and __call__, providing most of the benefits of custom clients as is. ```python for repo in github.user.repos(visibility='public'): ... ``` Asynchronous variants of all client types are provided, e.g., `AsyncClient`. Additional clients for [RPC](https://en.wikipedia.org/wiki/Remote_procedure_call), [GraphQL](http://graphql.org), and proxies also provided. ## Installation ```console % pip install clients ``` ## Dependencies * httpx >=0.23 ## Tests 100% branch coverage. ```console % pytest [--cov] ``` ## Changes 1.4 * `requests` removed * Python >=3.7 required * httpx >=0.23 required 1.3 * httpx >=0.15 required * requests deprecated 1.2 * Python 3 required * httpx >=0.11 required 1.1 * Async switched to httpx 1.0 * Allow missing content-type * Oauth access tokens supported in authorization header 0.5 * `AsyncClient` default params * `Remote` and `AsyncRemote` procedure calls * `Graph` and `AsyncGraph` execute GraphQL queries * `Proxy` and `AsyncProxy` clients 0.4 * Asynchronous clients and resources 0.3 * `singleton` decorator 0.2 * Resource attribute upcasts back to a `client` * `iter` and `download` implement GET requests with streamed content * `create` implements POST request and returns Location header * `update` implements PATCH request with json params * `__call__` implements GET request with params %prep %autosetup -n clients-1.4 %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-clients -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Fri May 05 2023 Python_Bot - 1.4-1 - Package Spec generated