This is intended to be a server-side client to help with HackRU services that piggyback on lcs login and user data
set_root_url(url: str) -> NoneSets root url. defaults to https://api.hackru.org
set_testing(testing: bool) -> NoneWhether or not to use test endpoint, defaults to False
class User()A user object to easily call other endpoints on behalf of a user
| __init__(email: str = None, password: str = None, token: str = None) -> NoneConstructor logs the user and gets a handle. Requires you to pass a token OR an email and password
| profile() -> DictCall lcs to get the user's profile
| create_dm_link_to(other_user_email: str)Get a link to a slack DM between this User and another user identified by other_user_email
class ResponseError(Exception)Error with an attached HTTP Response
class InternalServerError(ResponseError)An error occurred which prevented LCS from servicing the request
class RequestError(ResponseError)Ideally you shouldn't receive this. There was an issue with the input to the API
class CredentialError(RequestError)There was an issue login in with that credential, or a token is invalid
on_login(fn: Callable)Decorator. Call the decorated function whenever we find a new user Use case: get their profile and update local db. Function should take in the user object as the first param
@lcs_client.on_login
def your_func(user_profile):
# updating the user profile or somethinglogin(email: str, password: str) -> strGets an authentication token by calling the authorize LCS endpoint
validate_token(token: str) -> DictValidates a lcs token
get_profile(auth_token: str, user_email: str = None) -> DictGets the profile of a user associated with user_email. The permissions associated with the auth_token user are used. If no user_email is specified or the user doesn't have enough privilege to view someone else's profile, the profile associated with the auth_token is fetched
create_dm_link_between(token: str, other_user_email: str) -> strGet a dm link to talk with another user on slack
get_base_url() -> strGet the LCS base url
get(endpoint: str, *args, **kwargs) -> requests.models.ResponsePerforms a GET request to a LCS endpoint
post(endpoint: str, *args, **kwargs) -> requests.models.ResponsePerforms a POST request to a LCS endpoint