-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from liblaber/python_v2
Python v2
- Loading branch information
Showing
28 changed files
with
349 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,3 +183,4 @@ node_modules | |
sdk-examples/python/pics | ||
sdk-examples/rest/pics | ||
llama-store.sln | ||
.mono/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
|
||
# pylint: disable=duplicate-code | ||
|
||
from pydantic import BaseModel, Field | ||
from pydantic import BaseModel, ConfigDict, Field | ||
from models.user import UserRegistration | ||
|
||
|
||
|
@@ -13,8 +13,8 @@ class APITokenRequest(UserRegistration): | |
A model to represent an API token request. The email and password must match an existing user. | ||
""" | ||
|
||
model_config = { | ||
"json_schema_extra": { | ||
model_config = ConfigDict( | ||
json_schema_extra={ | ||
"examples": [ | ||
{ | ||
"email": "[email protected]", | ||
|
@@ -23,8 +23,8 @@ class APITokenRequest(UserRegistration): | |
], | ||
"description": "A request to get an API token for a given user.", | ||
}, | ||
"from_attributes": True, | ||
} | ||
from_attributes=True, | ||
) | ||
|
||
|
||
class APIToken(BaseModel): | ||
|
@@ -36,22 +36,28 @@ class APIToken(BaseModel): | |
access_token: str = Field( | ||
description="The bearer token to use with the API. Pass this in the Authorization header as a bearer token.", | ||
examples=["Authorization: Bearer 1234567890abcdef"], | ||
alias="accessToken", | ||
title="Access Token", | ||
) | ||
|
||
token_type: str = Field( | ||
default="bearer", | ||
description="The type of token. This will always be bearer.", | ||
examples=["bearer"], | ||
alias="tokenType", | ||
title="Token Type", | ||
) | ||
|
||
model_config = { | ||
"json_schema_extra": { | ||
model_config = ConfigDict( | ||
json_schema_extra={ | ||
"examples": [ | ||
{ | ||
"access_token": "1234567890abcdef", | ||
"token_type": "bearer", | ||
"accessToken": "1234567890abcdef", | ||
"tokenType": "bearer", | ||
} | ||
], | ||
"description": "An API token to use for authentication.", | ||
}, | ||
"from_attributes": True, | ||
} | ||
from_attributes=True, | ||
populate_by_name=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
import re | ||
from typing import Annotated | ||
from pydantic import BaseModel, StringConstraints, validator, Field | ||
from pydantic import BaseModel, ConfigDict, StringConstraints, validator, Field | ||
|
||
EMAIL_REGEX = r".+\@.+\..+" | ||
PASSWORD_REGEX = re.compile(r"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$") | ||
|
@@ -51,8 +51,8 @@ def passwords_match(cls, v, values, **kwargs): # pylint: disable=unused-argumen | |
) | ||
return v | ||
|
||
model_config = { | ||
"json_schema_extra": { | ||
model_config = ConfigDict( | ||
json_schema_extra={ | ||
"examples": [ | ||
{ | ||
"email": "[email protected]", | ||
|
@@ -61,8 +61,8 @@ def passwords_match(cls, v, values, **kwargs): # pylint: disable=unused-argumen | |
], | ||
"description": "A new user of the llama store.", | ||
}, | ||
"from_attributes": True, | ||
} | ||
from_attributes=True, | ||
) | ||
|
||
|
||
class User(UserBase): | ||
|
@@ -75,8 +75,8 @@ class User(UserBase): | |
examples=[1, 2, 3], | ||
) | ||
|
||
model_config = { | ||
"json_schema_extra": { | ||
model_config = ConfigDict( | ||
json_schema_extra={ | ||
"examples": [ | ||
{ | ||
"id": "1", | ||
|
@@ -85,5 +85,5 @@ class User(UserBase): | |
], | ||
"description": "A user of the llama store", | ||
}, | ||
"from_attributes": True, | ||
} | ||
from_attributes=True, | ||
) |
Oops, something went wrong.