Skip to content

Commit

Permalink
Fix distribution and URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
frafra committed Nov 23, 2022
1 parent 700afc5 commit 9887908
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions coat2pycsw.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


def get_datasets(url):
package_search = urljoin(url, "/api/3/action/package_search")
package_search = urljoin(url, "api/3/action/package_search")
res = requests.get(package_search, params={"rows": 0})
end = res.json()["result"]["count"]
rows = 10
Expand Down Expand Up @@ -50,18 +50,19 @@ def main():
repo = repository.Repository(database, context, table=table_name)

for dataset in get_datasets(URL):
dataset_url = urljoin(URL, "dataset/" + dataset["name"] + "/")
dataset_metadata = {
"mcf": {"version": 1.0},
"metadata": {
"identifier": dataset["id"],
"language": "en",
"charset": "utf8",
"datestamp": dataset["metadata_modified"],
"dataseturi": dataset["url"],
"dataseturi": dataset_url,
},
"spatial": {"datatype": "vector", "geomtype": "point"},
"identification": {
"language": "eng",
"language": "en",
"charset": "utf8",
"title": {"en": dataset["title"]},
"abstract": {"en": dataset["notes"]},
Expand Down Expand Up @@ -89,7 +90,7 @@ def main():
"rights": {
"en": dataset["resource_citations"],
},
"url": dataset["url"],
"url": dataset_url,
"status": "onGoing",
"maintenancefrequency": "continual",
},
Expand All @@ -106,13 +107,13 @@ def main():
},
},
"distribution": {
"waf": {
"url": dataset["url"],
"en": {
"url": urljoin(dataset_url, "zip"),
"type": "WWW:LINK",
"rel": "canonical",
"name": "my waf",
"name": "ZIP-compressed dataset\"" + dataset["name"] + "\"",
"description": {
"en": "description in English",
"en": "ZIP-compressed dataset\"" + dataset["name"] + "\"",
},
"function": "download",
}
Expand Down

0 comments on commit 9887908

Please sign in to comment.