Skip to content

Commit 735d921

Browse files
committed
updates doc
1 parent 78897e8 commit 735d921

File tree

2 files changed

+36
-18
lines changed

2 files changed

+36
-18
lines changed

clients/python/src/osparc/_api_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ def __init__(
2828
)
2929
except ValidationError as exc:
3030
raise RuntimeError(
31-
"Could not initialize configuration from environment. "
31+
f"Could not initialize configuration from environment (expected {ConfigurationModel.model_fields_set}). "
3232
"If your osparc host, key and secret are not exposed as "
3333
"environment variables you must construct the "
34-
"Configuration object explicitly"
34+
"osparc.Configuration object explicitly"
3535
) from exc
3636

3737
super().__init__(configuration, header_name, header_value, cookie, pool_threads)

docs/doc_entrypoint.md

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,43 @@ You can install `osparc` directly from PyPI:
2121
pip install osparc
2222
```
2323

24-
## Usage
2524

26-
To get started with `osparc`, import the package and follow the examples in the [documentation](https://github.com/your-username/osparc/wiki).
25+
## Getting Started with `osparc`
2726

27+
To begin using `osparc`, simply import the package and refer to the detailed examples provided in the [official documentation](https://github.com/your-username/osparc/wiki).
2828

29-
```python
30-
from osparc import ApiClient, UsersApi
29+
### API Key/Secret Setup
30+
31+
Before interacting with the osparc API, you need to generate an API key-secret pair from your osparc account. Follow the [instructions here](https://docs.osparc.io/#/docs/platform_introduction/profile?id=preferences) to create the key and secret.
32+
33+
Once generated, you can configure them by either:
34+
35+
1. Setting environment variables:
36+
- `OSPARC_API_KEY`
37+
- `OSPARC_API_SECRET`
38+
39+
Or,
40+
41+
2. Explicitly creating a `osparc.Configuration` instance and passing it to the `osparc.ApiClient`.
3142

32-
cfg = Configuration(
33-
host=os.environ["OSPARC_API_HOST"],
34-
username=os.environ["OSPARC_API_KEY"],
35-
password=os.environ["OSPARC_API_SECRET"],
36-
)
43+
### Minimal Example
3744

38-
with ApiClient(cfg) as api_client:
45+
Here’s a minimal script demonstrating how to interact with the osparc API to retrieve your user profile:
3946

47+
```python
48+
import os
49+
from osparc import ApiClient, UsersApi
50+
51+
# Initialize the API client
52+
with ApiClient() as api_client:
4053
users_api = UsersApi(api_client)
4154

55+
# Fetch and print user profile information
4256
profile = users_api.get_my_profile()
4357
print(profile)
4458

45-
#
46-
# {'first_name': 'foo',
59+
# Example output:
60+
# {'first_name': 'foo',
4761
# 'gravatar_id': 'aa33fssec77ea434c2ea4fb92d0fd379e',
4862
# 'groups': {'all': {'description': 'all users',
4963
# 'gid': '1',
@@ -55,11 +69,15 @@ with ApiClient(cfg) as api_client:
5569
# 'last_name': '',
5670
# 'login': '[email protected]',
5771
# 'role': 'USER'}
58-
#
5972
```
60-
To dive deeper check these tutorials
61-
- [v0.5](clients/python/docs/v0.5.0/README.md)
62-
- [v0.6](clients/python/docs/v0.6.0/README.md)
73+
74+
### Additional Resources
75+
76+
For more in-depth usage, refer to the following tutorial guides:
77+
78+
- [Version 0.5 Documentation](clients/python/docs/v0.5.0/README.md)
79+
- [Version 0.6 Documentation](clients/python/docs/v0.6.0/README.md)
80+
6381

6482
## Contributing
6583

0 commit comments

Comments
 (0)