Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/simoso68/backpipe
Backend HTTP framework for Python.
https://github.com/simoso68/backpipe
api backend framework http internet package pypi python server www
Last synced: 3 months ago
JSON representation
Backend HTTP framework for Python.
- Host: GitHub
- URL: https://github.com/simoso68/backpipe
- Owner: Simoso68
- License: gpl-3.0
- Created: 2023-11-05T02:58:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-30T22:25:08.000Z (6 months ago)
- Last Synced: 2024-08-31T02:52:41.782Z (5 months ago)
- Topics: api, backend, framework, http, internet, package, pypi, python, server, www
- Language: Python
- Homepage: https://backpipe.streamlit.app
- Size: 137 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
Backpipe
Back-Ends simplified.
pip install backpipe## Info
Backpipe tries to support all operating systems. \
But its primary focus lies on Linux support, \
as it is the main choice for website hosting. \
\
Running it on Windows might lead to issues and is not recommended.## Why the name?
The name 'Backpipe' is inspired by the english word 'Bagpipe'. \
I decided to call it 'Backpipe', because it is a **Back**-End Framework. \
It is just a little pun.## Samples
### Hello World!
```python
import backpipeserver = backpipe.BackPipe()
@server.get()
def hello_world(r: backpipe.Request):
return (200, "Hello World")server.run()
```### What is my IP address?
```python
import backpipeserver = backpipe.BackPipe()
@server.get()
def my_ip_address(r: backpipe.Request):
return (200, r.address)server.run()
```### Complex Example
```python
import backpipeserver = backpipe.BackPipe()
@server.any()
def wrong_method(r: backpipe.Request):
return (405, f"Wrong method: {r.method}, use POST.")@server.unknown()
def unknown_method(r: backpipe.Request):
return (405, f"Unknown method: {r.method}, use POST.")@server.post()
def login(r: backpipe.Request):
try:
if r.headers["key"] == "password1234":
return (200, "Password correct!")
else:
return (304, "Password wrong!")
except KeyError:
return (400, "invalid request, 'key' header missing.")server.run()
```### Using Request Bodies
```python
import backpipeserver = backpipe.BackPipe()
@server.post()
def respond(r: backpipe.Request):
return (200, r.body) # Returns the client's request bodyserver.run()
```## Known issues
- URI-too-long message raises error on client-side when using Python requests
- Limited client information on URI-too-long message (probably unfixable.)## HTTPS notice
When activating HTTPS, you need to sign your certificate file \
with a key provided by a trusted authority. \
\
Self-signing your certificate will make tools such as \
CURL, your Browser, etc. raise a warning, \
that the website may be unsafe.## Documentation
Read through the [Documentation](https://backpipe.streamlit.app), \
to get started with backpipe## License
Backpipe is licensed under the GNU GPL v3.