Almost done
This commit is contained in:
@@ -1,9 +1,22 @@
|
||||
#!/usr/bin/python3
|
||||
import yaml
|
||||
MG_URL="https://api.mailgun.net/v3/routes"
|
||||
MG_APIKEY="api:key-6e4b01ba0681141a509c1c462fca40f4"
|
||||
HEADER="curl -s --user "+MG_APIKEY+" -X PUT \""+MG_URL
|
||||
#print (HEADER)
|
||||
f = open('rules.yaml')
|
||||
EXE = open('ModifyRules.sh','w')
|
||||
dohicky = yaml.safe_load(f)
|
||||
EXE.writelines("#!/bin/bash\n")
|
||||
for i in dohicky:
|
||||
print(i)
|
||||
CHAINE=HEADER+"/"+i['id']+ "\" -F priority="+str(i['priority'])
|
||||
if len(i['description'])>0:
|
||||
CHAINE=CHAINE+ " -F description='"+str(i['description'])+"'"
|
||||
CHAINE=CHAINE+ " -F expression='"+str(i['expression'])+"'"
|
||||
for j in i['actions']:
|
||||
CHAINE=CHAINE+ " -F action='"+str(j)+"'"
|
||||
#print(CHAINE)
|
||||
EXE.writelines(CHAINE+"\n")
|
||||
|
||||
#print(dohicky)
|
||||
f.close()
|
||||
f.close()
|
||||
EXE.close()
|
||||
Reference in New Issue
Block a user