Fixed error in a function
This commit is contained in:
parent
5d1c11d42d
commit
cce2176fee
17
malias.py
17
malias.py
@ -29,7 +29,7 @@ database = filepath.joinpath('malias.db')
|
||||
logfile = filepath.joinpath('malias.log')
|
||||
Path(filepath).mkdir(parents=True, exist_ok=True)
|
||||
logging.basicConfig(filename=logfile,level=logging.INFO,format='%(message)s')
|
||||
app_version = '0.2'
|
||||
app_version = '0.2.1'
|
||||
|
||||
|
||||
def connect_database():
|
||||
@ -164,8 +164,6 @@ def delete_alias(alias):
|
||||
response = requests.post('https://'+server+'/api/v1/delete/alias',
|
||||
data=json.dumps(data), headers=headers)
|
||||
response_data = response.json()
|
||||
print(response_data)
|
||||
exit(0)
|
||||
if response_data[0]['type'] == 'success':
|
||||
if check_local_db(the_alias_id) == 1:
|
||||
now = datetime.now().strftime("%m-%d-%Y %H:%M")
|
||||
@ -212,6 +210,7 @@ def copy_data():
|
||||
|
||||
|
||||
def checklist(alias):
|
||||
alias_exist = None
|
||||
apikey = get_api()
|
||||
mail_server = get_settings('mail_server')
|
||||
req = urllib.request.Request('https://'+mail_server+'/api/v1/get/alias/all')
|
||||
@ -222,10 +221,16 @@ def checklist(alias):
|
||||
remoteData = json.loads(remote)
|
||||
i = 0
|
||||
for search in remoteData:
|
||||
if alias == remoteData[i]['address']:
|
||||
return True
|
||||
if alias in remoteData[i]['address'] or alias in remoteData[i]['goto']:
|
||||
alias_exist = True
|
||||
i=i+1
|
||||
return None
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('SELECT count(*) FROM aliases where alias like ? or goto like ?', (alias,alias,))
|
||||
count = cursor.fetchone()[0]
|
||||
if count >= 1 :
|
||||
alias_exist = True
|
||||
|
||||
return alias_exist
|
||||
|
||||
|
||||
def list_alias():
|
||||
|
Loading…
Reference in New Issue
Block a user