Library for the Minecraft mod ComputerCraft/CC: Tweaked including some additional HTTP Methodes
HTTPUtils can be installed using the ComputerCraft Package Tool by using the following commands:
Install CCPT, only run if you havn't installed it yet:
pastebin run syAUmLaF
Install the library:
ccpt install httputils
The library will now be stored in "/lib/httputils". It depends on "fileutils", which will be installed automaticly with HTTPUtils.
https://github.com/PentagonLP/httputils/blob/main/testing/testdata will be used in all examples:
{
greeting = "'ello"
}
The function gethttpdata([url]) returns the parsed table fetched from the given URL. If an error occures, the errormessage is printed in console and false is returned.
Example:
The function downloadfile([filepath],[url]) downloads a file from the given URL and stores it in the given filepath. If an error occures, the errormessage is printed in console and false is returned.
Example:
Content of "test":
{
greeting = "'ello"
}
The function gethttpresult([url]) returns the raw result fetched from the given URL. If an error occures, the errormessage is printed in console and false is returned. This is only a helper methode; It only differs from http.get([url]) because it does some additional error checking.
Example:
Nothing here yet, we are still on 1.0 :)
First of all, thanks for reading! This library is not the biggest library ever, but it turned out to be really useful for one of my projects, and maybe it is for yours too :)
If you find bugs, please create an issue so I can fix them.
I'm still very new to Github, so feel free to point out things I could do better. Also, english is not my first language, so if you find any spelling/language-related mistakes, please do also create an issue.
Have a nice day,
PentagonLP