text stringlengths 0 93.6k |
|---|
""" Send the response and return the parsed sid. raises an Exception on error """ |
# Build response params |
post_data = {"username": username, "response": challenge_response} |
# post_data = urllib.parse.urlencode(post_data_dict).encode() |
headers = {"Content-Type": "application/x-www-form-urlencoded"} |
url = box_url + LOGIN_SID_ROUTE |
r = requests.post(url, headers=headers, data=post_data) |
# Parse SID from resulting XML. |
xml = etree.fromstring(r.content) |
return xml.find("SID").text |
def get_page_content(server, session_id, page, port=80): |
"""Fetches a page from the Fritzbox and returns its content |
:param server: the ip address of the Fritzbox |
:param session_id: a valid session id |
:param page: the page you are regquesting |
:param port: the port the Fritzbox webserver runs on |
:return: the content of the page |
""" |
headers = {"Accept": "application/xml", "Content-Type": "text/plain", "User-Agent": USER_AGENT} |
url = "http://{}:{}/{}?sid={}".format(server, port, page, session_id) |
try: |
r = requests.get(url, headers=headers) |
r.raise_for_status() |
except requests.exceptions.HTTPError as err: |
print(err) |
sys.exit(1) |
return r.content |
def get_xhr_content(server, session_id, page, port=80): |
"""Fetches the xhr content from the Fritzbox and returns its content |
:param server: the ip address of the Fritzbox |
:param session_id: a valid session id |
:param page: the page you are regquesting |
:param port: the port the Fritzbox webserver runs on |
:return: the content of the page |
""" |
headers = { |
"Accept": "application/xml", |
"Content-Type": "application/x-www-form-urlencoded", |
"User-Agent": USER_AGENT, |
} |
url = "http://{}:{}/data.lua".format(server, port) |
data = {"xhr": 1, "sid": session_id, "lang": "en", "page": page, "xhrId": "all", "no_sidrenew": ""} |
try: |
r = requests.post(url, data=data, headers=headers) |
except requests.exceptions.HTTPError as err: |
print(err) |
sys.exit(1) |
return r.content |
# <FILESEP> |
import sys |
import math |
import random |
import numpy as np |
from numpy import linalg as LA |
import cv2 |
from scipy.spatial import distance |
from openvino.inference_engine import IECore |
model_det = 'face-detection-adas-0001' |
model_hp = 'head-pose-estimation-adas-0001' |
model_gaze = 'gaze-estimation-adas-0002' |
model_lm = 'facial-landmarks-35-adas-0002' |
model_det = './intel/'+model_det +'/FP16/'+model_det |
model_hp = './intel/'+model_hp +'/FP16/'+model_hp |
model_gaze = './intel/'+model_gaze+'/FP16/'+model_gaze |
model_lm = './intel/'+model_lm +'/FP16/'+model_lm |
_N = 0 |
_C = 1 |
_H = 2 |
_W = 3 |
def line(p1, p2): |
A = (p1[1] - p2[1]) |
B = (p2[0] - p1[0]) |
C = (p1[0]*p2[1] - p2[0]*p1[1]) |
return A, B, -C |
def intersection(L1, L2): |
D = L1[0] * L2[1] - L1[1] * L2[0] |
Dx = L1[2] * L2[1] - L1[1] * L2[2] |
Dy = L1[0] * L2[2] - L1[2] * L2[0] |
x = Dx / D |
y = Dy / D |
return x,y |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.