Skip to content

Commit

Permalink
improve style and documentation
Browse files Browse the repository at this point in the history
Co-authored-by: Thibault Fouqueray <[email protected]>
Signed-off-by: Olivier Léobal <[email protected]>
  • Loading branch information
oleobal and ThibaultFy committed Aug 17, 2023
1 parent 1370803 commit c809973
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `list_task_output_assets` and `get_task_output_asset` wait that the compute task is over before getting assets ([#369](https://github.com/Substra/substra/pull/369))
- warning and help message when logging in with username/password rather than token ([#378](https://github.com/Substra/substra/pull/378))
- new `Client.logout` function, mirroring `Client.login` ([#381](https://github.com/Substra/substra/pull/381))
- `Client` can now be the expression in a `with` statement ([#381](https://github.com/Substra/substra/pull/381))
- `Client` can now be used within a context manager ([#381](https://github.com/Substra/substra/pull/381))
```python
with Client(
client_name="org-1",
backend_type="remote",
url="http://substra-backend.org-1.com:8000",
username="org-1",
password="p@sswr0d44",
) as client:
pass
```

### Changed

Expand Down
2 changes: 1 addition & 1 deletion substra/sdk/backends/remote/rest_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def login(self, username, password):
return token

def logout(self) -> None:
if not self._token_id:
if self._token_id is None:
return
try:
r = requests.delete(
Expand Down
2 changes: 1 addition & 1 deletion substra/sdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class Client:
username (str, optional): Username to authenticate to the Substra platform.
Used in conjunction with a password to generate a token if not given, using the `login` function.
If using username/password, you should use a context manager to ensure the session is terminated:
If using username/password, you should use a context manager to ensure the session terminates as intended:
```
with Client(username, password) as client:
...
Expand Down

0 comments on commit c809973

Please sign in to comment.