aboutsummaryrefslogtreecommitdiff
path: root/h-client
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-03-19 15:27:48 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-03-19 15:27:48 +0000
commite0c5b36dcc92d97c65f14290bb78b2327ff731a5 (patch)
tree6eb2ea10d4bbe7b49431ea77f4c281c1703cb325 /h-client
parentdec20c387a699bbd33b76b8d35716f83a4910744 (diff)
added Client::setNode()
Diffstat (limited to 'h-client')
-rw-r--r--h-client/hlibrary.py15
-rw-r--r--h-client/test.py11
2 files changed, 17 insertions, 9 deletions
diff --git a/h-client/hlibrary.py b/h-client/hlibrary.py
index e45cfbd..975f2f9 100644
--- a/h-client/hlibrary.py
+++ b/h-client/hlibrary.py
@@ -255,10 +255,14 @@ class Mycurl:
#set the domain
def __init__(self,domain):
self.contents = ''
+ self.setDomain(domain)
+
+ def setDomain(self,domain):
self.domain = domain
#check if the trailing slash is present
- if self.domain[len(self.domain)-1] != '/':
- self.domain += '/'
+ if len(self.domain) > 1:
+ if self.domain[len(self.domain)-1] != '/':
+ self.domain += '/'
def setPost(self,post):
self._post = post
@@ -303,9 +307,12 @@ class Client:
}
}
- def __init__(self,url):
+ def __init__(self,url = ''):
self.request = Mycurl(url)
-
+
+ def setNode(self,domain):
+ self.request.setDomain(domain)
+
#get the type from the Class id
def getType(self, Class):
Classes = self._types.keys()
diff --git a/h-client/test.py b/h-client/test.py
index ca13ee7..07ccca0 100644
--- a/h-client/test.py
+++ b/h-client/test.py
@@ -18,7 +18,8 @@
from hlibrary import *
-client = Client('http://h-source/')
+client = Client()
+client.setNode('http://h-source/')
client.createDevices()
#client.request.perform('download/all/it')
#print client.request.url
@@ -40,10 +41,10 @@ client.sync()
#print dev[0].userDistribution()
-client.login('','')
-#print client.isLogged()
-client.submit()
-client.logout()
+#client.login('','')
+##print client.isLogged()
+#client.submit()
+#client.logout()
#client.devices['p_14e4:4311'][0].setPost()
#print client.devices['p_14e4:4311'][0].getPost() \ No newline at end of file