|
def | __init__ (self, url, username=None, password=None, xml_user=True) |
|
def | post (self, entry) |
|
def | close (self) |
|
def | list (self, category=None, form=None, tag=None, limit=None, after=None, substring=None, text=None) |
|
def | get (self, eid) |
|
Definition at line 47 of file ECLAPI.py.
def ECLAPI.ECLConnection.__init__ |
( |
|
self, |
|
|
|
url, |
|
|
|
username = None , |
|
|
|
password = None , |
|
|
|
xml_user = True |
|
) |
| |
Definition at line 51 of file ECLAPI.py.
51 def __init__(self, url, username=None, password=None, xml_user=True):
def __init__(self, url, username=None, password=None, xml_user=True)
def ECLAPI.ECLConnection._add_signature |
( |
|
self, |
|
|
|
req, |
|
|
|
args, |
|
|
|
body |
|
) |
| |
|
private |
Definition at line 80 of file ECLAPI.py.
84 req.add_header(
"X-Signature",
def _add_signature(self, req, args, body)
def _signature(self, method, args, body)
def ECLAPI.ECLConnection._make_salt |
( |
|
self | ) |
|
|
private |
Definition at line 59 of file ECLAPI.py.
60 m = hashlib.new(
'md5')
61 m.update(
"%s" % (random.randint(1,1234567890),))
def ECLAPI.ECLConnection._signature |
( |
|
self, |
|
|
|
method, |
|
|
|
args, |
|
|
|
body |
|
) |
| |
|
private |
Definition at line 65 of file ECLAPI.py.
66 text =
'%s:%s:%s' % (args, self.
_password, body)
72 elif method ==
'sha512':
def _signature(self, method, args, body)
def ECLAPI.ECLConnection.close |
( |
|
self | ) |
|
def ECLAPI.ECLConnection.get |
( |
|
self, |
|
|
|
eid |
|
) |
| |
Definition at line 153 of file ECLAPI.py.
154 args = [
'e=%s' % (eid,),
'salt=%s' % (self.
_make_salt(),)]
155 url = self.
_url +
'/E/xml_get' 156 args =
'&'.join(args)
159 req = urllib2.Request(url=url)
161 response = urllib2.urlopen(req)
162 return response.read()
def _add_signature(self, req, args, body)
def ECLAPI.ECLConnection.list |
( |
|
self, |
|
|
|
category = None , |
|
|
|
form = None , |
|
|
|
tag = None , |
|
|
|
limit = None , |
|
|
|
after = None , |
|
|
|
substring = None , |
|
|
|
text = None |
|
) |
| |
Definition at line 116 of file ECLAPI.py.
116 limit=
None, after=
None, substring=
None, text=
None):
117 args = [
'o=ids',
'salt=%s' % (self.
_make_salt(),)]
119 args.append(
'c=%s' % (urllib.quote_plus(category,)))
121 args.append(
'f=%s' % (urllib.quote_plus(form,)))
124 after = after.strptime(
'%Y-%m-%d %H:%M:%S')
125 args.append(
'a=%s' % (urllib.quote_plus(after),))
127 args.append(
't=%s' % (tag,))
129 args.append(
'l=%s' % (limit,))
131 args.append(
'st=%s' % (urllib.quote_plus(substring),))
133 args.append(
'si=%s' % (urllib.quote_plus(text),))
135 url = self.
_url +
'/E/xml_search' 136 args =
'&'.join(args)
140 req = urllib2.Request(url=url)
146 response = urllib2.urlopen(req)
147 except HTTPError, error:
148 raise ECLHTTPError(error.code, error.msg, error.fp.read())
149 tree = etree.parse(response)
150 entries = tree.findall(
'entry')
151 return [
int(e.attrib.get(
'id'))
for e
in entries]
def _add_signature(self, req, args, body)
def ECLAPI.ECLConnection.post |
( |
|
self, |
|
|
|
entry |
|
) |
| |
Definition at line 87 of file ECLAPI.py.
92 params = entry.xshow().strip()
94 req = urllib2.Request(url=self.
_url +
'/E/xml_post' +
95 '?' + args, data=params)
98 req.add_header(
"Content-type",
"text/xml")
99 if self._url.startswith(
"https:"):
100 req.add_header(
"X-Password", self.
_password)
103 response = urllib2.urlopen(req)
104 except HTTPError, err:
105 return err.code, err.msg, err.fp.read()
107 data = response.read()
110 return response.code, response.msg, data
def _add_signature(self, req, args, body)
ECLAPI.ECLConnection._password |
|
private |
ECLAPI.ECLConnection._url |
|
private |
ECLAPI.ECLConnection._username |
|
private |
string ECLAPI.ECLConnection.SignatureMethod = "md5" |
|
static |
The documentation for this class was generated from the following file: