This file contains hidden or 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
| import re | |
| import json | |
| from pydantic import BaseModel, ValidationError, validator, conint | |
| from typing import List, Literal | |
| class Person(BaseModel): | |
| age: conint(ge=0, le=120) | |
| name: str |
This file contains hidden or 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
| {"timestamp": 1624283464.7776241, "codes": {"\ud83d\ude00": "grinning face", "\ud83d\ude03": "grinning face with big eyes", "\ud83d\ude04": "grinning face with smiling eyes", "\ud83d\ude01": "beaming face with smiling eyes", "\ud83d\ude06": "grinning squinting face", "\ud83d\ude05": "grinning face with sweat", "\ud83e\udd23": "rolling on the floor laughing", "\ud83d\ude02": "face with tears of joy", "\ud83d\ude42": "slightly smiling face", "\ud83d\ude43": "upside-down face", "\ud83d\ude09": "winking face", "\ud83d\ude0a": "smiling face with smiling eyes", "\ud83d\ude07": "smiling face with halo", "\ud83e\udd70": "smiling face with hearts", "\ud83d\ude0d": "smiling face with heart-eyes", "\ud83e\udd29": "star-struck", "\ud83d\ude18": "face blowing a kiss", "\ud83d\ude17": "kissing face", "\u263a\ufe0f": "smiling face", "\u263a": "smiling face", "\ud83d\ude1a": "kissing face with closed eyes", "\ud83d\ude19": "kissing face with smiling eyes", "\ud83e\udd72": "smiling face with tear", "\ud83d\ude0b": "face savor |
This file contains hidden or 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
| class JsonResponseMiddleware(BaseHTTPMiddleware): | |
| # BaseHTTPMiddleware returns a streaming response that can't be consumed in the middleware | |
| # Instead we consume it here and create a JsonResponse that can be consumed multiple times | |
| async def call_next(self, request: Request) -> Response: | |
| loop = asyncio.get_event_loop() | |
| queue = asyncio.Queue() # type: asyncio.Queue | |
| scope = request.scope |
This file contains hidden or 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
| def update_key(key, value, d: dict): | |
| if key not in d: | |
| d[key] = value | |
| else: | |
| if isinstance(value, dict): | |
| for k, v in value.items(): | |
| update_key(k, v, d[key]) | |
| else: | |
| raise RuntimeError('Trying to overwrite existing value') |
This file contains hidden or 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
| import clashroyale, asyncio | |
| async def top(client): | |
| p = await client.get_top_players() | |
| return p | |
| async def main(): | |
| token = "my token" |
This file contains hidden or 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
| Restore( | |
| onSuccess: (KinAccount restoredAccount) => | |
| { | |
| Debug.Log("Success"); | |
| }, | |
| onFailure: (KinException ex) => | |
| { | |
| Debug.LogError(ex); | |
| }, | |
| onCancel: () => |
This file contains hidden or 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
| swagger: "2.0" | |
| info: | |
| description: "Micro service to invoke common kin stuff using the kin-python-sdk." | |
| version: "1.0.0" | |
| title: "Kin Python Microservice" | |
| license: | |
| name: "MIT" | |
| url: "https://opensource.org/licenses/MIT" | |
| schemes: | |
| - "https" |
This file contains hidden or 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
| swagger: "2.0" | |
| info: | |
| description: "Micro service to invoke common kin stuff using the kin-python-sdk." | |
| version: "1.0.0" | |
| title: "Kin Python Microservice" | |
| license: | |
| name: "MIT" | |
| url: "https://opensource.org/licenses/MIT" | |
| schemes: | |
| - "https" |
This file contains hidden or 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
| swagger: "2.0" | |
| info: | |
| description: "Micro service to invoke common kin stuff using the kin-python-sdk." | |
| version: "1.0.0" | |
| title: "Kin Python Microservice" | |
| license: | |
| name: "MIT" | |
| url: "https://opensource.org/licenses/MIT" | |
| schemes: | |
| - "https" |