This commit is contained in:
parent
a8ef29422d
commit
adfe6de1cf
4 changed files with 15 additions and 10 deletions
|
@ -4,4 +4,6 @@
|
||||||
invalid-name,
|
invalid-name,
|
||||||
too-few-public-methods,
|
too-few-public-methods,
|
||||||
too-many-instance-attributes,
|
too-many-instance-attributes,
|
||||||
too-many-arguments
|
too-many-arguments,
|
||||||
|
too-many-local-variables,
|
||||||
|
too-many-locals
|
||||||
|
|
|
@ -172,8 +172,8 @@ class User:
|
||||||
embed (Embed): Embed object of the user's embed
|
embed (Embed): Embed object of the user's embed
|
||||||
totpSecret (Optional[str]): String of the user's TOTP secret
|
totpSecret (Optional[str]): String of the user's TOTP secret
|
||||||
domains (List[str]): List of Strings of the user's domains
|
domains (List[str]): List of Strings of the user's domains
|
||||||
oauth (Optional[List[OAuth]] = None): (optional) List of OAuth objects
|
oauth (Optional[List[OAuth]] = None): List of [OAuth](.#pyzipline.models.OAuth) objects
|
||||||
ratelimit (Optional[datetime] = None): (optional) Datetime object of when the user's ratelimit expires
|
ratelimit (Optional[datetime] = None): Datetime object of when the user's ratelimit expires
|
||||||
"""
|
"""
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
@ -188,7 +188,7 @@ class User:
|
||||||
embed: Embed,
|
embed: Embed,
|
||||||
totpSecret: Optional[str],
|
totpSecret: Optional[str],
|
||||||
domains: List[str],
|
domains: List[str],
|
||||||
oauth: Optional[List['OAuth']] = [],
|
oauth: Optional[List['OAuth']] = None,
|
||||||
ratelimit: Optional[datetime] = None,
|
ratelimit: Optional[datetime] = None,
|
||||||
**kwargs
|
**kwargs
|
||||||
):
|
):
|
||||||
|
@ -206,6 +206,8 @@ class User:
|
||||||
self.oauth = oauth
|
self.oauth = oauth
|
||||||
self.ratelimit = ratelimit
|
self.ratelimit = ratelimit
|
||||||
self.__dict__.update(kwargs)
|
self.__dict__.update(kwargs)
|
||||||
|
if self.oauth is not None:
|
||||||
for oauth_entry in self.oauth:
|
for oauth_entry in self.oauth:
|
||||||
OAuth(**oauth_entry)
|
self.oauth.remove(oauth_entry)
|
||||||
self.oauth.append(oauth_entry)
|
o = OAuth(**oauth_entry)
|
||||||
|
self.oauth.append(o)
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
|
"""This is a list of various utility functions used in PyZipline."""
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
def convert_str_to_datetime(date_string: str) -> datetime:
|
def convert_str_to_datetime(date_string: str) -> datetime:
|
||||||
"""Converts a Zipline date string to a datetime object
|
"""Converts a Zipline date string to a datetime object
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
date_string (str): String to convert
|
date_string: String to convert
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
datetime (datetime): Datetime object
|
datetime: Datetime object
|
||||||
"""
|
"""
|
||||||
return datetime.strptime(date_string, '%Y-%m-%dT%H:%M:%S.%fZ')
|
return datetime.strptime(date_string, '%Y-%m-%dT%H:%M:%S.%fZ')
|
||||||
|
|
|
@ -89,7 +89,7 @@ class ZiplineApi:
|
||||||
bool: True if user exists, False if not
|
bool: True if user exists, False if not
|
||||||
"""
|
"""
|
||||||
data = {'username': username} if invite is None else {'username': username, 'code': invite}
|
data = {'username': username} if invite is None else {'username': username, 'code': invite}
|
||||||
result: Result = self._rest_adapter.post(endpoint=f"user/check", data=data)
|
result: Result = self._rest_adapter.post(endpoint="user/check", data=data)
|
||||||
if result.status_code == 200:
|
if result.status_code == 200:
|
||||||
return False
|
return False
|
||||||
if result.message == 'username already exists':
|
if result.message == 'username already exists':
|
||||||
|
|
Loading…
Reference in a new issue