generated from owl-corp/python-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an example endpoint for making requests to printful
- Loading branch information
1 parent
dec7cf2
commit 139f7d3
Showing
2 changed files
with
18 additions
and
0 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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import logging | ||
|
||
from fastapi import APIRouter, Depends | ||
|
||
from src.auth import TokenAuth | ||
from src.settings import PrintfulClient | ||
|
||
router = APIRouter(tags=["Printful"], prefix="/printful", dependencies=[Depends(TokenAuth(allow_regular_users=True))]) | ||
log = logging.getLogger(__name__) | ||
|
||
|
||
@router.get("/templates") | ||
async def get_templates(client: PrintfulClient) -> dict: | ||
"""Return all templates in printful.""" | ||
resp = await client.get("/product-templates") | ||
return resp.json() |