Skip to content
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
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@
- added configurable socket timeout for requests to the Apify API
- added `py.typed` file to signal type checkers that this package is typed
- added method to update status message for a run
- added option to set up webhooks for actor builds
- added option to set up webhooks for Actor builds
- added logger with basic debugging info
- added support for `schema` parameter in `get_or_create` method for datasets and key-value stores
- added support for `title` parameter in task and schedule methods
- added `x-apify-workflow-key` header support
- added support for `flatten` and `view` parameters in dataset items methods
- added support for `origin` parameter in actor/task run methods
- added clients for actor version environment variables
- added support for `origin` parameter in Actor/task run methods
- added clients for Actor version environment variables

### Fixed

Expand All @@ -186,7 +186,7 @@

### Removed

- Dropped support for single-file actors
- Dropped support for single-file Actors

### Internal changes

Expand Down Expand Up @@ -248,11 +248,11 @@
### Changed

- replaced `base_url` with `api_url` in the client constructor
to enable easier passing of the API server url from environment variables available to actors on the Apify platform
to enable easier passing of the API server url from environment variables available to Actors on the Apify platform

### Internal changes

- changed tags for actor images with this client on Docker Hub to be aligned with the Apify SDK Node.js images
- changed tags for Actor images with this client on Docker Hub to be aligned with the Apify SDK Node.js images
- updated the `requests` dependency to 2.26.0
- updated development dependencies

Expand All @@ -267,7 +267,7 @@

- updated development dependencies
- enforced unified use of single quotes and double quotes
- added repository dispatch to build actor images with this client when publishing a new version
- added repository dispatch to build Actor images with this client when publishing a new version

## [0.0.1](../../releases/tag/v0.0.1) - 2021-05-13

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ tests with HTML coverage report execute `make unit-tests-cov`.

## Integration tests

We have integration tests which build and run actors using the Python SDK on the Apify Platform. To run these tests,
We have integration tests which build and run Actors using the Python SDK on the Apify Platform. To run these tests,
you need to set the `APIFY_TEST_USER_API_TOKEN` environment variable to the API token of the Apify user you want to
use for the tests, and then start them with `make integration-tests`.

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ from apify_client import ApifyClient

apify_client = ApifyClient('MY-APIFY-TOKEN')

# Start an actor and wait for it to finish
# Start an Actor and wait for it to finish
actor_call = apify_client.actor('john-doe/my-cool-actor').call()

# Fetch results from the actor's default dataset
# Fetch results from the Actor's default dataset
dataset_items = apify_client.dataset(actor_call['defaultDatasetId']).list_items().items
```

Expand Down Expand Up @@ -57,7 +57,7 @@ which allows you to work with the Apify API in an asynchronous way, using the st

### Convenience functions and options

Some actions can't be performed by the API itself, such as indefinite waiting for an actor run to finish
Some actions can't be performed by the API itself, such as indefinite waiting for an Actor run to finish
(because of network timeouts). The client provides convenient `call()` and `wait_for_finish()` functions that do that.
Key-value store records can be retrieved as objects, buffers or streams via the respective options, dataset items
can be fetched as individual objects or serialized data and we plan to add better stream support and async iterators.
10 changes: 5 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ apify_client = ApifyClient('MY-APIFY-TOKEN')
# Collection clients do not require a parameter
actor_collection_client = apify_client.actors()

# Create an actor with the name: my-actor
# Create an Actor with the name: my-actor
my_actor = actor_collection_client.create(name='my-actor')

# List all of your actors
# List all of your Actors
actor_list = actor_collection_client.list().items
```

