Repository URL to install this package:
|
Version:
0.24.7.dev0 ▾
|
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)