From c2651497a2263cbfe1dc6229904b3497717138fb Mon Sep 17 00:00:00 2001 From: Chris Rossi Date: Fri, 20 Dec 2013 11:53:19 -0500 Subject: [PATCH] Pylint --- .../linkedin/management/commands/__init__.py | 12 ++++++++++++ .../management/commands/linkedin_mailusers.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lms/djangoapps/linkedin/management/commands/__init__.py b/lms/djangoapps/linkedin/management/commands/__init__.py index 0a97a94823..af1b51d4f3 100644 --- a/lms/djangoapps/linkedin/management/commands/__init__.py +++ b/lms/djangoapps/linkedin/management/commands/__init__.py @@ -60,6 +60,9 @@ class LinkedinAPI(object): return query['code'][0] def access_token_url(self, code): + """ + Construct URL for retreiving access token, given authorization code. + """ config = self.config return ("https://www.linkedin.com/uas/oauth2/accessToken" "?grant_type=authorization_code" @@ -68,6 +71,9 @@ class LinkedinAPI(object): config['CLIENT_SECRET'])) def call_json_api(self, url): + """ + Make an HTTP call to the LinkedIn JSON API. + """ try: request = urllib2.Request(url, headers={'x-li-format': 'json'}) response = urllib2.urlopen(request).read() @@ -92,12 +98,18 @@ class LinkedinAPI(object): return access_token def require_token(self): + """ + Raise CommandError if user has not yet obtained an access token. + """ if self.token is None: raise CommandError( "You must log in to LinkedIn in order to use this script. " "Please use the 'login' command to log in to LinkedIn.") def batch_url(self, emails): + """ + Construct URL for querying a batch of email addresses. + """ self.require_token() queries = ','.join(("email=" + email for email in emails)) url = "https://api.linkedin.com/v1/people::(%s):(id)" % queries diff --git a/lms/djangoapps/linkedin/management/commands/linkedin_mailusers.py b/lms/djangoapps/linkedin/management/commands/linkedin_mailusers.py index 4bb93333dc..e9295dd588 100644 --- a/lms/djangoapps/linkedin/management/commands/linkedin_mailusers.py +++ b/lms/djangoapps/linkedin/management/commands/linkedin_mailusers.py @@ -42,7 +42,7 @@ class Command(BaseCommand): "certificate mail form will be used."),) def __init__(self): - super(BaseCommand, self).__init__() + super(Command, self).__init__() self.api = LinkedinAPI(self) def handle(self, *args, **options):