Pulling JSON data from a website with Python 3.x -
i'm trying pull json
data website little program i'm making discord bot. code looks like:
if message.content.startswith("!jsontest"): import requests data = requests.get('http://schoolido.lu/api/cards/799/').json() print(data)
i've tried urllib.request.urlopen, i'm getting 403
error no matter method use. here's output:
traceback (most recent call last): file "c:\users\user\appdata\local\programs\python\python35-32\lib\site-packages\discord\client.py", line 259, in _run_event yield getattr(self, event)(*args, **kwargs) file "c:/users/user/desktop/bot.py", line 177, in on_message response = ur.urlopen("http://schoolido.lu/api/cards/799/") file "c:\users\user\appdata\local\programs\python\python35-32\lib\urllib\request.py", line 162, in urlopen return opener.open(url, data, timeout) file "c:\users\user\appdata\local\programs\python\python35-32\lib\urllib\request.py", line 471, in open response = meth(req, response) file "c:\users\user\appdata\local\programs\python\python35-32\lib\urllib\request.py", line 581, in http_response 'http', request, response, code, msg, hdrs) file "c:\users\user\appdata\local\programs\python\python35-32\lib\urllib\request.py", line 509, in error return self._call_chain(*args) file "c:\users\user\appdata\local\programs\python\python35-32\lib\urllib\request.py", line 443, in _call_chain result = func(*args) file "c:\users\user\appdata\local\programs\python\python35-32\lib\urllib\request.py", line 589, in http_error_default raise httperror(req.full_url, code, msg, hdrs, fp) urllib.error.httperror: http error 403: forbidden
am missing something, or code wrong? i've tried bunch of other examples so, none of them did different, i.e still 403
.
Comments
Post a Comment