Decorator to return a default value for a function when offline
Project description
## Decorator to return a default value for a function when offline
Decorate your functions with a default value and set OfflineSandbox.SANDBOX to your Online/Offline status
```
import OfflineSandbox
OfflineSandbox.SANDBOX = False
@OfflineSandbox.offline_sandbox_value('mundo')
def greet():
return 'hola'
print(greet())
OfflineSandbox.SANDBOX = True
print(greet())
```
You can also respond given the availability of a specific URL
```
@OfflineSandbox.offline_sandbox_value('mundo', url='https://im-online.herokuapp.com/')
def greet_with_url():
return 'hola'
print(greet_with_url())
```
Decorate your functions with a default value and set OfflineSandbox.SANDBOX to your Online/Offline status
```
import OfflineSandbox
OfflineSandbox.SANDBOX = False
@OfflineSandbox.offline_sandbox_value('mundo')
def greet():
return 'hola'
print(greet())
OfflineSandbox.SANDBOX = True
print(greet())
```
You can also respond given the availability of a specific URL
```
@OfflineSandbox.offline_sandbox_value('mundo', url='https://im-online.herokuapp.com/')
def greet_with_url():
return 'hola'
print(greet_with_url())
```
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
offline_sandbox-1.tar.gz
(1.6 kB
view details)
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file offline_sandbox-1.tar.gz.
File metadata
- Download URL: offline_sandbox-1.tar.gz
- Upload date:
- Size: 1.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0ab1f456a4e452f5df7f2d43d3a388f0f03d1f13ab31f02323a3d4f9b4e009d
|
|
| MD5 |
b03d9a943ce7f2a04973a4cba141f720
|
|
| BLAKE2b-256 |
cb34488fb7819f6a4976f0ff6ca05d6c21dd6588d6a43344786a172518043e5b
|
File details
Details for the file offline_sandbox-1-py3-none-any.whl.
File metadata
- Download URL: offline_sandbox-1-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df4ede388b32b3e85ea6b7e68c69ec35742177d86baf01081a1b54e929edc18a
|
|
| MD5 |
b9d96997fd25ff682cf9ade155083109
|
|
| BLAKE2b-256 |
e0723957adb18e1ac9f4c828de857debf0b710c74e15e663c6afef2145c589f0
|
File details
Details for the file offline_sandbox-1-py2.py3-none-any.whl.
File metadata
- Download URL: offline_sandbox-1-py2.py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c31294a573b5bee7360e14a60812437c3e020cb23d3b97f45a27dd082d36db29
|
|
| MD5 |
dab65ff936eacb8b388994dc716a423c
|
|
| BLAKE2b-256 |
ec5ac8c463a985886afa23cb198c2a939261b8edbfa9dff4541da194ee36ff3f
|