No project description provided
Project description
basic-return
Manage function returns with a generic class
Getting started
You can get basic-return
from PyPI,
which means it's easily installable with pip
:
python -m pip install basic-return
Example usage
from basic_return.BasicReturn import BasicReturn
def function(a, b, c=30, d=50):
br = BasicReturn()
if a < 10:
br.status = 10
br.message = "param a is less than 10"
br.payload = {"something": 123456789}
return br
if b > 20:
br.status = -10
br.message = "param b is bigger than 20"
return br
br.status = 20
br.message = "param a is less than 10"
return br
br = function(10, 20, d=40)
if br.status < 0:
print(br.owner_call) # function(a=10, b=20, c=30, d=40); this is how the function was called so we can replicate the error
raise Exception(f"Something bad happens: [{br.status}] - {br.message}")
Changelog
Refer to the CHANGELOG.md file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
basic_return-0.1.0.4.tar.gz
(4.6 kB
view hashes)
Built Distribution
Close
Hashes for basic_return-0.1.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ff9e1619431cef8eb986cc25121cab912edbabed6b3630419a6812d2aa5b1a7 |
|
MD5 | 7786a6116237f73f692db10697dbbc1c |
|
BLAKE2b-256 | ebfeec8cb64851c58c5c7c0a9b09085681ce16c639700410a2afd4079240d443 |