Skip to content

Commit

Permalink
Revert "Merge pull request #5 from tnydwrds/fix-0.3.2-optional-realm-…
Browse files Browse the repository at this point in the history
…support"

This reverts commit 073e7e0, reversing
changes made to a6b6b56.
  • Loading branch information
chriscrichton committed Jan 14, 2014
1 parent 073e7e0 commit 9f3ebae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
8 changes: 3 additions & 5 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
0.3.2 / 2013-10-09
==================
* Added: Optional realm support
* `Client.__init__`'s `realm` parameter is now optional (or named).

0.3.1 / 2013-06-04
==================
* Removed: Realm Support
Expand All @@ -15,13 +10,15 @@
* Fixed: JSON support for Python 2.4 and 2.5
* Fixed: OAuth support for Python 2.4
* Fixed: Version number below (0.2.1)


0.2.1 / 2012-09-25
==================
# Added: `upload_creative` to support uploading creative files.

0.2.0 / 2012-08-29
==================

* Fixed: JSON parse error when deleting objects with call to `Client.delete()`
* Added: "Official" support for Python 2.4, 2.5, 2.6
* Added: `logon` and `logoff` convenience methods.
Expand All @@ -30,4 +27,5 @@

0.1.0 / 2012-08-26
==================

* "Official release"
22 changes: 9 additions & 13 deletions ox3apiclient/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
if major_py_version == 2 and minor_py_version > 4:
import oauth2 as oauth
else:
import oauth2_version as oauth
import oauth2_version as oauth

import urllib
import urllib2
Expand All @@ -33,7 +33,7 @@

import urlparse

__version__ = '0.3.2'
__version__ = '0.3.1'

REQUEST_TOKEN_URL = 'https://sso.openx.com/api/index/initiate'
ACCESS_TOKEN_URL = 'https://sso.openx.com/api/index/token'
Expand All @@ -43,8 +43,7 @@

class Client(object):

def __init__(self, domain, consumer_key, consumer_secret,
realm='',
def __init__(self, domain, realm, consumer_key, consumer_secret,
callback_url='oob',
scheme='http',
request_token_url=REQUEST_TOKEN_URL,
Expand All @@ -58,9 +57,9 @@ def __init__(self, domain, consumer_key, consumer_secret,
"""
domain -- Your UI domain. The API is accessed off this domain.
realm -- This is no longer used. Just specify None.
consumer_key -- Your consumer key.
consumer_secret -- Your consumer secret.
realm -- Optional realm.
callback_url -- Callback URL to redirect to on successful authorization.
We default to 'oob' for headless login.
request_token -- Only override for debugging.
Expand All @@ -69,13 +68,12 @@ def __init__(self, domain, consumer_key, consumer_secret,
api_path -- Only override for debugging.
http_proxy -- Optional proxy to send HTTP requests through.
"""

self.domain = domain
self.consumer_key = consumer_key
self.consumer_secret = consumer_secret
self.realm = realm
self.callback_url = callback_url
self.scheme = scheme
self.scheme=scheme
self.request_token_url = request_token_url
self.access_token_url = access_token_url
self.authorization_url = authorization_url
Expand Down Expand Up @@ -132,9 +130,8 @@ def _sign_request(self, req):
oauth.SignatureMethod_HMAC_SHA1(),
self._consumer,
self._token)

req.headers.update(oauth_req.to_header(realm=self.realm))


req.headers.update(oauth_req.to_header())
return \
urllib2.Request(req.get_full_url(), headers=req.headers, data=data)

Expand Down Expand Up @@ -162,7 +159,7 @@ def request(self, url, method='GET', headers={}, data=None, sign=False):
# Everything needs to be UTF-8 for urlencode:
data_utf8 = req.get_data()
for i in data_utf8:
data_utf8[i] = data_utf8[i].encode('utf-8')
data_utf8[i] = data_utf8[i].encode('utf-8')
req.add_data(urllib.urlencode(data_utf8))

# In 2.4 and 2.5, urllib2 throws errors for all non 200 status codes.
Expand Down Expand Up @@ -395,7 +392,6 @@ def client_from_file(file_path='.ox3rc', env=None):

# Load optional parameters.
optional_params = [
'realm',
'callback_url',
'scheme',
'request_token_url',
Expand Down

0 comments on commit 9f3ebae

Please sign in to comment.