Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Change Log

## 24.4.0

* Added: `domains` service to manage domains, DNS records, email presets, prices, transfer status and zones
* Added: `waf` service with bypass, challenge, deny, rate-limit and redirect rules
* Added: `account.createEmailVerificationOTP`, `updateEmailVerificationOTP`, `createRecoveryOTP` and `updateRecoveryOTP`
* Added: `account.createIdTokenSession` and `Identity.providerIdToken`
* Added: `oauth2.introspect`
* Added: project environments with `project.createEnvironment`, `getEnvironment`, `listEnvironments`, `updateEnvironment` and `deleteEnvironment`
* Added: `organization.createEphemeralProjectKey`, `listProjectKeys`, `getProjectKey`, `updateProjectKey` and `deleteProjectKey`
* Added: Kakao, TikTok and Webflow OAuth2 providers with `project.updateOAuth2Kakao`, `updateOAuth2TikTok` and `updateOAuth2Webflow`
* Added: optional `prompt` on the Auth0, Discord, GitHub, Microsoft, Okta, Salesforce and Zoho OAuth2 settings, and native client IDs on Apple and Google
* Added: `project.updatePasswordPwnedPolicy`, `project.updatePasswordRotationPolicy` and `User.passwordPwned`
* Added: `messaging.createAppwriteProvider` and `messaging.updateAppwriteProvider`
* Added: optional `replyToEmail` and `replyToName` on email messages, `channelId` on push messages, and `qos` and `expiry` on topics
* Added: `avatars.updatePhoto` and `avatars.deletePhoto`
* Added: optional `duration` on `account.createEmailPasswordSession`, `current` on `account.deleteSessions`, `membershipId` on `teams.createMembership` and `fingerprints` on Android platforms
* Added: optional `total` on the locale, transaction, runtime, specification and framework lists
* Added: `dart-3.13` and `flutter-3.47` runtimes, the `jaspr` framework, the `trigram` index type, `auto` image gravity, the `dedicatedDatabase` proxy rule resource type, OTP email templates and new key scopes
* Added: optional fields on `BillingPlan`, `DedicatedDatabase`, `DedicatedDatabaseSpecification`, `Project` and `Topic`, and `free` and `start` in `BillingPlanGroup`

## 24.3.1

* Fixed: added `ProjectAuthMethodId.PASSKEY`, so `project.updateAuthMethod` can enable passkeys
Expand Down
12 changes: 8 additions & 4 deletions appwrite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ def __init__(self):
self._endpoint = 'https://cloud.appwrite.io/v1'
self._global_headers = {
'content-type': '',
'user-agent': f'AppwritePythonSDK/24.3.1 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
'user-agent': f'AppwritePythonSDK/24.4.0 ({platform.uname().system}; {platform.uname().version}; {platform.uname().machine})',
'x-sdk-name': 'Python',
'x-sdk-platform': 'server',
'x-sdk-language': 'python',
'x-sdk-version': '24.3.1',
'x-sdk-version': '24.4.0',
'X-Appwrite-Response-Format': '2.0.0',
}
self._config = {}
Expand Down Expand Up @@ -190,6 +190,9 @@ def call(self, method, path='', headers=None, params=None, response_type='json')
if response_type == 'location':
return response.headers.get('Location')

if response_type == 'text':
return response.content.decode('utf-8')

if content_type.startswith('application/json'):
return response.json()

Expand All @@ -214,6 +217,7 @@ def chunked_upload(
param_name='',
on_progress=None,
upload_id='',
method='post',
):
input_file = params[param_name]

