Created
October 6, 2021 08:14
-
-
Save niconoe/5273bd16a371d509329253cd90406aab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
def get_json_from_url(url): | |
"""Small helper""" | |
res = requests.get(url) | |
data = res.json() | |
return data | |
def get_resource_for_dp(resource_for_export): | |
resource_for_dp = resource_for_export.copy() | |
resource_for_dp["schema"] = get_json_from_url(resource_for_export["schema"]) | |
return resource_for_dp | |
camtrapDPVersion = "0.1.6" | |
_deploymentResourceForExport = { | |
# add here other properties | |
"schema": f"https://raw.githubusercontent.com/tdwg/camtrap-dp/{camtrapDPVersion}/deployments-table-schema.json" | |
} | |
_deploymentResourceForDataPackage = get_resource_for_dp(_deploymentResourceForExport) | |
# at this stage, _deploymentResourceForExport is good for the export and _deploymentResourceForDataPackage can be | |
# passed to add_resource() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment