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

bug: Spaces in a name are unsupported #8

Closed
SaffatHasan opened this issue Feb 14, 2021 · 1 comment
Closed

bug: Spaces in a name are unsupported #8

SaffatHasan opened this issue Feb 14, 2021 · 1 comment

Comments

@SaffatHasan
Copy link

Expected Behavior
The consumer is attempting to access a user with a space in their name

from OSRSBytes import Hiscores
userName = 'Lynx Titan'
user = Hiscores(userName)

The consumer should receive the User object associated with that username's high scores.

Actual Behavior
The library does not sanitize the username and directly passes in Lynx Titan (with a space) which results in an invalid URL.

Possible Solutions

  1. self.username.replace(' ', '%A0')
  2. Use a library to sanitize HTTP url

Stack Trace

    user = Hiscores(userName)
..\..\appdata\local\programs\python\python38-32\lib\site-packages\OSRSBytes\Hiscores.py:106: in __init__
    self._getHTTPResponse()
..\..\appdata\local\programs\python\python38-32\lib\site-packages\OSRSBytes\Hiscores.py:196: in _getHTTPResponse
    conn.request("GET", "/m=hiscore_oldschool/index_lite.ws?player={}".format(self.username))
..\..\appdata\local\programs\python\python38-32\lib\http\client.py:1230: in request
    self._send_request(method, url, body, headers, encode_chunked)
..\..\appdata\local\programs\python\python38-32\lib\http\client.py:1241: in _send_request
    self.putrequest(method, url, **skips)
..\..\appdata\local\programs\python\python38-32\lib\http\client.py:1092: in putrequest
    self._validate_path(url)
@Coffee-fueled-deadlines
Copy link
Owner

Fixed by TylerSweat (20e37b5)

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

No branches or pull requests

2 participants