Skip to content

Commit fb4227a

Browse files
committed
chore: fix constants file being ignored
1 parent 99f7698 commit fb4227a

File tree

3 files changed

+73
-52
lines changed

3 files changed

+73
-52
lines changed

.openapi-generator-ignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,5 @@ openfga_sdk/api/open_fga_api
1414
openfga_sdk/sync/open_fga_api.py
1515
openfga_sdk/api_client.py
1616
openfga_sdk/configuration.py
17-
openfga_sdk/constants.py
1817
openfga_sdk/exceptions.py
1918
openfga_sdk/rest.py

.openapi-generator/FILES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ docs/WriteRequest.md
9898
docs/WriteRequestDeletes.md
9999
docs/WriteRequestWrites.md
100100
openfga_sdk/api/open_fga_api.py
101+
openfga_sdk/constants.py
101102
openfga_sdk/models/__init__.py
102103
openfga_sdk/models/aborted_message_response.py
103104
openfga_sdk/models/any.py

openfga_sdk/constants.py

Lines changed: 72 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -13,60 +13,81 @@
1313
from typing import Final
1414

1515

16-
# SDK version information
17-
SDK_VERSION: Final[str] = "0.9.7" # Version of the OpenFGA Python SDK
16+
# Version of the OpenFGA Python SDK.
17+
SDK_VERSION: Final[str] = "0.9.7"
1818

19-
# User agent for HTTP requests
20-
USER_AGENT: Final[str] = "openfga-sdk python/0.9.7" # User agent used in HTTP requests
19+
# User agent used in HTTP requests.
20+
USER_AGENT: Final[str] = "openfga-sdk python/0.9.7"
2121

22-
# Sample API domain for examples
23-
SAMPLE_BASE_DOMAIN: Final[str] = (
24-
"fga.example" # Example API domain for documentation/tests
25-
)
22+
# Example API domain for documentation/tests.
23+
SAMPLE_BASE_DOMAIN: Final[str] = "fga.example"
24+
25+
# API URL used for tests.
26+
TEST_API_URL: Final[str] = f"https://api.{SAMPLE_BASE_DOMAIN}"
27+
28+
# API Token Issuer URL used for tests.
29+
TEST_ISSUER_URL: Final[str] = f"https://issuer.{SAMPLE_BASE_DOMAIN}"
30+
31+
# Default API URL.
32+
DEFAULT_API_URL: Final[str] = "http://localhost:8080"
2633

