You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To improve on the experience, you can use [pyenv](https://github.com/pyenv/pyenv) to have an environment with a pinned Python version,
38
-
and [direnv](https://github.com/direnv/direnv) to automatically activate/deactivate the environment when you enter/exit the project folder.
39
-
40
-
### Dependencies
41
-
42
-
To install this package and its development dependencies, run `make install-dev`
43
-
44
-
### Formatting
45
-
46
-
We use `autopep8` and `isort` to automatically format the code to a common format. To run the formatting, just run `make format`.
47
-
48
-
### Linting, type-checking and unit testing
34
+
## Features
49
35
50
-
We use `flake8` for linting, `mypy` for type checking and `pytest` for unit testing. To run these tools, just run `make check-code`.
36
+
Besides greatly simplifying the process of querying the Apify API, the client provides other useful features.
51
37
52
-
### Documentation
38
+
### Automatic parsing and error handling
53
39
54
-
We use the [Google docstring format](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) for documenting the code.
55
-
We document every user-facing class or method, and enforce that using the flake8-docstrings library.
40
+
Based on the endpoint, the client automatically extracts the relevant data and returns it in the
41
+
expected format. Date strings are automatically converted to `datetime.datetime` objects. For exceptions,
42
+
we throw an `ApifyApiError`, which wraps the plain JSON errors returned by API and enriches
43
+
them with other context for easier debugging.
56
44
57
-
The documentation is then rendered from the docstrings in the code using Sphinx and some heavy post-processing and saved as `docs/docs.md`.
58
-
To generate the documentation, just run `make docs`.
45
+
### Retries with exponential backoff
59
46
60
-
### Release process
47
+
Network communication sometimes fails. The client will automatically retry requests that
48
+
failed due to a network error, an internal error of the Apify API (HTTP 500+) or rate limit error (HTTP 429).
49
+
By default, it will retry up to 8 times. First retry will be attempted after ~500ms, second after ~1000ms
50
+
and so on. You can configure those parameters using the `max_retries` and `min_delay_between_retries_millis`
51
+
options of the `ApifyClient` constructor.
61
52
62
-
Publishing new versions to [PyPI](https://pypi.org/project/apify-client) happens automatically through GitHub Actions.
53
+
### Support for asynchronous usage
63
54
64
-
On each commit to the `master` branch, a new beta release is published, taking the version number from `pyproject.toml`
65
-
and automatically incrementing the beta version suffix by 1 from the last beta release published to PyPI.
55
+
Starting with version 1.0.0, the package offers an asynchronous version of the client, [`ApifyClientAsync`](https://docs.apify.com/api/client/python),
56
+
which allows you to work with the Apify API in an asynchronous way, using the standard `async`/`await` syntax.
66
57
67
-
A stable version is published when a new release is created using GitHub Releases, again taking the version number from `pyproject.toml`. The built package assets are automatically uploaded to the GitHub release.
58
+
### Convenience functions and options
68
59
69
-
If there is already a stable version with the same version number as in `pyproject.toml` published to PyPI, the publish process fails,
70
-
so don't forget to update the version number before releasing a new version.
71
-
The release process also fails when the released version is not described in `CHANGELOG.md`,
72
-
so don't forget to describe the changes in the new version there.
60
+
Some actions can't be performed by the API itself, such as indefinite waiting for an actor run to finish
61
+
(because of network timeouts). The client provides convenient `call()` and `wait_for_finish()` functions that do that.
62
+
Key-value store records can be retrieved as objects, buffers or streams via the respective options, dataset items
63
+
can be fetched as individual objects or serialized data and we plan to add better stream support and async iterators.
0 commit comments