diff --git a/contact_importer/providers/oauth.py b/contact_importer/providers/oauth.py index 9428dae..883fcbb 100644 --- a/contact_importer/providers/oauth.py +++ b/contact_importer/providers/oauth.py @@ -6,6 +6,7 @@ from .base import BaseContacts + class OAuthContacts(BaseContacts): """ Abstract class for contact importing via OAuth protocol. @@ -19,7 +20,7 @@ class OAuthContacts(BaseContacts): scope_urls = [] - def __init__(self, consumer_key, consumer_secret, *args, **kwargs): + def __init__(self, consumer_key, consumer_secret, *args, **kwargs): """ Init function Keyword params: @@ -38,7 +39,7 @@ def __init__(self, consumer_key, consumer_secret, *args, **kwargs): super(OAuthContacts, self).__init__(*args, **kwargs) def get_params(self, oauth_callback): - params = { 'oauth_callback': oauth_callback} + params = {'oauth_callback': oauth_callback} if self.scope_urls: params['scope'] = ' '.join(self.scope_urls) return urllib.urlencode(params) @@ -52,8 +53,8 @@ def get_tokens(self, oauth_callback): client = oauth.Client(self.consumer) resp, content = client.request( - "%s?%s" % (self.request_token_url, self.get_params(oauth_callback)), - method="GET" + "%s?%s" % (self.request_token_url, self.get_params(oauth_callback)), method="GET", + body=self.get_params(oauth_callback) ) if resp['status'] != '200': raise Exception("Invalid response %s." % resp['status']) @@ -62,7 +63,7 @@ def get_tokens(self, oauth_callback): self.oauth_token = token.get('oauth_token') self.oauth_token_secret = token.get('oauth_token_secret') - return { 'oauth_token': self.oauth_token, 'oauth_token_secret': self.oauth_token_secret } + return {'oauth_token': self.oauth_token, 'oauth_token_secret': self.oauth_token_secret} def get_auth_url(self): """ @@ -90,4 +91,3 @@ def receive_access_tokens(self): def get_contacts(self): if not hasattr(self, 'access_token') or not hasattr(self, 'access_token_secret'): self.receive_access_tokens() - diff --git a/setup.py b/setup.py index 44d3a0b..03bccc6 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from setuptools import setup +from setuptools import setup, find_packages setup(name='python-contact-importer', version='0.1', @@ -8,7 +8,7 @@ author='Millioner', author_email='millioner.bbb@gmail.com', url='https://github.com/millioner/Python-contact-importer', - packages=['contact_importer', ], + packages=find_packages(), include_package_data = True, # include everything in source control zip_safe=False, install_requires=['PyCrypto', 'oauth2', ],