|
@@ -11,6 +11,7 @@ import time |
|
|
import xml.etree.ElementTree as ET |
|
|
import xml.etree.ElementTree as ET |
|
|
import urllib |
|
|
import urllib |
|
|
import urllib2 |
|
|
import urllib2 |
|
|
|
|
|
import base64 |
|
|
from math import floor |
|
|
from math import floor |
|
|
from urlparse import urlparse |
|
|
from urlparse import urlparse |
|
|
import json |
|
|
import json |
|
@@ -142,12 +143,17 @@ class Eagle(object) : |
|
|
addr address of device |
|
|
addr address of device |
|
|
port port on device (default 5002) |
|
|
port port on device (default 5002) |
|
|
getmac connect to device at start up and get macid (default true) |
|
|
getmac connect to device at start up and get macid (default true) |
|
|
|
|
|
password Password for HTTP Authentication |
|
|
|
|
|
username Username for HTTP Authentication |
|
|
timeout TCP socket timeout |
|
|
timeout TCP socket timeout |
|
|
|
|
|
|
|
|
Currently there is very little error handling ( if any at all ) |
|
|
Currently there is very little error handling ( if any at all ) |
|
|
""" |
|
|
""" |
|
|
def __init__(self, **kwargs): |
|
|
def __init__(self, **kwargs): |
|
|
|
|
|
|
|
|
|
|
|
self.username = kwargs.get("username", 0) |
|
|
|
|
|
self.password = kwargs.get("password", 0) |
|
|
|
|
|
|
|
|
self.debug = kwargs.get("debug", 0) |
|
|
self.debug = kwargs.get("debug", 0) |
|
|
|
|
|
|
|
|
if self.debug : |
|
|
if self.debug : |
|
@@ -801,7 +807,12 @@ class Eagle(object) : |
|
|
|
|
|
|
|
|
url = "http://{0}/cgi-bin/cgi_manager".format(self.addr) |
|
|
url = "http://{0}/cgi-bin/cgi_manager".format(self.addr) |
|
|
|
|
|
|
|
|
req = urllib2.Request(url, commstr) |
|
|
|
|
|
|
|
|
if self.username is not None : |
|
|
|
|
|
if self.debug : |
|
|
|
|
|
print("Authorization string: "+base64.64encode(self.username+":"+self.password)"+\n") |
|
|
|
|
|
req = urllib2.Request(url, commstr, headers={ "Authorization" : 'Basic'+base64.b64encode(self.username+":"+self.password) }) |
|
|
|
|
|
else : |
|
|
|
|
|
req = urllib2.Request(url, commstr) |
|
|
response = urllib2.urlopen(req) |
|
|
response = urllib2.urlopen(req) |
|
|
the_page = response.read() |
|
|
the_page = response.read() |
|
|
|
|
|
|
|
|