Skip to content
Browse files

Remove opener to make code more general again

  • Loading branch information...
1 parent cb7e62f commit 01b784d245754b13a9deda06cfcb7c8d0424a548 @timtebeek timtebeek committed Dec 23, 2011
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/py_etherpad.py
View
7 src/py_etherpad.py
@@ -20,15 +20,13 @@ class EtherpadLiteClient:
apiKey = ""
baseUrl = "http://localhost:9001/api"
- def __init__(self, apiKey=None, baseUrl=None, opener=None):
+ def __init__(self, apiKey=None, baseUrl=None):
if apiKey:
self.apiKey = apiKey
if baseUrl:
self.baseUrl = baseUrl
- self.opener = opener if opener else urllib2.build_opener()
-
def call(self, function, arguments=None):
"""Create a dictionary of all parameters"""
url = '%s/%d/%s' % (self.baseUrl, self.API_VERSION, function)
@@ -38,8 +36,9 @@ def call(self, function, arguments=None):
data = urllib.urlencode(params, True)
try:
+ opener = urllib2.build_opener()
request = urllib2.Request(url=url, data=data)
- response = self.opener.open(request, timeout=self.TIMEOUT)
+ response = opener.open(request, timeout=self.TIMEOUT)
result = response.read()
response.close()
except urllib2.HTTPError:

0 comments on commit 01b784d

Please sign in to comment.
Something went wrong with that request. Please try again.