How to use the jovian.utils.credentials.get_api_key function in jovian

To help you get started, we’ve selected a few jovian examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JovianML / jovian-py / jovian / utils / slack.py View on Github external
def _h():
    """Create a header to provide library metadata"""
    return {"Authorization": "Bearer " + get_api_key(),
            "x-jovian-source": "library",
            "x-jovian-library-version": __version__,
            "x-jovian-command": "add-slack",
            "x-jovian-guest": get_guest_key(),
            "x-jovian-org": read_org_id()}
github JovianML / jovian-py / jovian / utils / api.py View on Github external
def _h():
    """Create authorization header with API key"""
    return {"Authorization": "Bearer " + get_api_key(),
            "x-jovian-source": "library",
            "x-jovian-library-version": __version__,
            "x-jovian-guest": get_guest_key(),
            "x-jovian-org": read_org_id()}
github JovianML / jovian-py / jovian / utils / request.py View on Github external
def _request_wrapper(*args, **kwargs):
        for i in range(2):
            res = request(*args, **kwargs)
            if res.status_code == 401:
                log('The current API key is invalid or expired.', error=True)
                purge_api_key()

                # This will ensure that fresh api token is requested
                if 'headers' in kwargs:
                    kwargs['headers']['Authorization'] = "Bearer " + get_api_key()
            else:
                return res
        return res