Переглянути джерело

Mise à jour de 'generate_config.py'

master
TheBidouilleur 2 місяці тому
джерело
коміт
ef65a91086
1 змінених файлів з 22 додано та 21 видалено
  1. +22
    -21
      generate_config.py

+ 22
- 21
generate_config.py Переглянути файл

@@ -26,39 +26,40 @@ def series():
print("Le fichier watched_series.json a bien ete cree")

def config():
print("Configuration du fichier user_config.json")
print(sys.argv())
print("Configuration du fichier user_config.json")
print(sys.argv())
if len(sys.argv) != 7 :
print("Il n'y a pas le bon nombre d'argument")
sys.exit()
if len(sys.argv) != 7 :
print("Il n'y a pas le bon nombre d'argument")
sys.exit()

client_id = sys.argv[2]
login = sys.argv[3]
password = sys.argv[4]
user_id = sys.argv[5]
token_bot = sys.argv[6]
client_id = sys.argv[2]
login = sys.argv[3]
password = sys.argv[4]
user_id = sys.argv[5]
token_bot = sys.argv[6]


if path.exists('user_config.json') == False :
print("Le fichier user_config.json n'existe pas")
else :
print("Le fichier user_config existe.. On le supprime")
os.remove('user_config.json')
if path.exists('user_config.json') == False :
print("Le fichier user_config.json n'existe pas")
else :
print("Le fichier user_config existe.. On le supprime")
os.remove('user_config.json')

config = {"client_id" : client_id,
config = {"client_id" : client_id,
"login" : login,
"password" : password,
"user_id" : user_id,
"token_bot" : token_bot}

print("Dictionnaire de la configuration", config)
print("Dictionnaire de la configuration", config)

with open('user_config.json', 'w') as json_file:
config = json.dump(config, json_file)
with open('user_config.json', 'w') as json_file:
config = json.dump(config, json_file)

print("Le fichier user_config a bien ete cree")
return
print("Le fichier user_config a bien ete cree")
return


if len(sys.argv) == 1 :


Завантаження…
Відмінити
Зберегти