You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When init an API Client object the parameter typing indicates it shoud receive an Environment type value but if it receives something else (like string representation of it) it pass through correctly and default the enviroment of the instance to Sandbox (
); which might confuse users who think they are doing it well (It happened to me).
I would expect the param to stick to only allow an Environment type value and raise otherwise.
Something like below (two suggestions I have)
class BaseAppStoreServerAPIClient:
def __init__(self, signing_key: bytes, key_id: str, issuer_id: str, bundle_id: str, environment: Environment):
Environment[environment] # Just check if env exists and leave it raise if not
if environment == Environment.XCODE:
raise ValueError("Xcode is not a supported environment for an AppStoreServerAPIClient")
if environment == Environment.PRODUCTION:
self._base_url = "https://api.storekit.itunes.apple.com"
elif environment == Environment.LOCAL_TESTING:
self._base_url = "https://local-testing-base-url"
elif environment == Environment.SANDBOX: # Or leave the else as it is if using an early return to raise
self._base_url = "https://api.storekit-sandbox.itunes.apple.com"
else:
raise ValueError(f"{environment} is not a supported environment")
The text was updated successfully, but these errors were encountered:
When init an API Client object the parameter typing indicates it shoud receive an
Environment
type value but if it receives something else (like string representation of it) it pass through correctly and default the enviroment of the instance toSandbox
(app-store-server-library-python/appstoreserverlibrary/api_client.py
Line 469 in 1202058
I would expect the param to stick to only allow an Environment type value and raise otherwise.
Something like below (two suggestions I have)
The text was updated successfully, but these errors were encountered: