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

Fixing parsing issue in Python 2.6.1 #332

Merged
merged 1 commit into from May 5, 2021

Conversation

brandonmoser
Copy link
Contributor

(Re)Fixes issue #4

@ztemac32
Copy link

~/g/f/w/bin (master|✔) $ python wsdump.py
wss://www.bitmex.com/realtime/websocket?accessToken=xnyXWIQL0sbrLC91ISDlFhuLUGQJNq05A...
Press Ctrl+C to quit

< {"info":"Welcome to the BitMEX Realtime API.","version":"1.1.0",
"timestamp":"2015-01-18T10:14:06.802Z","docs":"https://www.bitmex.com/app/wsAPI","heartbeatEnabled":false}

"help"

< {"info":"See https://www.bitmex.com/app/wsAPI and https://www.bitmex.com/explorer for more documentation.",...}

{"op": "subscribe", "args": ["trade:XBTUSD","instrument:XBTUSD"]}

< {"success":true,"subscribe":"trade:XBTUSD",
"request":{"op":"subscribe","args":["trade:XBTUSD","instrument:XBTUSD"]}}
< {"success":true,"subscribe":"instrument:XBTUSD",
"request":{"op":"subscribe","args":["trade:XBTUSD","instrument:XBTUSD"]}}

< {"table":"trade","action": "partial", ...}
< {"table":"instrument","action": "partial", ...}

< {"table":"instrument","action":"update","data":[{"symbol":"XBTUSD","fairPrice":380.52,
"markPrice":380.52,"indicativeSettlePrice":380.52,"timestamp":"2016-01-15T22:33:15.000Z"}]}
< {"table":"instrument","action":"update","data":[{"symbol":"XBTUSD","openValue":673520400,
"timestamp":"2016-01-15T22:33:15.000Z"}]}

@liris
Copy link
Collaborator

liris commented Dec 21, 2017

I don't have python 2.6.1 environment. The following code works fine on python 2.6.9

import urlparse

parsed = urlparse.urlparse("ws://loclhost:8080/foo")
print parsed
parsed = urlparse.urlparse("//localhost:8080/foo",  scheme="ws" )

@engn33r
Copy link
Collaborator

engn33r commented Feb 16, 2021

This PR is quite old, and it seems to be relevant only for Python 2 (now EOL), but I do not currently see an issue with it. My only hesitation is that it might be possible to remove the scheme parameter from the urllib.parse() call entirely, which would be my preference if there is no impact to functionality.

My thought process: Based on my understanding, urllib.parse() in Python 3 does support the ws and wss schemes. However, this documentation for Python 2 does not indicate support for ws or wss schemes. The scheme value in urllib.parse() doesn't really matter, since parsed.scheme, the only value impacted by this PR, is never used. Instead, the scheme value used is currently parsed from the url.split() line before the urllib.parse() call.

@engn33r engn33r merged commit 5d54a56 into websocket-client:master May 5, 2021
@engn33r
Copy link
Collaborator

engn33r commented May 5, 2021

Except for backported fixes, this is expected to be the last commit for Python 2 support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants