|
|
|
@ -11,7 +11,7 @@ API_KEY_URL = 'https://hub.ultralytics.com/settings?tab=api+keys'
|
|
|
|
|
class Auth:
|
|
|
|
|
id_token = api_key = model_key = False
|
|
|
|
|
|
|
|
|
|
def __init__(self, api_key=''):
|
|
|
|
|
def __init__(self, api_key='', verbose=True):
|
|
|
|
|
"""
|
|
|
|
|
Initialize the Auth class with an optional API key.
|
|
|
|
|
|
|
|
|
@ -29,6 +29,7 @@ class Auth:
|
|
|
|
|
# If the provided API key matches the API key in the SETTINGS
|
|
|
|
|
if self.api_key == SETTINGS.get('api_key'):
|
|
|
|
|
# Log that the user is already logged in
|
|
|
|
|
if verbose:
|
|
|
|
|
LOGGER.info(f'{PREFIX}Authenticated ✅')
|
|
|
|
|
return
|
|
|
|
|
else:
|
|
|
|
@ -46,8 +47,9 @@ class Auth:
|
|
|
|
|
if success:
|
|
|
|
|
set_settings({'api_key': self.api_key})
|
|
|
|
|
# Log that the new login was successful
|
|
|
|
|
if verbose:
|
|
|
|
|
LOGGER.info(f'{PREFIX}New authentication successful ✅')
|
|
|
|
|
else:
|
|
|
|
|
elif verbose:
|
|
|
|
|
LOGGER.info(f'{PREFIX}Retrieve API key from {API_KEY_URL}')
|
|
|
|
|
|
|
|
|
|
def request_api_key(self, max_attempts=3):
|
|
|
|
|