# Retrieve all access urls for registered tutorials (most of these
# come from here as of 2023) and make sure they still give an HTTP 200

import time

import requests
import pyvo

def main():
	regtap = pyvo.dal.TAPService("http://dc.g-vo.org/tap")
	for row in regtap.search("""select access_url from
			rr.interface
			where intf_role='rendered'"""):
		try:
			res = requests.head(row["access_url"])
			if res.status_code!=200:
				print(f"Non-200 code on {row['access_url']}: {res.status_code}.")
		except Exception as exc:
			print(f"Requests failure {row['access_url']}: {exc}.")
		time.sleep(0.3)

if __name__=="__main__":
	main()