Expand Down Expand Up @@ -220,7 +220,7 @@ The package offers an asynchronous version of the client,
[`ApifyClientAsync`](/reference/class/ApifyClientAsync),
which allows you to work with the Apify API in an asynchronous way, using the standard `async`/`await` syntax [offered by Python](https://docs.python.org/3/library/asyncio-task.html).

For example, to run an actor and asynchronously stream its log while it's running, you can use this snippet:
For example, to run an Actor and asynchronously stream its log while it's running, you can use this snippet:

```python
from apify_client import ApifyClientAsync
Expand Down Expand Up @@ -258,7 +258,7 @@ please refer to the official Python [documentation on logging](https://docs.pyth

### Convenience functions and options

Some actions can't be performed by the API itself, such as indefinite waiting for an actor run to finish (because of network timeouts).
Some actions can't be performed by the API itself, such as indefinite waiting for an Actor run to finish (because of network timeouts).
The client provides convenient [`call()`](/reference/class/ActorClient#call)
and [`wait_for_finish()`](/reference/class/ActorClient#wait_for_finish) methods that do that.

Expand Down Expand Up @@ -335,7 +335,7 @@ Instead of the parsed resource, they return a raw, context-managed
which has to be consumed using the `with` keyword,
and automatically gets closed once you exit the `with` block, preventing memory leaks and unclosed connections.

For example, to consume an actor run log in a streaming fashion, you can use this snippet:
For example, to consume an Actor run log in a streaming fashion, you can use this snippet:

```python
with apify_client.run('MY-RUN-ID').log().stream() as log_stream:
Expand Down
36 changes: 18 additions & 18 deletions src/apify_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,22 @@ def __init__(
)

def actor(self: ApifyClient, actor_id: str) -> ActorClient:
"""Retrieve the sub-client for manipulating a single actor.
"""Retrieve the sub-client for manipulating a single Actor.

Args:
actor_id (str): ID of the actor to be manipulated
actor_id (str): ID of the Actor to be manipulated
"""
return ActorClient(resource_id=actor_id, **self._options())

def actors(self: ApifyClient) -> ActorCollectionClient:
"""Retrieve the sub-client for manipulating actors."""
"""Retrieve the sub-client for manipulating Actors."""
return ActorCollectionClient(**self._options())

def build(self: ApifyClient, build_id: str) -> BuildClient:
"""Retrieve the sub-client for manipulating a single actor build.
"""Retrieve the sub-client for manipulating a single Actor build.

Args:
build_id (str): ID of the actor build to be manipulated
build_id (str): ID of the Actor build to be manipulated
"""
return BuildClient(resource_id=build_id, **self._options())

Expand All @@ -158,15 +158,15 @@ def builds(self: ApifyClient) -> BuildCollectionClient:
return BuildCollectionClient(**self._options())

def run(self: ApifyClient, run_id: str) -> RunClient:
"""Retrieve the sub-client for manipulating a single actor run.
"""Retrieve the sub-client for manipulating a single Actor run.

Args:
run_id (str): ID of the actor run to be manipulated
run_id (str): ID of the Actor run to be manipulated
"""
return RunClient(resource_id=run_id, **self._options())

def runs(self: ApifyClient) -> RunCollectionClient:
"""Retrieve the sub-client for querying multiple actor runs of a user."""
"""Retrieve the sub-client for querying multiple Actor runs of a user."""
return RunCollectionClient(**self._options())

def dataset(self: ApifyClient, dataset_id: str) -> DatasetClient:
Expand Down Expand Up @@ -246,7 +246,7 @@ def log(self: ApifyClient, build_or_run_id: str) -> LogClient:
"""Retrieve the sub-client for retrieving logs.

Args:
build_or_run_id (str): ID of the actor build or run for which to access the log
build_or_run_id (str): ID of the Actor build or run for which to access the log
"""
return LogClient(resource_id=build_or_run_id, **self._options())

Expand Down Expand Up @@ -315,22 +315,22 @@ def __init__(
)

def actor(self: ApifyClientAsync, actor_id: str) -> ActorClientAsync:
"""Retrieve the sub-client for manipulating a single actor.
"""Retrieve the sub-client for manipulating a single Actor.

Args:
actor_id (str): ID of the actor to be manipulated
actor_id (str): ID of the Actor to be manipulated
"""
return ActorClientAsync(resource_id=actor_id, **self._options())

def actors(self: ApifyClientAsync) -> ActorCollectionClientAsync:
"""Retrieve the sub-client for manipulating actors."""
"""Retrieve the sub-client for manipulating Actors."""
return ActorCollectionClientAsync(**self._options())

def build(self: ApifyClientAsync, build_id: str) -> BuildClientAsync:
"""Retrieve the sub-client for manipulating a single actor build.
"""Retrieve the sub-client for manipulating a single Actor build.

Args:
build_id (str): ID of the actor build to be manipulated
build_id (str): ID of the Actor build to be manipulated
"""
return BuildClientAsync(resource_id=build_id, **self._options())

Expand All @@ -339,15 +339,15 @@ def builds(self: ApifyClientAsync) -> BuildCollectionClientAsync:
return BuildCollectionClientAsync(**self._options())

def run(self: ApifyClientAsync, run_id: str) -> RunClientAsync:
"""Retrieve the sub-client for manipulating a single actor run.
"""Retrieve the sub-client for manipulating a single Actor run.

Args:
run_id (str): ID of the actor run to be manipulated
run_id (str): ID of the Actor run to be manipulated
"""
return RunClientAsync(resource_id=run_id, **self._options())

def runs(self: ApifyClientAsync) -> RunCollectionClientAsync:
"""Retrieve the sub-client for querying multiple actor runs of a user."""
"""Retrieve the sub-client for querying multiple Actor runs of a user."""
return RunCollectionClientAsync(**self._options())

def dataset(self: ApifyClientAsync, dataset_id: str) -> DatasetClientAsync:
Expand Down Expand Up @@ -427,7 +427,7 @@ def log(self: ApifyClientAsync, build_or_run_id: str) -> LogClientAsync:
"""Retrieve the sub-client for retrieving logs.

Args:
build_or_run_id (str): ID of the actor build or run for which to access the log
build_or_run_id (str): ID of the Actor build or run for which to access the log
"""
return LogClientAsync(resource_id=build_or_run_id, **self._options())

Expand Down
4 changes: 2 additions & 2 deletions src/apify_client/clients/base/actor_job_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

@ignore_docs
class ActorJobBaseClient(ResourceClient):
"""Base sub-client class for actor runs and actor builds."""
"""Base sub-client class for Actor runs and Actor builds."""

def _wait_for_finish(self: ActorJobBaseClient, wait_secs: int | None = None) -> dict | None:
started_at = datetime.now(timezone.utc)
Expand Down Expand Up @@ -73,7 +73,7 @@ def _abort(self: ActorJobBaseClient, gracefully: bool | None = None) -> dict:

@ignore_docs
class ActorJobBaseClientAsync(ResourceClientAsync):
"""Base async sub-client class for actor runs and actor builds."""
"""Base async sub-client class for Actor runs and Actor builds."""

async def _wait_for_finish(self: ActorJobBaseClientAsync, wait_secs: int | None = None) -> dict | None:
started_at = datetime.now(timezone.utc)
Expand Down
Loading