%global _empty_manifest_terminate_build 0 Name: python-dhttp Version: 1.3.3 Release: 1 Summary: A simple, dynamic, decorator-based HTTP server inspired by Node.js's Express. Supports trio, TLS and WebSockets. License: MIT URL: https://pypi.org/project/dhttp/ Source0: https://mirrors.nju.edu.cn/pypi/web/packages/f4/84/102227e6ff6711c6272ff4d10dc1b4576f09628cb4c1dc86dea37ac59437/dhttp-1.3.3.tar.gz BuildArch: noarch Requires: python3-trio Requires: python3-typing Requires: python3-Jinja2 Requires: python3-setuptools Requires: python3-pyOpenSSL %description # dhttp **dhttp**, which is pretty short for _decorable HTTP_, is a simple, yet dynamic, HTTP server written for Python 3. It is inspired by Node.js's Express library. "Decorable" is a reference to how extensively decorators are used throughout this project. They are very useful, and are one of the nicest syntaxes for a callback system like this. ## Example code import dhttp import random app = dhttp.DHTTPServer(int(sys.argv[1]) if len(sys.argv) > 1 else 8005) app.alias('/index', '/') app.alias('/index.htm', '/') app.alias('/index.html', '/') test_index = """
dhttp {version} is now running on your machine.
How about {party} to comemorate? :)
""" party_stuff = [ 'a bottle of wine', 'a bottle of champagne', 'a big party', 'THE party, just', 'THE party', 'lots of cats', 'partyception', 'balloons and cakes', 'a big-endian cake', 'lots of confetti', 'the Confetti-o-Tron 2000', 'HTTP juice', 'Spicy Bytes', 'antimatter', 'cats writing code', 'a smile breaking the 4th wall' ] @app.get('/') def serve_index(req, res): res.end(test_index.format( party = random.choice(party_stuff), version = DHTTP_VERSION )) @app.on_log def print_log(log): if log.request.get_header('X-Forwarded-For') is not None: log.ip = log.request.get_header('X-Forwarded-For') print(log, ' (forwarded)') else: print(log) @app.serve_forever def on_serve(): print(f" == Listening on port: {app.port} ==") %package -n python3-dhttp Summary: A simple, dynamic, decorator-based HTTP server inspired by Node.js's Express. Supports trio, TLS and WebSockets. Provides: python-dhttp BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-dhttp # dhttp **dhttp**, which is pretty short for _decorable HTTP_, is a simple, yet dynamic, HTTP server written for Python 3. It is inspired by Node.js's Express library. "Decorable" is a reference to how extensively decorators are used throughout this project. They are very useful, and are one of the nicest syntaxes for a callback system like this. ## Example code import dhttp import random app = dhttp.DHTTPServer(int(sys.argv[1]) if len(sys.argv) > 1 else 8005) app.alias('/index', '/') app.alias('/index.htm', '/') app.alias('/index.html', '/') test_index = """dhttp {version} is now running on your machine.
How about {party} to comemorate? :)
""" party_stuff = [ 'a bottle of wine', 'a bottle of champagne', 'a big party', 'THE party, just', 'THE party', 'lots of cats', 'partyception', 'balloons and cakes', 'a big-endian cake', 'lots of confetti', 'the Confetti-o-Tron 2000', 'HTTP juice', 'Spicy Bytes', 'antimatter', 'cats writing code', 'a smile breaking the 4th wall' ] @app.get('/') def serve_index(req, res): res.end(test_index.format( party = random.choice(party_stuff), version = DHTTP_VERSION )) @app.on_log def print_log(log): if log.request.get_header('X-Forwarded-For') is not None: log.ip = log.request.get_header('X-Forwarded-For') print(log, ' (forwarded)') else: print(log) @app.serve_forever def on_serve(): print(f" == Listening on port: {app.port} ==") %package help Summary: Development documents and examples for dhttp Provides: python3-dhttp-doc %description help # dhttp **dhttp**, which is pretty short for _decorable HTTP_, is a simple, yet dynamic, HTTP server written for Python 3. It is inspired by Node.js's Express library. "Decorable" is a reference to how extensively decorators are used throughout this project. They are very useful, and are one of the nicest syntaxes for a callback system like this. ## Example code import dhttp import random app = dhttp.DHTTPServer(int(sys.argv[1]) if len(sys.argv) > 1 else 8005) app.alias('/index', '/') app.alias('/index.htm', '/') app.alias('/index.html', '/') test_index = """dhttp {version} is now running on your machine.
How about {party} to comemorate? :)
""" party_stuff = [ 'a bottle of wine', 'a bottle of champagne', 'a big party', 'THE party, just', 'THE party', 'lots of cats', 'partyception', 'balloons and cakes', 'a big-endian cake', 'lots of confetti', 'the Confetti-o-Tron 2000', 'HTTP juice', 'Spicy Bytes', 'antimatter', 'cats writing code', 'a smile breaking the 4th wall' ] @app.get('/') def serve_index(req, res): res.end(test_index.format( party = random.choice(party_stuff), version = DHTTP_VERSION )) @app.on_log def print_log(log): if log.request.get_header('X-Forwarded-For') is not None: log.ip = log.request.get_header('X-Forwarded-For') print(log, ' (forwarded)') else: print(log) @app.serve_forever def on_serve(): print(f" == Listening on port: {app.port} ==") %prep %autosetup -n dhttp-1.3.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-dhttp -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Wed May 31 2023 Python_Bot