Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
hub-client / dockerhub / api.py
Size: Mime:
import requests
from django.conf import settings

from dockerhub.utils import get_jwt


def get_hub_user(user):
    url = "{}/v2/users/{}/uuid/".format(settings.DOCKER_IO_HOST, user.uuid.hex)
    jwt = get_jwt(user.username)
    response = requests.get(
        url,
        headers={'Authorization': 'JWT {}'.format(jwt)}
    )
    if response.status_code == requests.codes.ok:
        return response.json()
    else:
        raise Exception(response.content)