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

Retrieving "Maximum Charged Results" via API #341

Open
muhammetakkurtt opened this issue Jan 29, 2025 · 0 comments
Open

Retrieving "Maximum Charged Results" via API #341

muhammetakkurtt opened this issue Jan 29, 2025 · 0 comments
Labels
t-tooling Issues with this label are in the ownership of the tooling team.

Comments

@muhammetakkurtt
Copy link

Hello,

I have a question regarding PPR actors.

In the Apify Console, users can manually set the "Maximum charged results" value in the Run Options section. The maximum allowed value is automatically calculated based on the actor’s pricing and the user’s remaining monthly limit, ensuring they cannot enter a value exceeding their available balance.

However, I couldn't find a way to retrieve this value using the Apify Python Client API. For example:

run = client.run(run_id)
run_info = run.get()

# Retrieve run options
options = run_info.get('options', {})
max_charged_results = options.get('maxItems')

If the user manually sets a "Maximum charged results" value, maxItems returns the specified number. However, if it is set to "No limit", the value returned is None.

I also tried checking the following environment variable but got the same result:

max_items = os.environ.get('ACTOR_MAX_PAID_DATASET_ITEMS')

As a workaround, I found a manual solution by calculating the maximum number of results a user can retrieve based on their balance. This involves checking the user’s monthly limit, their remaining balance, and the actor’s per-result pricing, then performing the calculation externally. While this works, I was wondering if there is a more direct way to obtain this value.

Is there an API method that provides this pre-calculated "Maximum charged results" value, or is manual calculation the only option?

I would appreciate any guidance on this.

Thank you!

@github-actions github-actions bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Jan 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t-tooling Issues with this label are in the ownership of the tooling team.
Projects
None yet
Development

No branches or pull requests

1 participant