-
Notifications
You must be signed in to change notification settings - Fork 0
/
Credentials.py
50 lines (41 loc) · 1.77 KB
/
Credentials.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class Credentials:
"""
initializes a new credentials class
"""
accounts_list=[] #our list where we shall store our account details
def __init__(self, accountname, accountusername, accountpasscode):
"""
the method here for defining properties of the object
"""
self.accountname = accountname
self.accountusername = accountusername
self.accountpasscode = accountpasscode
#*************************saving new account details*****************************************
def save_Credentials(self):
Credentials.accounts_list.append(self)
#********************deleting credentials**************************
def delete_Credentials(self):
"""
removing credentails from accounts_list
"""
Credentials.accounts_list.remove(self)
#*******searching for a account using account name e.g instagram*****************************
@classmethod
def find_by_accountname(cls, accountname): #cls takes the whole class
for Credentials in cls.accounts_list:
if Credentials.accountname == accountname:
return Credentials
#*************************check to see if the account really exists*******************
@classmethod
def credentials_exists(cls,accountname):
for Credentials in cls.accounts_list:
if Credentials.accountname == accountname:
return True
return False
#***************************display account & credentials*************************************************
@classmethod
def display_credentials(cls):
'''
see our users in our userlist by returning the accounts list
'''
return cls.accounts_list