@@ -3633,12 +3633,12 @@ def test_api_budget():
3633
3633
)
3634
3634
3635
3635
assert http_requester .api_budget is not None
3636
- assert http_requester .api_budget .ratelimit_reset_header == "X-RateLimit-Reset"
3637
- assert http_requester .api_budget .status_codes_for_ratelimit_hit == [429 , 503 ]
3638
- assert len (http_requester .api_budget .policies ) == 1
3636
+ assert http_requester .api_budget ._ratelimit_reset_header == "X-RateLimit-Reset"
3637
+ assert http_requester .api_budget ._status_codes_for_ratelimit_hit == [429 , 503 ]
3638
+ assert len (http_requester .api_budget ._policies ) == 1
3639
3639
3640
3640
# The single policy is a MovingWindowCallRatePolicy
3641
- policy = http_requester .api_budget .policies [0 ]
3641
+ policy = http_requester .api_budget ._policies [0 ]
3642
3642
assert isinstance (policy , MovingWindowCallRatePolicy )
3643
3643
assert policy ._bucket .rates [0 ].limit == 3
3644
3644
# The 0.1s from 'PT0.1S' is stored in ms by PyRateLimiter internally
@@ -3651,12 +3651,10 @@ def test_api_budget_fixed_window_policy():
3651
3651
"type" : "DeclarativeSource" ,
3652
3652
# Root-level api_budget referencing a FixedWindowCallRatePolicy
3653
3653
"api_budget" : {
3654
- "type" : "APIBudget" ,
3655
- "maximum_attempts_to_acquire" : 9999 ,
3654
+ "type" : "HTTPAPIBudget" ,
3656
3655
"policies" : [
3657
3656
{
3658
3657
"type" : "FixedWindowCallRatePolicy" ,
3659
- "next_reset_ts" : "2025-01-01T00:00:00Z" ,
3660
3658
"period" : "PT1M" , # 1 minute
3661
3659
"call_limit" : 10 ,
3662
3660
"matchers" : [
@@ -3701,20 +3699,16 @@ def test_api_budget_fixed_window_policy():
3701
3699
)
3702
3700
3703
3701
assert http_requester .api_budget is not None
3704
- assert http_requester .api_budget .maximum_attempts_to_acquire == 9999
3705
- assert len (http_requester .api_budget .policies ) == 1
3702
+ assert len (http_requester .api_budget ._policies ) == 1
3706
3703
3707
3704
from airbyte_cdk .sources .streams .call_rate import FixedWindowCallRatePolicy
3708
3705
3709
- policy = http_requester .api_budget .policies [0 ]
3706
+ policy = http_requester .api_budget ._policies [0 ]
3710
3707
assert isinstance (policy , FixedWindowCallRatePolicy )
3711
3708
assert policy ._call_limit == 10
3712
3709
# The period is "PT1M" => 60 seconds
3713
3710
assert policy ._offset .total_seconds () == 60
3714
3711
3715
- expected_reset_dt = datetime (2025 , 1 , 1 , 0 , 0 , 0 , tzinfo = timezone .utc )
3716
- assert policy ._next_reset_ts == expected_reset_dt
3717
-
3718
3712
assert len (policy ._matchers ) == 1
3719
3713
matcher = policy ._matchers [0 ]
3720
3714
from airbyte_cdk .sources .streams .call_rate import HttpRequestRegexMatcher
0 commit comments