Skip to main content

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())
```

Project details


Release history Release notifications

This version
History Node

1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
offline_sandbox-1-py2.py3-none-any.whl (3.5 kB) Copy SHA256 hash SHA256 Wheel 3.5
offline_sandbox-1-py3-none-any.whl (3.5 kB) Copy SHA256 hash SHA256 Wheel 3.5
offline_sandbox-1.tar.gz (1.6 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page