Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagepy
#http://validatie-api.hydamo.nl/task/[task_id]/execute/csv,geopackage,geojson
format = "csv,geopackage,geojson"

response_execute_task = requests.post(f"{server}/task/{task_id}/execute/{format}", headers=my_headers, verify=hydamo_cert) 

if response_execute_task.status_code == 202:
    print("Taak wordt gestart!")
    #controleer de status van de validatie-taak (periodiek)
    response_get_task = requests.get(f"{server}/task/{task_id}", headers=my_headers, verify=hydamo_cert) 
    if response_get_task.status_code == 200:
        status = str(response_get_task.json()["status"]) 
        while not status == "finished" or not status == "error":
            response_get_task = requests.get(f"{server}/task/{task_id}", headers=my_headers, verify=hydamo_cert)
            if response_get_task.status_code == 200:
                status = str(response_get_task.json()["status"])
                print(f"status taak: {status}")
            time.sleep(60)

...