Expand All @@ -230,7 +234,7 @@ def chunked_upload(
input_file.data = input.read()

params[param_name] = input_file
return self.call('post', path, headers, params)
return self.call(method, path, headers, params)

offset = 0
counter = 0
Expand Down Expand Up @@ -296,7 +300,7 @@ def upload_chunk(chunk, current_upload_id):
chunk_headers["x-appwrite-id"] = current_upload_id

return self.call(
'post',
method,
path,
chunk_headers,
chunk_params,
Expand Down
80 changes: 80 additions & 0 deletions appwrite/encoders/value_class_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from ..models.base_model import AppwriteModel
from ..enums.authenticator_type import AuthenticatorType
from ..enums.authentication_factor import AuthenticationFactor
from ..enums.id_token_provider import IdTokenProvider
from ..enums.o_auth_provider import OAuthProvider
from ..enums.browser import Browser
from ..enums.credit_card import CreditCard
Expand All @@ -16,6 +17,7 @@
from ..enums.databases_index_type import DatabasesIndexType
from ..enums.order_by import OrderBy
from ..enums.documents_db_index_type import DocumentsDBIndexType
from ..enums.domain_registration_type import DomainRegistrationType
from ..enums.embedding_model import EmbeddingModel
from ..enums.runtime import Runtime
from ..enums.project_key_scopes import ProjectKeyScopes
Expand All @@ -28,8 +30,16 @@
from ..enums.organization_key_scopes import OrganizationKeyScopes
from ..enums.region import Region
from ..enums.project_auth_method_id import ProjectAuthMethodId
from ..enums.project_o_auth2_auth0_prompt import ProjectOAuth2Auth0Prompt
from ..enums.project_o_auth2_discord_prompt import ProjectOAuth2DiscordPrompt
from ..enums.project_o_auth2_git_hub_prompt import ProjectOAuth2GitHubPrompt
from ..enums.project_o_auth2_google_prompt import ProjectOAuth2GooglePrompt
from ..enums.project_o_auth2_kakao_prompt import ProjectOAuth2KakaoPrompt
from ..enums.project_o_auth2_microsoft_prompt import ProjectOAuth2MicrosoftPrompt
from ..enums.project_o_auth2_oidc_prompt import ProjectOAuth2OidcPrompt
from ..enums.project_o_auth2_okta_prompt import ProjectOAuth2OktaPrompt
from ..enums.project_o_auth2_salesforce_prompt import ProjectOAuth2SalesforcePrompt
from ..enums.project_o_auth2_zoho_prompt import ProjectOAuth2ZohoPrompt
from ..enums.project_o_auth_provider_id import ProjectOAuthProviderId
from ..enums.project_policy_id import ProjectPolicyId
from ..enums.project_protocol_id import ProjectProtocolId
Expand Down Expand Up @@ -58,13 +68,23 @@
from ..enums.execution_resource_type import ExecutionResourceType
from ..enums.execution_trigger import ExecutionTrigger
from ..enums.execution_status import ExecutionStatus
from ..enums.o_auth2_github_prompt import OAuth2GithubPrompt
from ..enums.o_auth2_discord_prompt import OAuth2DiscordPrompt
from ..enums.o_auth2_google_prompt import OAuth2GooglePrompt
from ..enums.o_auth2_zoho_prompt import OAuth2ZohoPrompt
from ..enums.o_auth2_salesforce_prompt import OAuth2SalesforcePrompt
from ..enums.o_auth2_auth0_prompt import OAuth2Auth0Prompt
from ..enums.o_auth2_oidc_prompt import OAuth2OidcPrompt
from ..enums.o_auth2_okta_prompt import OAuth2OktaPrompt
from ..enums.o_auth2_microsoft_prompt import OAuth2MicrosoftPrompt
from ..enums.o_auth2_kakao_prompt import OAuth2KakaoPrompt
from ..enums.platform_type import PlatformType
from ..enums.proxy_rule_deployment_resource_type import ProxyRuleDeploymentResourceType
from ..enums.proxy_rule_status import ProxyRuleStatus
from ..enums.message_status import MessageStatus
from ..enums.billing_plan_group import BillingPlanGroup
from ..enums.domain_transfer_status_enum import DomainTransferStatusEnum
from ..enums.waf_rule_action import WafRuleAction


class ValueClassEncoder(json.JSONEncoder):
Expand All @@ -78,6 +98,9 @@ def default(self, o):
if isinstance(o, AuthenticationFactor):
return o.value

if isinstance(o, IdTokenProvider):
return o.value

if isinstance(o, OAuthProvider):
return o.value

Expand Down Expand Up @@ -120,6 +143,9 @@ def default(self, o):
if isinstance(o, DocumentsDBIndexType):
return o.value

if isinstance(o, DomainRegistrationType):
return o.value

if isinstance(o, EmbeddingModel):
return o.value

Expand Down Expand Up @@ -156,12 +182,36 @@ def default(self, o):
if isinstance(o, ProjectAuthMethodId):
return o.value

if isinstance(o, ProjectOAuth2Auth0Prompt):
return o.value

if isinstance(o, ProjectOAuth2DiscordPrompt):
return o.value

if isinstance(o, ProjectOAuth2GitHubPrompt):
return o.value

if isinstance(o, ProjectOAuth2GooglePrompt):
return o.value

if isinstance(o, ProjectOAuth2KakaoPrompt):
return o.value

if isinstance(o, ProjectOAuth2MicrosoftPrompt):
return o.value

if isinstance(o, ProjectOAuth2OidcPrompt):
return o.value

if isinstance(o, ProjectOAuth2OktaPrompt):
return o.value

if isinstance(o, ProjectOAuth2SalesforcePrompt):
return o.value

if isinstance(o, ProjectOAuth2ZohoPrompt):
return o.value

if isinstance(o, ProjectOAuthProviderId):
return o.value

Expand Down Expand Up @@ -246,12 +296,36 @@ def default(self, o):
if isinstance(o, ExecutionStatus):
return o.value

if isinstance(o, OAuth2GithubPrompt):
return o.value

if isinstance(o, OAuth2DiscordPrompt):
return o.value

if isinstance(o, OAuth2GooglePrompt):
return o.value

if isinstance(o, OAuth2ZohoPrompt):
return o.value

if isinstance(o, OAuth2SalesforcePrompt):
return o.value

if isinstance(o, OAuth2Auth0Prompt):
return o.value

if isinstance(o, OAuth2OidcPrompt):
return o.value

if isinstance(o, OAuth2OktaPrompt):
return o.value

if isinstance(o, OAuth2MicrosoftPrompt):
return o.value

if isinstance(o, OAuth2KakaoPrompt):
return o.value

if isinstance(o, PlatformType):
return o.value

Expand All @@ -267,4 +341,10 @@ def default(self, o):
if isinstance(o, BillingPlanGroup):
return o.value

if isinstance(o, DomainTransferStatusEnum):
return o.value

if isinstance(o, WafRuleAction):
return o.value

return super().default(o)
2 changes: 2 additions & 0 deletions appwrite/enums/billing_plan_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@

class BillingPlanGroup(Enum):
STARTER = "starter"
FREE = "free"
START = "start"
PRO = "pro"
SCALE = "scale"
2 changes: 2 additions & 0 deletions appwrite/enums/build_runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class BuildRuntime(Enum):
DART_3_10 = "dart-3.10"
DART_3_11 = "dart-3.11"
DART_3_12 = "dart-3.12"
DART_3_13 = "dart-3.13"
DOTNET_6_0 = "dotnet-6.0"
DOTNET_7_0 = "dotnet-7.0"
DOTNET_8_0 = "dotnet-8.0"
Expand Down Expand Up @@ -95,3 +96,4 @@ class BuildRuntime(Enum):
FLUTTER_3_38 = "flutter-3.38"
FLUTTER_3_41 = "flutter-3.41"
FLUTTER_3_44 = "flutter-3.44"
FLUTTER_3_47 = "flutter-3.47"
1 change: 1 addition & 0 deletions appwrite/enums/databases_index_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ class DatabasesIndexType(Enum):
FULLTEXT = "fulltext"
UNIQUE = "unique"
SPATIAL = "spatial"
TRIGRAM = "trigram"
8 changes: 8 additions & 0 deletions appwrite/enums/domain_registration_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from enum import Enum


class DomainRegistrationType(Enum):
NEW = "new"
TRANSFER = "transfer"
RENEWAL = "renewal"
TRADE = "trade"
12 changes: 12 additions & 0 deletions appwrite/enums/domain_transfer_status_enum.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from enum import Enum


class DomainTransferStatusEnum(Enum):
TRANSFERRABLE = "transferrable"
NOT_TRANSFERRABLE = "not_transferrable"
PENDING_OWNER = "pending_owner"
PENDING_ADMIN = "pending_admin"
PENDING_REGISTRY = "pending_registry"
COMPLETED = "completed"
CANCELLED = "cancelled"
SERVICE_UNAVAILABLE = "service_unavailable"
1 change: 1 addition & 0 deletions appwrite/enums/framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class Framework(Enum):
REMIX = "remix"
LYNX = "lynx"
FLUTTER = "flutter"
JASPR = "jaspr"
REACT_NATIVE = "react-native"
VITE = "vite"
OTHER = "other"
6 changes: 6 additions & 0 deletions appwrite/enums/id_token_provider.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from enum import Enum


class IdTokenProvider(Enum):
APPLE = "apple"
GOOGLE = "google"
1 change: 1 addition & 0 deletions appwrite/enums/image_gravity.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


class ImageGravity(Enum):
AUTO = "auto"
CENTER = "center"
TOP_LEFT = "top-left"
TOP = "top"
Expand Down
7 changes: 7 additions & 0 deletions appwrite/enums/o_auth2_auth0_prompt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from enum import Enum


class OAuth2Auth0Prompt(Enum):
NONE = "none"
LOGIN = "login"
CONSENT = "consent"
6 changes: 6 additions & 0 deletions appwrite/enums/o_auth2_discord_prompt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from enum import Enum


class OAuth2DiscordPrompt(Enum):
NONE = "none"
CONSENT = "consent"
5 changes: 5 additions & 0 deletions appwrite/enums/o_auth2_github_prompt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from enum import Enum


class OAuth2GithubPrompt(Enum):
SELECT_ACCOUNT = "select_account"
8 changes: 8 additions & 0 deletions appwrite/enums/o_auth2_kakao_prompt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from enum import Enum


class OAuth2KakaoPrompt(Enum):
NONE = "none"
LOGIN = "login"
CREATE = "create"
SELECT_ACCOUNT = "select_account"
8 changes: 8 additions & 0 deletions appwrite/enums/o_auth2_microsoft_prompt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from enum import Enum


class OAuth2MicrosoftPrompt(Enum):
NONE = "none"
LOGIN = "login"
CONSENT = "consent"
SELECT_ACCOUNT = "select_account"
7 changes: 7 additions & 0 deletions appwrite/enums/o_auth2_okta_prompt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from enum import Enum


class OAuth2OktaPrompt(Enum):
NONE = "none"
LOGIN = "login"
CONSENT = "consent"
6 changes: 6 additions & 0 deletions appwrite/enums/o_auth2_salesforce_prompt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from enum import Enum


class OAuth2SalesforcePrompt(Enum):
LOGIN = "login"
CONSENT = "consent"
5 changes: 5 additions & 0 deletions appwrite/enums/o_auth2_zoho_prompt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from enum import Enum


class OAuth2ZohoPrompt(Enum):
CONSENT = "consent"
3 changes: 3 additions & 0 deletions appwrite/enums/o_auth_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class OAuthProvider(Enum):
GITLAB = "gitlab"
GOOGLE = "google"
HUGGINGFACE = "huggingface"
KAKAO = "kakao"
KEYCLOAK = "keycloak"
KICK = "kick"
LINKEDIN = "linkedin"
Expand All @@ -39,9 +40,11 @@ class OAuthProvider(Enum):
SLACK = "slack"
SPOTIFY = "spotify"
STRIPE = "stripe"
TIKTOK = "tiktok"
TRADESHIFT = "tradeshift"
TRADESHIFTBOX = "tradeshiftBox"
TWITCH = "twitch"
WEBFLOW = "webflow"
WORDPRESS = "wordpress"
X = "x"
YAHOO = "yahoo"
Expand Down
2 changes: 2 additions & 0 deletions appwrite/enums/project_email_template_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ class ProjectEmailTemplateId(Enum):
MFACHALLENGE = "mfaChallenge"
SESSIONALERT = "sessionAlert"
OTPSESSION = "otpSession"
OTPVERIFICATION = "otpVerification"
OTPRECOVERY = "otpRecovery"
Loading