How to use the jovian.utils.shared._u 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 / clone.py View on Github external
def get_gist(slug, version, fresh):
    """Download a gist"""
    if '/' in slug:
        parts = slug.split('/')
        username, title = parts[0], parts[1]
        url = _u('user/' + username + '/gist/' + title + _v(version))
    else:
        url = _u('gist/' + slug + _v(version))
    res = get(url, headers=_h(fresh))
    if res.status_code == 200:
        return res.json()['data']
    raise Exception('Failed to retrieve Gist: ' + pretty(res))
github JovianML / jovian-py / jovian / utils / api.py View on Github external
def get_gist_access(slug):
    """Get the access permission of a gist"""
    res = get(url=_u('/gist/' + slug + '/check-access'), headers=_h())
    if res.status_code == 200:
        return res.json()['data']
    raise Exception('Failed to retrieve access permission for notebook "' +
                    slug + '" (retry with new_project=True to create a new notebook): ' + pretty(res))
github JovianML / jovian-py / jovian / utils / api.py View on Github external
def get_current_user():
    res = get(url=_u('/user/profile'), headers=_h())
    if res.status_code == 200:
        return res.json()['data']
    raise Exception('Failed to fetch current user profile. ' + pretty(res))