-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data API data model extension #624
Conversation
key_reference and version_notes coming soon
…' and ../data_type/{data-type}'
I tried to run the test, tutorials and some of my scripts using the API. Everything runs fine. version_notes is to specify what has been changed in each version then? what about key_reference? |
climada/util/api_client.py
Outdated
urlpat = r"http(s?)://([^:/]+)(:\d+)?(/|$)" | ||
match = re.match(urlpat, url) | ||
if match: | ||
host = match.group(2) | ||
port = int(match.group(3)[1:]) if match.group(3) else 443 if match.group(1) else 80 | ||
else: | ||
raise ValueError(f'URL not as expected, cannot figure out host and port from "{url}"') | ||
return host, port |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to use a regex, there is a function to extract url components: urllib.parse.urlsplit
urlpat = r"http(s?)://([^:/]+)(:\d+)?(/|$)" | |
match = re.match(urlpat, url) | |
if match: | |
host = match.group(2) | |
port = int(match.group(3)[1:]) if match.group(3) else 443 if match.group(1) else 80 | |
else: | |
raise ValueError(f'URL not as expected, cannot figure out host and port from "{url}"') | |
return host, port | |
url_split = urlsplit(url) | |
port = url_split.port | |
if port is None: | |
port = 443 if url_split.scheme == "https" else 80 | |
return url_split.netloc, port |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool 😎
# Conflicts: # climada/util/api_client.py
- better integration of data_type versions and references - data_type properties filtered by extant dataset poperties
Changes proposed in this PR:
DataTypeInfo
class:key_reference
andversion_notes
. They are necessary in order to cope with the soon to be updated data_type Json Schema.This PR fixes #
PR Author Checklist
develop
)PR Reviewer Checklist