summaryrefslogtreecommitdiff
path: root/python-jj.spec
diff options
context:
space:
mode:
Diffstat (limited to 'python-jj.spec')
-rw-r--r--python-jj.spec341
1 files changed, 341 insertions, 0 deletions
diff --git a/python-jj.spec b/python-jj.spec
new file mode 100644
index 0000000..8e7d6ca
--- /dev/null
+++ b/python-jj.spec
@@ -0,0 +1,341 @@
+%global _empty_manifest_terminate_build 0
+Name: python-jj
+Version: 2.7.2
+Release: 1
+Summary: Remote HTTP Mock
+License: Apache-2.0
+URL: https://github.com/tsv1/jj
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/69/88/52f149c2574ede7044e9d5f21021f9a522dd9d82986f467a066c79920950/jj-2.7.2.tar.gz
+BuildArch: noarch
+
+Requires: python3-aiohttp
+Requires: python3-multidict
+Requires: python3-packed
+Requires: python3-rtry
+Requires: python3-undecorated
+
+%description
+### Matchers
+#### Method
+##### match_method(`method`)
+```python
+from jj.http.methods import GET
+@jj.match_method(GET)
+async def handler(request):
+ return jj.Response(body="Method: " + request.method)
+```
+##### match_methods(`methods`)
+```python
+from jj.http.methods import PUT, PATCH
+@jj.match_methods(PUT, PATCH)
+async def handler(request):
+ return jj.Response(body="Method: " + request.method)
+```
+#### Path
+##### match_path(`path`)
+```python
+@jj.match_path("/users")
+async def handler(request):
+ return jj.Response(body="Path: " + request.path)
+```
+#### Segments
+```python
+@jj.match_path("/users/{users_id}")
+async def handler(request):
+ return jj.Response(body=f"Segments: {request.segments}")
+```
+More information available here https://docs.aiohttp.org/en/stable/web_quickstart.html#variable-resources
+#### Params
+##### match_param(`name`, `val`)
+```python
+@jj.match_param("locale", "en_US")
+async def handler(request):
+ locales = request.params.getall('locale')
+ return jj.Response(body="Locales: " + ",".join(locales))
+```
+##### match_params(`params`)
+```python
+@jj.match_params({"locale": "en_US", "timezone": "UTC"})
+async def handler(request):
+ # Literal String Interpolation (PEP 498)
+ return jj.Response(body=f"Params: {request.params}")
+```
+#### Headers
+##### match_header(`name`, `val`)
+```python
+@jj.match_header("X-Forwarded-Proto", "https")
+async def handler(request):
+ proto = request.headers.getone("X-Forwarded-Proto")
+ return jj.Response(body="Proto: " + proto)
+```
+##### match_headers(`headers`)
+```python
+@jj.match_headers({
+ "x-user-id": "1432",
+ "x-client-id": "iphone",
+})
+async def handler(request):
+ return jj.Response(body=f"Headers: {request.headers}")
+```
+#### Combining Matchers
+##### match_any(`matchers`)
+```python
+from jj.http import PATCH, PUT
+@jj.match_any([
+ jj.match_method(PUT),
+ jj.match_method(PATCH),
+])
+async def handler(request):
+ return jj.Response(body="200 OK")
+```
+##### match_all(`matchers`)
+```python
+@jj.match_all([
+ jj.match_method("*"),
+ jj.match_path("/"),
+ jj.match_params({"locale": "en_US"}),
+ jj.match_headers({"x-request-id": "0fefbf48"}),
+])
+async def handler(request):
+ return jj.Response(body="200 OK")
+```
+##### match(`method`, `path`, `params`, `headers`)
+```python
+@jj.match("*", "/", {"locale": "en_US"}, {"x-request-id": "0fefbf48"})
+async def handler(request):
+ return jj.Response(body="200 OK")
+
+%package -n python3-jj
+Summary: Remote HTTP Mock
+Provides: python-jj
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-jj
+### Matchers
+#### Method
+##### match_method(`method`)
+```python
+from jj.http.methods import GET
+@jj.match_method(GET)
+async def handler(request):
+ return jj.Response(body="Method: " + request.method)
+```
+##### match_methods(`methods`)
+```python
+from jj.http.methods import PUT, PATCH
+@jj.match_methods(PUT, PATCH)
+async def handler(request):
+ return jj.Response(body="Method: " + request.method)
+```
+#### Path
+##### match_path(`path`)
+```python
+@jj.match_path("/users")
+async def handler(request):
+ return jj.Response(body="Path: " + request.path)
+```
+#### Segments
+```python
+@jj.match_path("/users/{users_id}")
+async def handler(request):
+ return jj.Response(body=f"Segments: {request.segments}")
+```
+More information available here https://docs.aiohttp.org/en/stable/web_quickstart.html#variable-resources
+#### Params
+##### match_param(`name`, `val`)
+```python
+@jj.match_param("locale", "en_US")
+async def handler(request):
+ locales = request.params.getall('locale')
+ return jj.Response(body="Locales: " + ",".join(locales))
+```
+##### match_params(`params`)
+```python
+@jj.match_params({"locale": "en_US", "timezone": "UTC"})
+async def handler(request):
+ # Literal String Interpolation (PEP 498)
+ return jj.Response(body=f"Params: {request.params}")
+```
+#### Headers
+##### match_header(`name`, `val`)
+```python
+@jj.match_header("X-Forwarded-Proto", "https")
+async def handler(request):
+ proto = request.headers.getone("X-Forwarded-Proto")
+ return jj.Response(body="Proto: " + proto)
+```
+##### match_headers(`headers`)
+```python
+@jj.match_headers({
+ "x-user-id": "1432",
+ "x-client-id": "iphone",
+})
+async def handler(request):
+ return jj.Response(body=f"Headers: {request.headers}")
+```
+#### Combining Matchers
+##### match_any(`matchers`)
+```python
+from jj.http import PATCH, PUT
+@jj.match_any([
+ jj.match_method(PUT),
+ jj.match_method(PATCH),
+])
+async def handler(request):
+ return jj.Response(body="200 OK")
+```
+##### match_all(`matchers`)
+```python
+@jj.match_all([
+ jj.match_method("*"),
+ jj.match_path("/"),
+ jj.match_params({"locale": "en_US"}),
+ jj.match_headers({"x-request-id": "0fefbf48"}),
+])
+async def handler(request):
+ return jj.Response(body="200 OK")
+```
+##### match(`method`, `path`, `params`, `headers`)
+```python
+@jj.match("*", "/", {"locale": "en_US"}, {"x-request-id": "0fefbf48"})
+async def handler(request):
+ return jj.Response(body="200 OK")
+
+%package help
+Summary: Development documents and examples for jj
+Provides: python3-jj-doc
+%description help
+### Matchers
+#### Method
+##### match_method(`method`)
+```python
+from jj.http.methods import GET
+@jj.match_method(GET)
+async def handler(request):
+ return jj.Response(body="Method: " + request.method)
+```
+##### match_methods(`methods`)
+```python
+from jj.http.methods import PUT, PATCH
+@jj.match_methods(PUT, PATCH)
+async def handler(request):
+ return jj.Response(body="Method: " + request.method)
+```
+#### Path
+##### match_path(`path`)
+```python
+@jj.match_path("/users")
+async def handler(request):
+ return jj.Response(body="Path: " + request.path)
+```
+#### Segments
+```python
+@jj.match_path("/users/{users_id}")
+async def handler(request):
+ return jj.Response(body=f"Segments: {request.segments}")
+```
+More information available here https://docs.aiohttp.org/en/stable/web_quickstart.html#variable-resources
+#### Params
+##### match_param(`name`, `val`)
+```python
+@jj.match_param("locale", "en_US")
+async def handler(request):
+ locales = request.params.getall('locale')
+ return jj.Response(body="Locales: " + ",".join(locales))
+```
+##### match_params(`params`)
+```python
+@jj.match_params({"locale": "en_US", "timezone": "UTC"})
+async def handler(request):
+ # Literal String Interpolation (PEP 498)
+ return jj.Response(body=f"Params: {request.params}")
+```
+#### Headers
+##### match_header(`name`, `val`)
+```python
+@jj.match_header("X-Forwarded-Proto", "https")
+async def handler(request):
+ proto = request.headers.getone("X-Forwarded-Proto")
+ return jj.Response(body="Proto: " + proto)
+```
+##### match_headers(`headers`)
+```python
+@jj.match_headers({
+ "x-user-id": "1432",
+ "x-client-id": "iphone",
+})
+async def handler(request):
+ return jj.Response(body=f"Headers: {request.headers}")
+```
+#### Combining Matchers
+##### match_any(`matchers`)
+```python
+from jj.http import PATCH, PUT
+@jj.match_any([
+ jj.match_method(PUT),
+ jj.match_method(PATCH),
+])
+async def handler(request):
+ return jj.Response(body="200 OK")
+```
+##### match_all(`matchers`)
+```python
+@jj.match_all([
+ jj.match_method("*"),
+ jj.match_path("/"),
+ jj.match_params({"locale": "en_US"}),
+ jj.match_headers({"x-request-id": "0fefbf48"}),
+])
+async def handler(request):
+ return jj.Response(body="200 OK")
+```
+##### match(`method`, `path`, `params`, `headers`)
+```python
+@jj.match("*", "/", {"locale": "en_US"}, {"x-request-id": "0fefbf48"})
+async def handler(request):
+ return jj.Response(body="200 OK")
+
+%prep
+%autosetup -n jj-2.7.2
+
+%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-jj -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed May 31 2023 Python_Bot <Python_Bot@openeuler.org> - 2.7.2-1
+- Package Spec generated