-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathIDrive.py
More file actions
38 lines (32 loc) · 1.22 KB
/
IDrive.py
File metadata and controls
38 lines (32 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import urllib, urllib2
from xml.dom.minidom import parseString
import xml.dom.minidom as xdm
class IDrive:
Name = "IDrive"
def __init__(self, uid, pwd):
self.uid = uid
self.pwd = pwd
url = 'https://evs.idrive.com/evs/getServerAddress'
print url
self.uid = uid
self.pwd = uid
params = urllib.urlencode({
'uid': uid,
'pwd': pwd
})
print params
result = urllib.urlopen(url, params).read()
dom = xdm.parseString(result)
root = dom.documentElement
atr = root.getAttributeNode('webApiServer')
print atr.nodeValue
self.base_url = 'https://'+ atr.nodeValue
def execute(self, page, parameters):
url = self.base_url + '/evs/' + page
print url
parameters['uid'] = self.uid
parameters['pwd'] = self.pwd
params = urllib.urlencode(parameters)
print params
result = urllib.urlopen(url, params).read()
return result