Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions contact_importer/providers/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from .base import BaseContacts


class OAuthContacts(BaseContacts):
"""
Abstract class for contact importing via OAuth protocol.
Expand All @@ -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:
Expand All @@ -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)
Expand All @@ -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'])
Expand All @@ -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):
"""
Expand Down Expand Up @@ -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()

4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env python

from setuptools import setup
from setuptools import setup, find_packages

setup(name='python-contact-importer',
version='0.1',
description='Allows to export user contacts from Google, Yahoo! and Hotmail.',
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', ],
Expand Down