Created
June 15, 2022 09:42
-
-
Save rahul-yr/7588c7a053ce15b31795e004063e3014 to your computer and use it in GitHub Desktop.
Here I defined all the required methods for url_shorteners
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
from pydantic import BaseModel | |
# Define the model for the URL | |
class CreateUrlShortener(BaseModel): | |
url: str | |
# Config for pydantic to validate the data in the request body | |
class Config: | |
orm_mode = True | |
# Define the model for the URL Response | |
class CreateUrlShortenerResponse(BaseModel): | |
# short_url is the short url generated by the server | |
short_url: str | |
url: str | |
# Config for pydantic to validate the data in the request body | |
class Config: | |
orm_mode = True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment