Merged
Conversation
key_reference and version_notes coming soon
…' and ../data_type/{data-type}'
Collaborator
|
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? |
peanutfun
reviewed
Feb 28, 2023
climada/util/api_client.py
Outdated
Comment on lines
+261
to
+268
| 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 |
Member
There was a problem hiding this comment.
No need to use a regex, there is a function to extract url components: urllib.parse.urlsplit
Suggested change
| 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 |
# Conflicts: # climada/util/api_client.py
- better integration of data_type versions and references - data_type properties filtered by extant dataset poperties
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this PR:
DataTypeInfoclass:key_referenceandversion_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