2734
# Retry configuration
28-
RETRY_MAX_ALLOWED_NUMBER: Final[int] = (
29-
15 # Maximum allowed number of retries for HTTP requests
30-
)
31-
DEFAULT_MAX_RETRY: Final[int] = 3 # Default maximum number of retries for HTTP requests
32-
DEFAULT_MIN_WAIT_IN_MS: Final[int] = (
33-
100 # Default minimum wait time between retries in milliseconds
34-
)
35-
MAX_BACKOFF_TIME_IN_SEC: Final[int] = 120 # Maximum backoff time in seconds
36-
RETRY_HEADER_MAX_ALLOWABLE_DURATION_IN_SEC: Final[int] = (
37-
1800 # Maximum allowable duration for retry headers in seconds
38-
)
39-
40-
# Client configuration
41-
CLIENT_MAX_METHOD_PARALLEL_REQUESTS: Final[int] = (
42-
10 # Maximum number of parallel requests for a single method
43-
)
44-
CLIENT_MAX_BATCH_SIZE: Final[int] = 50 # Maximum batch size for batch requests
45-
DEFAULT_CONNECTION_TIMEOUT_IN_MS: Final[int] = (
46-
10000 # Default connection timeout in milliseconds
47-
)
35+
36+
# Maximum allowed number of retries for HTTP requests.
37+
RETRY_MAX_ALLOWED_NUMBER: Final[int] = 15
38+
39+
# Default maximum number of retries for HTTP requests.
40+
DEFAULT_MAX_RETRY: Final[int] = 3
41+
42+
# Default minimum wait time between retries in milliseconds.
43+
DEFAULT_MIN_WAIT_IN_MS: Final[int] = 100
44+
45+
# Maximum backoff time in seconds.
46+
MAX_BACKOFF_TIME_IN_SEC: Final[int] = 120
47+
48+
# Maximum allowable duration for retry headers in seconds.
49+
RETRY_HEADER_MAX_ALLOWABLE_DURATION_IN_SEC: Final[int] = 1800
50+
51+
# Standard HTTP header for retry-after.
52+
RETRY_AFTER_HEADER_NAME: Final[str] = "Retry-After"
53+
54+
# Rate limit reset header name.
55+
RATE_LIMIT_RESET_HEADER_NAME: Final[str] = "X-RateLimit-Reset"
56+
57+
# Alternative rate limit reset header name.
58+
RATE_LIMIT_RESET_ALT_HEADER_NAME: Final[str] = "X-Rate-Limit-Reset"
59+
60+
# Client methods
61+
62+
# Maximum number of parallel requests for a single method.
63+
CLIENT_MAX_METHOD_PARALLEL_REQUESTS: Final[int] = 10
64+
65+
# Maximum batch size for batch requests.
66+
CLIENT_MAX_BATCH_SIZE: Final[int] = 50
67+
68+
# Header used to identify the client method.
69+
CLIENT_METHOD_HEADER: Final[str] = "X-OpenFGA-Client-Method"
70+
71+
# Header used to identify bulk requests.
72+
CLIENT_BULK_REQUEST_ID_HEADER: Final[str] = "X-OpenFGA-Client-Bulk-Request-Id"
73+
74+
# Connection options
75+
76+
# Default timeout for HTTP requests in milliseconds.
77+
DEFAULT_REQUEST_TIMEOUT_IN_MS: Final[int] = 10000
78+
79+
# Default connection timeout in milliseconds.
80+
DEFAULT_CONNECTION_TIMEOUT_IN_MS: Final[int] = 10000
4881

4982
# Token management
50-
TOKEN_EXPIRY_THRESHOLD_BUFFER_IN_SEC: Final[int] = (
51-
300 # Buffer time in seconds before token expiry to consider it expired
52-
)
53-
TOKEN_EXPIRY_JITTER_IN_SEC: Final[int] = (
54-
300 # Jitter time in seconds to add randomness to token expiry checks
55-
)
56-
57-
# HTTP headers
58-
CLIENT_METHOD_HEADER: Final[str] = (
59-
"X-OpenFGA-Client-Method" # Header used to identify the client method
60-
)
61-
CLIENT_BULK_REQUEST_ID_HEADER: Final[str] = (
62-
"X-OpenFGA-Client-Bulk-Request-Id" # Header used to identify bulk requests
63-
)
64-
RETRY_AFTER_HEADER_NAME: Final[str] = (
65-
"Retry-After" # Standard HTTP header for retry after
66-
)
67-
RATE_LIMIT_RESET_HEADER_NAME: Final[str] = (
68-
"X-RateLimit-Reset" # Rate limit reset header name
69-
)
70-
RATE_LIMIT_RESET_ALT_HEADER_NAME: Final[str] = (
71-
"X-Rate-Limit-Reset" # Alternative rate limit reset header name
72-
)
83+
84+
# Buffer time in seconds before token expiry to consider it expired.
85+
TOKEN_EXPIRY_THRESHOLD_BUFFER_IN_SEC: Final[int] = 300
86+
87+
# Jitter time in seconds to add randomness to token expiry checks.
88+
TOKEN_EXPIRY_JITTER_IN_SEC: Final[int] = 300
89+
90+
# FGA Response Headers
91+
92+
# Response header name for query duration in milliseconds.
93+
QUERY_DURATION_HEADER_NAME: Final[str] = "fga-query-duration-ms"

0 commit comments

Comments
 (0)