Files
E-Manager/client/serverrequests.py

23 lines
730 B
Python

import requests
def update_config_on_server(token, config):
## For developement now just return json from here
with open("config.txt", 'r') as file:
json_data = file.read()
return json_data
## For server later
response = requests.post(f'http://your_server_ip:5000/update_config?token={token}', json=config)
if response.status_code == 200:
print('Config updated successfully.')
else:
print('Failed to update config.')
return response
if __name__ == '__main__':
# Beispiel für die Verwendung der Funktion update_config_on_server
token = 'your_token'
config = {'key1': 'new_value1', 'key2': 'new_value2'}
update_config_on_server(token, config)