Skip to content

Commit 55e8048

Browse files
committed
make API domain a parameter
1 parent ba0077f commit 55e8048

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

hackpad_api/hackpad.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
from urlparse import urljoin
1212

1313
class Hackpad(object):
14-
def __init__(self, sub_domain='', consumer_key='', consumer_secret=''):
14+
def __init__(self, api_domain='hackpad.com', sub_domain='', consumer_key='', consumer_secret=''):
15+
self.api_domain = api_domain
1516
self.sub_domain = sub_domain
1617
self.consumer_key = consumer_key
1718
self.consumer_secret = consumer_secret
@@ -120,9 +121,9 @@ def do_api_request(self, path, method, params={}, body='', content_type=None):
120121
hackpad = {}
121122
try:
122123
if self.sub_domain:
123-
path = urljoin('https://%s.hackpad.com/api/1.0/' % self.sub_domain, path)
124+
path = urljoin('http://%s.%s/api/1.0/' % (self.sub_domain, self.api_domain), path)
124125
else:
125-
path = urljoin('https://hackpad.com/api/1.0/', path)
126+
path = urljoin('http://%s/api/1.0/' % (self.api_domain), path)
126127

127128
oauth_params = {
128129
'client_key': self.consumer_key,

0 commit comments

Comments
 (0)