http_check event

From ComputerCraft
Jump to: navigation, search
http_check
Event
Returns

Source CC:Tweaked

Occurs after a successful call to http.checkURLAsync, containing information about whether the URL is blacklisted or not.

ExampleExamplePrints an error if blacklisted
Checks a URL and waits for a http_check event, printing an error if it is blacklisted.
Code
local check_url = "https://example.computercraft.cc/"
local ok, err = http.checkURLAsync(check_url)
if not ok then 
  printError(err)
else
  while true do
    local event, url, ok, err = os.pullEvent("http_check")
    if url == check_url then
      if not ok then printError(err) end
      break
    end
  end
end