OSRSBytes is an all-in-one Python library for Old School Runescape (OSRS) that features Item Information Lookup, OSRS Hiscores, and Grand Exchange Market information.
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
self.username.replace(' ', '%A0')
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)
Expected Behavior The consumer is attempting to access a user with a space in their name
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
Stack Trace