Skip to content

Commit 5687111

Browse files
committed
Merge pull request #64 from scottydelta/master
added option to specify port while using library in interpreter
2 parents c04c2a5 + c757438 commit 5687111

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

linkedin/server.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .linkedin import LinkedInApplication, LinkedInAuthentication, PERMISSIONS
66

77

8-
def quick_api(api_key, secret_key):
8+
def quick_api(api_key, secret_key, port=8000):
99
"""
1010
This method helps you get access to linkedin api quickly when using it
1111
from the interpreter.
@@ -22,11 +22,11 @@ def quick_api(api_key, secret_key):
2222
PERMISSIONS.enums.values())
2323
app = LinkedInApplication(authentication=auth)
2424
print auth.authorization_url
25-
_wait_for_user_to_enter_browser(app)
25+
_wait_for_user_to_enter_browser(app, port)
2626
return app
2727

2828

29-
def _wait_for_user_to_enter_browser(app):
29+
def _wait_for_user_to_enter_browser(app, port):
3030
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
3131
def do_GET(self):
3232
p = self.path.split('?')
@@ -35,6 +35,6 @@ def do_GET(self):
3535
app.authentication.authorization_code = params['code'][0]
3636
app.authentication.get_access_token()
3737

38-
server_address = ('', 8000)
38+
server_address = ('', port)
3939
httpd = BaseHTTPServer.HTTPServer(server_address, MyHandler)
4040
httpd.handle_request()

0 commit comments

Comments
 (0)