Authentication#
Here are some functions to help with the handling of the authentication key.
- get_auth_key(firstName: str, lastName: str = '', email: str = '', work_email: str = '', phone: str = '', company: str = '', company_size: str = '', jobtitle: str = '', code_skills: str = '')#
Request an auth key to use JAI-SDK with.
- Parameters:
firstName (str) – User’s first name.
lastName (str) – User’s last name.
email (str) – A valid email address where the auth key will be sent to.
work_email (str) – A valid business email address where the auth key will be sent to.
phone (str) – Phone number.
company (str) – User’s company.
company_size (str) – User’s company size.
jobtitle (str) – User’s job title.
coding (str) – If the user has experience coding.
- Returns:
`response` – A Response object with whether or not the auth key was created.
- Return type:
dict
Example
>>> from jai import get_auth_key >>> r = get_auth_key(email='email@mail.com', firstName='Jai', lastName='Z') >>> print(r.status_code) # This should be 201 >>> print(r.json())
- get_authentication(env_var: str = 'JAI_AUTH')#
Returns the authentication key if defined. See Configuring your auth key.
- Parameters:
env_var (str, optional) – Environment variable name. Defaults to “JAI_AUTH”.
- Raises:
ValueError – If no authentication key was found.
- Returns:
Authentication Key.
- Return type:
str
Example
>>> from jai import get_authentication >>> get_authentication()
- set_authentication(auth_key: str, env_var: str = 'JAI_AUTH')#
Sets the environment variable with the authentication key.
- Parameters:
auth_key (str) – Authentication key value.
env_var (str, optional) – Environment variable name. Defaults to “JAI_AUTH”.
Example
>>> from jai import set_authentication >>> set_authentication("xXxxxXXxXXxXXxXXxXXxXXxXXxxx")