A small pypi project, that allows you to make your own API.
Project description
makeapi
A small package, that allows you to make an API.
Example
import makeapi
request_handler = makeapi.MakeAPIRequestHandler
app = MakeAPI("localhost", 8000, request_handler)
# Currently, it only has get request method.
@app.get("/main")
def main(request : makeapi.Request):
return makeapi.textresp("Hello!")
# Go to http://localhost:8000/main in your browser and you should see Hello!
Example with path params
import makeapi
request_handler = makeapi.MakeAPIRequestHandler
app = MakeAPI("localhost", 8000, request_handler)
@app.get("/params")
def params_route(request : makeapi.Request):
param = request.args.get("hello")
return textparam(param[0])
# Go to http://localhost:8000/params?hello=hi and it should show hi
Enjoy!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
makeapi-1.0.2.tar.gz
(3.5 kB
view details)
Built Distribution
File details
Details for the file makeapi-1.0.2.tar.gz
.
File metadata
- Download URL: makeapi-1.0.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0657eb0f67df759475eb4022821a5644602ecd980ffb20f6cb029edb178da669 |
|
MD5 | e13b455c0187d0766d89b9b4882939c1 |
|
BLAKE2b-256 | c4388d2e1f88006d19894ff6d5f3b47f4d33f0e26679f580684a01c794a4cf77 |
File details
Details for the file makeapi-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: makeapi-1.0.2-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f118361c90b5b1e0021c9800bad9c5fc302352dc74f3733c63699d9cb79f373 |
|
MD5 | 576ccd6d18f25599fae575b3850cbdb2 |
|
BLAKE2b-256 | dd88a838979e95872cda69efb52053f582512bdee137113423b79bc01ee9ad14 |