Skip to content
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

Misc docs fixes and improvements #43

Merged
merged 5 commits into from
Mar 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ with Client() as client:
print(client.projects.list())
```

Learn more [in the documentation](https://getodk.github.io/pyodk/).

### Examples

**👉 See detailed tutorials in the Examples library in the pyODK documentation.**
**👉 See detailed tutorials in [the documentation](https://getodk.github.io/pyodk/examples/).**

```python
from pyodk.client import Client
Expand All @@ -108,17 +110,6 @@ client.forms.update(
client.close()
```

### Raw HTTP requests
For interacting with parts of the ODK Central API ([docs](https://odkcentral.docs.apiary.io)) that have not been implemented in `pyodk`, use HTTP verb methods exposed on the `Client`:

```
client.get("projects/8")
client.post("projects/7/app-users", json={"displayName": "Lab Tech"})
```
You can find a more detailed tutorial in the Examples library in the pyODK documentation.

These methods provide convenient access to `Client.session`, which is a `requests.Session` object subclass. The `Session` has customised to prefix request URLs with the `base_url` from the pyodk config. For example with a base_url `https://www.example.com`, a call to `client.session.get("projects/8")` gets the details of `project_id=8`, using the full url `https://www.example.com/v1/projects/8`.

### Session customization
If Session behaviour needs to be customised, for example to set alternative timeouts or retry strategies, etc., then subclass the `pyodk.session.Session` and provide an instance to the `Client` constructor, e.g. `Client(session=my_session)`.

Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
site_name: pyODK
edit_uri: https://github.com/getodk/pyodk/docs
edit_uri: https://github.com/getodk/pyodk/tree/master/docs
repo_url: https://github.com/getodk/pyodk
repo_name: getodk/pyodk
docs_dir: docs
Expand Down
2 changes: 1 addition & 1 deletion pyodk/_endpoints/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ProjectService(bases.Service):
from pyodk.client import Client

client = Client()
forms = client.projects.list()
projects = client.projects.list()
```
"""

Expand Down
2 changes: 1 addition & 1 deletion pyodk/_endpoints/submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SubmissionService(bases.Service):
from pyodk.client import Client

client = Client()
data = client.forms.get_table()["value"]
data = client.submissions.get_table(form_id="my-form")["value"]
```
"""

Expand Down