2020if major_py_version == 2 and minor_py_version > 4 :
2121 import oauth2 as oauth
2222else :
23- import oauth2_version as oauth
23+ import oauth2_version as oauth
2424
2525import urllib
2626import urllib2
3333
3434import urlparse
3535
36- __version__ = '0.3.2 '
36+ __version__ = '0.3.1 '
3737
3838REQUEST_TOKEN_URL = 'https://sso.openx.com/api/index/initiate'
3939ACCESS_TOKEN_URL = 'https://sso.openx.com/api/index/token'
4343
4444class Client (object ):
4545
46- def __init__ (self , domain , consumer_key , consumer_secret ,
47- realm = '' ,
46+ def __init__ (self , domain , realm , consumer_key , consumer_secret ,
4847 callback_url = 'oob' ,
4948 scheme = 'http' ,
5049 request_token_url = REQUEST_TOKEN_URL ,
@@ -58,9 +57,9 @@ def __init__(self, domain, consumer_key, consumer_secret,
5857 """
5958
6059 domain -- Your UI domain. The API is accessed off this domain.
60+ realm -- This is no longer used. Just specify None.
6161 consumer_key -- Your consumer key.
6262 consumer_secret -- Your consumer secret.
63- realm -- Optional realm.
6463 callback_url -- Callback URL to redirect to on successful authorization.
6564 We default to 'oob' for headless login.
6665 request_token -- Only override for debugging.
@@ -69,13 +68,12 @@ def __init__(self, domain, consumer_key, consumer_secret,
6968 api_path -- Only override for debugging.
7069 http_proxy -- Optional proxy to send HTTP requests through.
7170 """
72-
71+
7372 self .domain = domain
7473 self .consumer_key = consumer_key
7574 self .consumer_secret = consumer_secret
76- self .realm = realm
7775 self .callback_url = callback_url
78- self .scheme = scheme
76+ self .scheme = scheme
7977 self .request_token_url = request_token_url
8078 self .access_token_url = access_token_url
8179 self .authorization_url = authorization_url
@@ -132,9 +130,8 @@ def _sign_request(self, req):
132130 oauth .SignatureMethod_HMAC_SHA1 (),
133131 self ._consumer ,
134132 self ._token )
135-
136- req .headers .update (oauth_req .to_header (realm = self .realm ))
137-
133+
134+ req .headers .update (oauth_req .to_header ())
138135 return \
139136 urllib2 .Request (req .get_full_url (), headers = req .headers , data = data )
140137
@@ -162,7 +159,7 @@ def request(self, url, method='GET', headers={}, data=None, sign=False):
162159 # Everything needs to be UTF-8 for urlencode:
163160 data_utf8 = req .get_data ()
164161 for i in data_utf8 :
165- data_utf8 [i ] = data_utf8 [i ].encode ('utf-8' )
162+ data_utf8 [i ] = data_utf8 [i ].encode ('utf-8' )
166163 req .add_data (urllib .urlencode (data_utf8 ))
167164
168165 # In 2.4 and 2.5, urllib2 throws errors for all non 200 status codes.
@@ -395,7 +392,6 @@ def client_from_file(file_path='.ox3rc', env=None):
395392
396393 # Load optional parameters.
397394 optional_params = [
398- 'realm' ,
399395 'callback_url' ,
400396 'scheme' ,
401397 'request_token_url' ,
0 commit comments