Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in JSONTokenApi plugin #192

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion websockify/token_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ class JSONTokenApi(BaseTokenAPI):
# should go

def process_result(self, resp):
return (resp.json['host'], resp.json['port'])
return (str(resp.json()['host']), str(resp.json()['port']))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the calls to str() are necessary here.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my test, I have error message:
handler exception: Int or String expected

When I change the line to:
return (str(resp.json['host']), str(resp.json['port']))

it solve the error. So on my case the str() is needed.
And the resp.json()[] is not work, so it should use just resp.json[].

My python is version 2.6.6