summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-15 05:26:38 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-15 05:26:38 +0000
commit7bdf32e3534eb97e2d080588395879d5d8bf7066 (patch)
treeb40efa372fc21a0ff4b4657520964e8e5a22e94e
parenta59dd9f1b9197df897a42cba4804014631b84f01 (diff)
automatic import of python-arequest
-rw-r--r--.gitignore1
-rw-r--r--python-arequest.spec512
-rw-r--r--sources1
3 files changed, 514 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..8755f1a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/arequest-0.2.14.tar.gz
diff --git a/python-arequest.spec b/python-arequest.spec
new file mode 100644
index 0000000..301b3ac
--- /dev/null
+++ b/python-arequest.spec
@@ -0,0 +1,512 @@
+%global _empty_manifest_terminate_build 0
+Name: python-arequest
+Version: 0.2.14
+Release: 1
+Summary: arequest is an async HTTP client for Python, with more customization.
+License: Apache 2.0
+URL: https://github.com/p7e4/arequest
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/b1/ec/f4079af7351daf35dd8e7620c23acf3b1e773eebd9f928fea4a7a24057af/arequest-0.2.14.tar.gz
+BuildArch: noarch
+
+Requires: python3-chardet
+Requires: python3-h11
+
+%description
+# arequest
+
+![PyPI](https://img.shields.io/pypi/v/arequest) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/arequest) ![Downloads](https://pepy.tech/badge/arequest) ![PyPI - License](https://img.shields.io/pypi/l/arequest)
+
+_arequest is an async HTTP client for Python, with more customization._
+
+
+## Warnning
+
+**The arequest is experimental for now, please do not use for production environment.**
+
+
+## Installation
+
+`pip install arequest`
+
+> *python3.8 or higher version is required.*
+
+
+## Quickstart
+
+It's requests-like, just don't forget `async/await`.
+
+``` python
+import asyncio
+import arequest
+
+async def main():
+ r = await arequest.get("https://httpbin.org/get")
+ print(r.headers)
+ print(r.status_code)
+ print(r.encoding)
+ print(r.text)
+
+asyncio.run(main())
+```
+
+## Request
+
+### Passing Parameters In URLs
+
+``` python
+await arequest.get("https://httpbin.org/get", params={"key": "value"})
+```
+
+### POST
+
+``` python
+await arequest.post("https://httpbin.org/post", data={"key": "value"})
+```
+
+- POST JSON
+
+``` python
+await arequest.post("https://httpbin.org/post", json={"key": "value"})
+```
+
+### Reuse a connection
+
+``` python
+async with arequest.Session() as session:
+ await session.get("https://httpbin.org/get")
+ await session.get("https://httpbin.org/get")
+ ...
+```
+> *unlike `requests.Session()`, it does not automatically handle `Set-Cookie`*
+
+### Custom Headers
+
+``` python
+headers = {
+ "user-agent": "test"
+}
+await arequest.get("https://httpbin.org/get", headers=headers)
+```
+
+if you want to set header `Content-Type`, use `contentType`.
+
+``` python
+await arequest.post("https://httpbin.org/post", contentType="application/test")
+```
+
+### Custom cookies
+
+``` python
+await arequest.get("https://httpbin.org/cookies", cookies={"key": "value"})
+```
+
+### Unverified SSL Cert
+
+``` python
+await arequest.get("https://httpbin.org/get", verify=False)
+```
+
+### Retry
+
+``` python
+await arequest.get("https://httpbin.org/get", retries=1)
+```
+max retries, default `0`
+
+### Timeout
+``` python
+try:
+ await arequest.get("http://httpbin.org/delay/5", timeout=3)
+except arequest.TimeoutError:
+ print("timeout")
+```
+if timeout is `None`, wait until the request complete. default `30`s
+
+## Response
+
+```python
+print(r.headers)
+print(r.status_code)
+print(r.encoding)
+print(r.text)
+print(r.json())
+```
+
+### Binary Response Content
+
+``` python
+r.content
+```
+
+### Cookies
+``` python
+r.cookies
+```
+
+
+
+## TODO
+- [x] timeout
+- [ ] file upload
+- [ ] proxy
+- [x] keep-alive
+- [ ] http2
+- [ ] raw request
+- [x] cookies handle
+- [x] response cookies
+- [ ] test coverage
+
+
+
+
+
+%package -n python3-arequest
+Summary: arequest is an async HTTP client for Python, with more customization.
+Provides: python-arequest
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-arequest
+# arequest
+
+![PyPI](https://img.shields.io/pypi/v/arequest) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/arequest) ![Downloads](https://pepy.tech/badge/arequest) ![PyPI - License](https://img.shields.io/pypi/l/arequest)
+
+_arequest is an async HTTP client for Python, with more customization._
+
+
+## Warnning
+
+**The arequest is experimental for now, please do not use for production environment.**
+
+
+## Installation
+
+`pip install arequest`
+
+> *python3.8 or higher version is required.*
+
+
+## Quickstart
+
+It's requests-like, just don't forget `async/await`.
+
+``` python
+import asyncio
+import arequest
+
+async def main():
+ r = await arequest.get("https://httpbin.org/get")
+ print(r.headers)
+ print(r.status_code)
+ print(r.encoding)
+ print(r.text)
+
+asyncio.run(main())
+```
+
+## Request
+
+### Passing Parameters In URLs
+
+``` python
+await arequest.get("https://httpbin.org/get", params={"key": "value"})
+```
+
+### POST
+
+``` python
+await arequest.post("https://httpbin.org/post", data={"key": "value"})
+```
+
+- POST JSON
+
+``` python
+await arequest.post("https://httpbin.org/post", json={"key": "value"})
+```
+
+### Reuse a connection
+
+``` python
+async with arequest.Session() as session:
+ await session.get("https://httpbin.org/get")
+ await session.get("https://httpbin.org/get")
+ ...
+```
+> *unlike `requests.Session()`, it does not automatically handle `Set-Cookie`*
+
+### Custom Headers
+
+``` python
+headers = {
+ "user-agent": "test"
+}
+await arequest.get("https://httpbin.org/get", headers=headers)
+```
+
+if you want to set header `Content-Type`, use `contentType`.
+
+``` python
+await arequest.post("https://httpbin.org/post", contentType="application/test")
+```
+
+### Custom cookies
+
+``` python
+await arequest.get("https://httpbin.org/cookies", cookies={"key": "value"})
+```
+
+### Unverified SSL Cert
+
+``` python
+await arequest.get("https://httpbin.org/get", verify=False)
+```
+
+### Retry
+
+``` python
+await arequest.get("https://httpbin.org/get", retries=1)
+```
+max retries, default `0`
+
+### Timeout
+``` python
+try:
+ await arequest.get("http://httpbin.org/delay/5", timeout=3)
+except arequest.TimeoutError:
+ print("timeout")
+```
+if timeout is `None`, wait until the request complete. default `30`s
+
+## Response
+
+```python
+print(r.headers)
+print(r.status_code)
+print(r.encoding)
+print(r.text)
+print(r.json())
+```
+
+### Binary Response Content
+
+``` python
+r.content
+```
+
+### Cookies
+``` python
+r.cookies
+```
+
+
+
+## TODO
+- [x] timeout
+- [ ] file upload
+- [ ] proxy
+- [x] keep-alive
+- [ ] http2
+- [ ] raw request
+- [x] cookies handle
+- [x] response cookies
+- [ ] test coverage
+
+
+
+
+
+%package help
+Summary: Development documents and examples for arequest
+Provides: python3-arequest-doc
+%description help
+# arequest
+
+![PyPI](https://img.shields.io/pypi/v/arequest) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/arequest) ![Downloads](https://pepy.tech/badge/arequest) ![PyPI - License](https://img.shields.io/pypi/l/arequest)
+
+_arequest is an async HTTP client for Python, with more customization._
+
+
+## Warnning
+
+**The arequest is experimental for now, please do not use for production environment.**
+
+
+## Installation
+
+`pip install arequest`
+
+> *python3.8 or higher version is required.*
+
+
+## Quickstart
+
+It's requests-like, just don't forget `async/await`.
+
+``` python
+import asyncio
+import arequest
+
+async def main():
+ r = await arequest.get("https://httpbin.org/get")
+ print(r.headers)
+ print(r.status_code)
+ print(r.encoding)
+ print(r.text)
+
+asyncio.run(main())
+```
+
+## Request
+
+### Passing Parameters In URLs
+
+``` python
+await arequest.get("https://httpbin.org/get", params={"key": "value"})
+```
+
+### POST
+
+``` python
+await arequest.post("https://httpbin.org/post", data={"key": "value"})
+```
+
+- POST JSON
+
+``` python
+await arequest.post("https://httpbin.org/post", json={"key": "value"})
+```
+
+### Reuse a connection
+
+``` python
+async with arequest.Session() as session:
+ await session.get("https://httpbin.org/get")
+ await session.get("https://httpbin.org/get")
+ ...
+```
+> *unlike `requests.Session()`, it does not automatically handle `Set-Cookie`*
+
+### Custom Headers
+
+``` python
+headers = {
+ "user-agent": "test"
+}
+await arequest.get("https://httpbin.org/get", headers=headers)
+```
+
+if you want to set header `Content-Type`, use `contentType`.
+
+``` python
+await arequest.post("https://httpbin.org/post", contentType="application/test")
+```
+
+### Custom cookies
+
+``` python
+await arequest.get("https://httpbin.org/cookies", cookies={"key": "value"})
+```
+
+### Unverified SSL Cert
+
+``` python
+await arequest.get("https://httpbin.org/get", verify=False)
+```
+
+### Retry
+
+``` python
+await arequest.get("https://httpbin.org/get", retries=1)
+```
+max retries, default `0`
+
+### Timeout
+``` python
+try:
+ await arequest.get("http://httpbin.org/delay/5", timeout=3)
+except arequest.TimeoutError:
+ print("timeout")
+```
+if timeout is `None`, wait until the request complete. default `30`s
+
+## Response
+
+```python
+print(r.headers)
+print(r.status_code)
+print(r.encoding)
+print(r.text)
+print(r.json())
+```
+
+### Binary Response Content
+
+``` python
+r.content
+```
+
+### Cookies
+``` python
+r.cookies
+```
+
+
+
+## TODO
+- [x] timeout
+- [ ] file upload
+- [ ] proxy
+- [x] keep-alive
+- [ ] http2
+- [ ] raw request
+- [x] cookies handle
+- [x] response cookies
+- [ ] test coverage
+
+
+
+
+
+%prep
+%autosetup -n arequest-0.2.14
+
+%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-arequest -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.14-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..9bbd9eb
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+5e79d2c45f2f5ac88f055f6b52f3e7db arequest-0.2.14.tar.gz