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 | RSS feed

This version

1

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 hashes)

Uploaded Source

Built Distributions

offline_sandbox-1-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

offline_sandbox-1-py2.py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page