Skip to content

Conversation

yuji38kwmt
Copy link
Collaborator

@yuji38kwmt yuji38kwmt commented Jan 21, 2020

close #110


#: アクセスするURL
URL_PREFIX = "https://annofab.com/api/v1"
URL_PREFIX = f"{DEFAULT_ENDPOINT_URL}/v1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここにあるクラス変数の URL_PREFIX は不要じゃないでしょうか

Copy link
Collaborator Author

@yuji38kwmt yuji38kwmt Jan 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_request_wrapperメソッドと、loginメソッドの2か所で使っているので、必要だと思いました。

def _request_wrapper(self, http_method: str, url_path: str, query_params: Optional[Dict[str, Any]] = None,

def login(self) -> Tuple[Dict[str, Any], requests.Response]:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

???
あれ、必要といいつつ、結局消しちゃいました?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

すみません、クラス変数とインスタンス変数を勘違いしていました…

  • クラス変数のurl_prefixは不要です。
  • インスタンス変数のself.url_prefixは、他のメソッドで使用しているので必要です。

self.login_password = login_password

self.endpoint_url = endpoint_url
self.URL_PREFIX = f"{endpoint_url}/v1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ここだけ大文字なのはなぜ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

もともと定数として扱っていたので、大文字にしていました。
今回の対応で定数ではなくなったので、小文字に変更します。

@yuji38kwmt yuji38kwmt merged commit e90e98f into master Jan 22, 2020
@yuji38kwmt yuji38kwmt deleted the 109-set-endpoint branch January 24, 2020 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants