This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Pinkishu's profile picture

https'ing github -> nil

Started by Pinkishu, 10 February 2013 - 01:58 PM
Pinkishu #1
Posted 10 February 2013 - 02:58 PM
hey theres


local f = http.get("https://api.github.com/user/repos")
print(type(f))
f.close()

^ returns nil for me? While when i got there in web-browser i get
{
"message": "Requires authentication"
}

Any ideas?
I'm tired so maybe i'm just doing something wrong, but going to bed now~ night :3
raineth #2
Posted 10 February 2013 - 03:58 PM
{
"message": "Requires authentication"
}
Although your browser isn't making it obvious, this JSON fragment is part of an HTTP error page (HTTP error 401 - authorization required.) The HTTP API doesn't currently let you examine the message body or exact HTTP error code when the server returns an error, but things should theoretically work once you solve authentication.
Pinkishu #3
Posted 10 February 2013 - 10:49 PM
Ah, didn't know HTTP API just fails like that xD thanks