Skip to content

Commit 88deb01

Browse files
authored
Merge pull request #5 from jowilf/publish_pypi
Publish to pypi
2 parents d51ba57 + 121f8d5 commit 88deb01

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

.github/workflows/publish.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
name: Publish
22
on:
33
workflow_dispatch:
4-
54
release:
6-
types:
7-
- created
5+
types: [published]
6+
7+
permissions:
8+
contents: read
89

910
jobs:
1011
publish:
@@ -26,7 +27,7 @@ jobs:
2627
run: poetry install
2728
- name: Publish
2829
env:
29-
PYPI_TOKEN: ${{ secrets.$PYPI_TOKEN_SQLALCHEMY_FILE }}
30+
PYPI_TOKEN: ${{ secrets.$PYPI_TOKEN }}
3031
run: |
3132
poetry config pypi-token.pypi $PYPI_TOKEN
3233
poetry publish --build

docs/tutorial/serving-files.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# Serving Files
22

33
## With FastApi
4+
45
```Python
56
@app.get("/medias/{storage}/{file_id}", response_class=FileResponse)
6-
def serving_files(storage: str = Path(...), file_id: str = Path(...)):
7+
def serve_files(storage: str = Path(...), file_id: str = Path(...)):
78
try:
89
file = StorageManager.get_file(f"{storage}/{file_id}")
910
if isinstance(file.object.driver, LocalStorageDriver):
@@ -25,12 +26,15 @@ def serving_files(storage: str = Path(...), file_id: str = Path(...)):
2526
except ObjectDoesNotExistError:
2627
return JSONResponse({"detail": "Not found"}, status_code=404)
2728
```
28-
See Full example [here]()
29+
30+
See full
31+
example [here](https://github.com/jowilf/sqlalchemy-file/blob/d51ba57215e364cc14c4e0a61456567091ce51c1/examples/fastapi_app.py#L123)
2932

3033
## With Flask
34+
3135
```Python
3236
@app.route("/medias/<storage>/<file_id>")
33-
def serving_files(storage, file_id):
37+
def serve_files(storage, file_id):
3438
try:
3539
file = StorageManager.get_file(f"{storage}/{file_id}")
3640
if isinstance(file.object.driver, LocalStorageDriver):
@@ -54,4 +58,6 @@ def serving_files(storage, file_id):
5458
except ObjectDoesNotExistError:
5559
abort(404)
5660
```
57-
See Full example [here]()
61+
62+
See full
63+
example [here](https://github.com/jowilf/sqlalchemy-file/blob/d51ba57215e364cc14c4e0a61456567091ce51c1/examples/flask_app.py#L78)

examples/fastapi_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def create_new(category: Category = Depends(category_form)):
120120

121121

122122
@app.get("/medias/{storage}/{file_id}", response_class=FileResponse)
123-
def serving_files(storage: str = Path(...), file_id: str = Path(...)):
123+
def serve_files(storage: str = Path(...), file_id: str = Path(...)):
124124
try:
125125
file = StorageManager.get_file(f"{storage}/{file_id}")
126126
if isinstance(file.object.driver, LocalStorageDriver):

examples/flask_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def index():
7575

7676

7777
@app.route("/medias/<storage>/<file_id>")
78-
def serving_files(storage, file_id):
78+
def serve_files(storage, file_id):
7979
try:
8080
file = StorageManager.get_file(f"{storage}/{file_id}")
8181
if isinstance(file.object.driver, LocalStorageDriver):

0 commit comments

Comments
 (0)