Parcourir la source

Pylinting yelp.py

David Leonard il y a 10 ans
Parent
commit
e76395bced
1 fichiers modifiés avec 13 ajouts et 3 suppressions
  1. 13 3
      hackathon_starter/hackathon/scripts/yelp.py

+ 13 - 3
hackathon_starter/hackathon/scripts/yelp.py

@@ -1,3 +1,11 @@
+# pylint: disable=invalid-name
+
+'''
+Yelp.py contains methods for
+authenticating the user and
+retrieving data from Yelp's API.
+'''
+
 import simplejson as json
 import simplejson as json
 import oauth2
 import oauth2
 import requests
 import requests
@@ -9,6 +17,10 @@ TOKEN = 'AWYVs7Vim7mwYyT1BLJA2xhNTs_vXLYS'
 TOKEN_SECRET = 'Rv4GrlYxYGhxUs14s0VBfk7JLJY'
 TOKEN_SECRET = 'Rv4GrlYxYGhxUs14s0VBfk7JLJY'
 
 
 def requestData(location):
 def requestData(location):
+    '''
+    Authenticates a request and returns
+    data from Yelp API.
+    '''
     data = []
     data = []
     url = 'http://api.yelp.com/v2/business/' + location + '?'
     url = 'http://api.yelp.com/v2/business/' + location + '?'
 
 
@@ -26,9 +38,7 @@ def requestData(location):
     token = oauth2.Token(TOKEN, TOKEN_SECRET)
     token = oauth2.Token(TOKEN, TOKEN_SECRET)
     oauth_request.sign_request(oauth2.SignatureMethod_HMAC_SHA1(), consumer, token)
     oauth_request.sign_request(oauth2.SignatureMethod_HMAC_SHA1(), consumer, token)
     signed_url = oauth_request.to_url()
     signed_url = oauth_request.to_url()
-    
     req = requests.get(signed_url)
     req = requests.get(signed_url)
     content = json.loads(req.content)
     content = json.loads(req.content)
     data.append(content)
     data.append(content)
-
-    return data
+    return data