%global _empty_manifest_terminate_build 0 Name: python-jj Version: 2.7.3 Release: 1 Summary: Remote HTTP Mock License: Apache-2.0 URL: https://github.com/tsv1/jj Source0: https://mirrors.aliyun.com/pypi/web/packages/13/93/4a6d2a6a5748d40910361878be9c16d88b2cd472eb80bcc8bf6bfbc68c81/jj-2.7.3.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.3 %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 * Fri Jun 09 2023 Python_Bot - 2.7.3-1 - Package Spec generated