Skip to content
Merged
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
8 changes: 4 additions & 4 deletions linkedin/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .linkedin import LinkedInApplication, LinkedInAuthentication, PERMISSIONS


def quick_api(api_key, secret_key):
def quick_api(api_key, secret_key, port=8000):
"""
This method helps you get access to linkedin api quickly when using it
from the interpreter.
Expand All @@ -22,11 +22,11 @@ def quick_api(api_key, secret_key):
PERMISSIONS.enums.values())
app = LinkedInApplication(authentication=auth)
print auth.authorization_url
_wait_for_user_to_enter_browser(app)
_wait_for_user_to_enter_browser(app, port)
return app


def _wait_for_user_to_enter_browser(app):
def _wait_for_user_to_enter_browser(app, port):
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(self):
p = self.path.split('?')
Expand All @@ -35,6 +35,6 @@ def do_GET(self):
app.authentication.authorization_code = params['code'][0]
app.authentication.get_access_token()

server_address = ('', 8000)
server_address = ('', port)
httpd = BaseHTTPServer.HTTPServer(server_address, MyHandler)
httpd.handle_request()