Versions Compared

Key

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

...

Code Block
languagepy
file_path = r"...\ValidatietoolHyDAMO\Wiki\Datasetbestanden"
datasets = ["DuikerSifonHevel.gpkg", "HydroObject.gpkg", "Regelmiddel.gpkg"]
task_id = response_new_task.json()["id"]

for dataset in datasets:
  params = {"file": dataset}
  files = {"file": open(os.path.join(file_path,dataset), "rb")}
  
  #https://validatie-api.hydamo.nl/task/[task_id]/datasets
  response_upload_datasets = requests.post(f"{server}/task/{task_id}/datasets", files=files, params=params, headers=my_headers, verify=hydamo_cert) 
  if response_upload_datasets.status_code == 201:
    data = response_upload_datasets.json()
    print("id: " + str(data["id"]))
    print("naam dataset: " + dataset)
    print("aantal dataset bestanden: " + str(data["numberOfDatasets"])) 

...

Code Block
languagepy
file_path = r"...ValidatietoolHyDAMO\Wiki\Validatieregels"
validationrules = "validationrules_complete.json"

params = {"file": datasetvalidationrules}
files = {"file": open(os.path.join(file_path,validationrules)", "rb")}

#http://validatie-api.hydamo.nl/task/[task_id]/validationrules
response_upload_validationrules = requests.post(f"{server}/task/{task_id}/validationrules", files=files, params=params, headers=my_headers, verify=hydamo_cert) 

if response_upload_validationrules.status_code == 201:
    data = response_upload_validationrules.json()
    print("id: " + str(data["id"]))
    print("validatieregels aanwezig: " + str(data["validationRules"])) 

...