-
Notifications
You must be signed in to change notification settings - Fork 10
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
Implement basic features with structured layer #1
Conversation
The basic structure looks good to me. |
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.
Thanks! @hexoul Let's move on to the next stage!
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.
Thanks! Left some questions and minor comments. 😄
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.
Thanks! just nits. 😄
kwargs.update(self.configs) | ||
return kwargs | ||
|
||
def _request(self, method: str, url: str, **kwargs) -> requests.Response: |
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.
only _request() depends on requests, not request()
Yeah but, the return type of request()
is requests.Response
so it still depends on it?
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.
Thanks a lot @hexoul, I learned a lot. 😄
centraldogma/base_client.py
Outdated
return self._request(method, self._create_url(path), **kwargs) | ||
|
||
def _create_url(self, path) -> str: | ||
return self.base_url + "/" + self.PATH_PREFIX + path |
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.
return self.base_url + "/" + self.PATH_PREFIX + path | |
return self.base_url + self.PATH_PREFIX + path |
Let's do this and do
PATH_PREFIX = "/api/v1"
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.
Also we might want to normalize the base_url
later because if base_url
endswith /
then there are double /
s. 😄
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.
Thanks! Good point. I did workaround in constructor to prevent from being double /
s. Please check it. https://github.com/line/centraldogma-python/pull/1/files#diff-50828eb36eff8f9de6017b747f7ba14ff8d5ecda0f1f528ee180f3e44574ba6bR24
>>> a = "123/"
>>> a[-1]
'/'
>>> a[:-1]
'123'
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.
Awesome. 👍
@okue Do you have a chance to look at this PR? |
🎉 🎉 🎉 |
Motivation:
Modifications:
ProjectService
RepositoryService
ContentService
Result: