скопируйте уникальную ссылку для отправки

#!/usr/bin/env python

from __future__ import unicode_literals
#from PyCRC.CRC16 import CRC16

import requests
import re
import hashlib
import base64
import os, sys

def reboot(baseurl, session):
    r= + "api/device/control", data=data)
def login(baseurl, username, password):
    s = requests.Session()
    r = s.get(baseurl + "html/home.html")
    csrf_tokens = grep_csrf(r.text)
    headers_update(s.headers, csrf_tokens[1])
    data = login_data(username, password, str(csrf_tokens[1]))
    r = s.request('POST', baseurl + "api/user/login", data=data)
    s.headers.update({'__RequestVerificationToken': r.headers["__requestverificationtokenone"]})
    return s

def headers_update(dictbase, token):
    dictbase['Accept-Language'] = 'en-US'
    dictbase['Content-Type'] = 'application/x-www-form-urlencoded'
    dictbase['X-Requested-With'] = 'XMLHttpRequest'
    dictbase['__RequestVerificationToken'] = token
    dictbase['Cache-Control'] = 'no-cache'
    dictbase['User-Agent'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/600.8.9 (KHTML, like Gecko) Version/8.0.8 Safari/600.8.9'
def grep_csrf(html):
    pat = re.compile(r".*meta name=\"csrf_token\" content=\"(.*)\"", re.I)
    matches = (pat.match(line) for line in html.splitlines())
    return [ for m in matches if m]

def login_data(username, password, csrf_token):
    def encrypt(text):
        m = hashlib.sha256()
        return base64.b64encode(m.hexdigest())
    password_hash = encrypt(username + encrypt(password) + csrf_token)
    return '<?xml version "1.0" encoding="UTF-8"?><request><Username>%s</Username><Password>%s</Password><password_type>4</password_type></request>' % (username, password_hash)

baseurl = ""
username = "admin"
password = "admin"

if __name__ == "__main__":
    print "Trying to log in..."
    s = login(baseurl, username, password)
    print "Logged ! Trying to reboot..."
    reboot(baseurl, s)