Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Retrieving "Maximum Charged Results" via API#346

Unanswered
muhammetakkurtt asked this question inQ&A
Discussion options

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 optionsoptions=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!

You must be logged in to vote

Replies: 4 comments

Comment options

Hi! According to the documentation (https://docs.apify.com/platform/actors/development/programming-interface/environment-variables#system-environment-variables),os.environ.get('ACTOR_MAX_PAID_DATASET_ITEMS') should give you the user limit on paid dataset items. The run options probably returns the same number.

If the run has no configured limit, the variable will be empty, which is the correct behavior - you're supposed to let the Actor run and the platform will stop it in case the user runs out of credit.

You must be logged in to vote
0 replies
Comment options

Hi! According to the documentation (https://docs.apify.com/platform/actors/development/programming-interface/environment-variables#system-environment-variables),os.environ.get('ACTOR_MAX_PAID_DATASET_ITEMS') should give you the user limit on paid dataset items. The run options probably returns the same number.

If the run has no configured limit, the variable will be empty, which is the correct behavior - you're supposed to let the Actor run and the platform will stop it in case the user runs out of credit.

Is Apify SDK for Python required for the platform to stop the actor? This doesn't seem to work with the Client. Since I'm running it in DEVELOPMENT mode, I'm not being charged, and it allows exceeding the limit. I'm not entirely sure if this happens automatically.

There should be a way to determine the maximum result a user can enter in the run options based on their remaining credit. In the console interface, this value is displayed in real-time, ensuring that users do not exceed their available limit.

You must be logged in to vote
0 replies
Comment options

Hi! According to the documentation (https://docs.apify.com/platform/actors/development/programming-interface/environment-variables#system-environment-variables),os.environ.get('ACTOR_MAX_PAID_DATASET_ITEMS') should give you the user limit on paid dataset items. The run options probably returns the same number.
If the run has no configured limit, the variable will be empty, which is the correct behavior - you're supposed to let the Actor run and the platform will stop it in case the user runs out of credit.

Is Apify SDK for Python required for the platform to stop the actor? This doesn't seem to work with the Client. Since I'm running it in DEVELOPMENT mode, I'm not being charged, and it allows exceeding the limit. I'm not entirely sure if this happens automatically.

This is handled entirely by the platform, the SDK should not be a requirement. If you're not being charged, then you cannot exceed the limit - I'm not sure how else it should behave.

There should be a way to determine the maximum result a user can enter in the run options based on their remaining credit. In the console interface, this value is displayed in real-time, ensuring that users do not exceed their available limit.

Problem is, there cannot really be a way - this number can change while your Actor is running - imagine that the user runs multiple paid Actors at once - then their "limit" is highly unpredictable.

You must be logged in to vote
0 replies
Comment options

Hi! According to the documentation (https://docs.apify.com/platform/actors/development/programming-interface/environment-variables#system-environment-variables),os.environ.get('ACTOR_MAX_PAID_DATASET_ITEMS') should give you the user limit on paid dataset items. The run options probably returns the same number.
If the run has no configured limit, the variable will be empty, which is the correct behavior - you're supposed to let the Actor run and the platform will stop it in case the user runs out of credit.

Is Apify SDK for Python required for the platform to stop the actor? This doesn't seem to work with the Client. Since I'm running it in DEVELOPMENT mode, I'm not being charged, and it allows exceeding the limit. I'm not entirely sure if this happens automatically.

This is handled entirely by the platform, the SDK should not be a requirement. If you're not being charged, then you cannot exceed the limit - I'm not sure how else it should behave.

There should be a way to determine the maximum result a user can enter in the run options based on their remaining credit. In the console interface, this value is displayed in real-time, ensuring that users do not exceed their available limit.

Problem is, there cannot really be a way - this number can change while your Actor is running - imagine that the user runs multiple paid Actors at once - then their "limit" is highly unpredictable.

Thank you for your help!

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
t-toolingIssues with this label are in the ownership of the tooling team.
2 participants
@muhammetakkurtt@janbuchar
Converted from issue

This discussion was converted from issue #341 on February 04, 2025 08:01.


[8]ページ先頭

©2009-2025 Movatter.jp