Created
January 10, 2018 10:52
-
-
Save sergiomario/74eefdffb116cb1023504a74e41a9700 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
API = { | |
'apply': BASE_URL+'/api/v1/system/apply', | |
'login': BASE_URL+'/api/v1/system/login', | |
'service_led': BASE_URL+'/api/v1/service/leds', | |
'service_ssh': BASE_URL+'/api/v1/service/ssh', | |
} | |
def change_led_color(color): | |
response = requests.get(API['service_led'], headers=headers, verify=False) | |
led_options = json.loads(response.content.decode('utf-8')) | |
if color == 'off': | |
led_options['data']['action']['value'] = 'off' | |
else: | |
led_options['data']['color']['value'] = color | |
requests.put(API['service_led'], data=json.dumps(led_options), | |
headers=headers, verify=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment