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 fastapi_pagination import LimitOffsetPage, paginate, add_pagination | |
| from pydantic import BaseModel | |
| from fastapi import FastAPI | |
| from sqlalchemy.exc import SQLAlchemyError | |
| from sqlalchemy.orm import sessionmaker, declarative_base | |
| from datetime import date | |
| app = FastAPI(title=" A simple pagination learning exercise", | |
| debug=True) | |
| add_pagination(app) |
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 fastapi_pagination import Page, paginate, add_pagination | |
| from pydantic import BaseModel | |
| from fastapi import FastAPI | |
| from sqlalchemy.exc import SQLAlchemyError | |
| from sqlalchemy.orm import sessionmaker, declarative_base | |
| from datetime import date | |
| app = FastAPI(title=" A simple pagination learning exercise", | |
| debug=True) | |
| add_pagination(app) |
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
| { | |
| "all_employees": [ | |
| { | |
| "dept": 17, | |
| "empname": "Christopher Whitaker", | |
| "location": "Antarctica (the territory South of 60 deg S)", | |
| "dob": "1962-12-13", | |
| "empid": 53 | |
| }, | |
| ... |
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 sqlalchemy.orm import sessionmaker, declarative_base | |
| Base = declarative_base() | |
| app = FastAPI(title=" A simple pagination learning exercise", | |
| debug=True) | |
| class Employee(Base): | |
| __tablename__ = "employee" |
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 faker import Faker | |
| from sqlalchemy import create_engine, text | |
| from sqlalchemy.exc import SQLAlchemyError | |
| from sqlalchemy.orm import sessionmaker | |
| from urllib.parse import quote | |
| def connect_to_db(): | |
| connection_url = "mysql+pymysql://<username>:<password>@<hostname>:3306/<databasename>" |
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 sqlalchemy import create_engine, text | |
| from sqlalchemy.exc import SQLAlchemyError | |
| from sqlalchemy.orm import sessionmaker | |
| from urllib.parse import quote | |
| def connect_to_db(): | |
| connection_url = "mysql+pymysql://<username>:<password>@<hostname>:3306/<databasename>" |
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
| { | |
| "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('a1049f67-e41a-4c43-961-4604e17')/messages", | |
| "@odata.nextLink": "https://graph.microsoft.com/v1.0/me/messages?$search=%22subject%3aTest+subject+email%22&top=1&$skiptoken=MSZZVlF4YlZwcVVUVmFWR2N4V1hreGFscHFVWGxNSGc9", | |
| "value": [ | |
| { | |
| "@odata.etag": "W/\"CQAAABYAAAB4JTob+Wwd80MYwNQJT\"", | |
| "id": "AAMkADA4NWYzMjliLWFkNzQtNGEzYS1hOTETYxNWQ3MGYyYmEzOABGAAAAAAAcrUN9WKzQR46Vn6UoXJxfBwBUaFNIx94JTob_Wwd80MYHAAAAAAEJAABUaFNIx94JTob_Wwd80MYHAACwp1kOAAA=", | |
| "createdDateTime": "2022-07-26T10:14:07Z", | |
| "lastModifiedDateTime": "2022-07-26T10:16:26Z", | |
| "changeKey": "CQAAABYAAABob+Wwd80MYHAACwNQJT", |
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 requests | |
| from requests import RequestException | |
| from msal import ClientApplication | |
| def get_email_messages(subject): | |
| try: | |
| app = ClientApplication(client_id='your client id', |
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 BaseSettings | |
| class Settings(BaseSettings): | |
| DB_NAME: str = 'local' | |
| DB_USER: str = 'localuser' | |
| DB_HOST: str = "mysql.localhost.com" | |
| DB_PASSWORD: str | |
| API_ENDPOINT: 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
| from pydantic import BaseSettings | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| class Settings(BaseSettings): | |
| DB_NAME: str = 'local' | |
| DB_USER: str = 'localuser' |
NewerOlder