Skip to content

Instantly share code, notes, and snippets.

@sergiomario
Created January 10, 2018 10:52
Show Gist options
  • Save sergiomario/74eefdffb116cb1023504a74e41a9700 to your computer and use it in GitHub Desktop.
Save sergiomario/74eefdffb116cb1023504a74e41a9700 to your computer and use it in GitHub Desktop.
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