Compare commits
8 Commits
85838f4175
...
master
Author | SHA1 | Date | |
---|---|---|---|
b51ee3db69 | |||
584af01366 | |||
7be0209169 | |||
7e8afb21ec | |||
104401dab9 | |||
7e604c2feb | |||
cefd4fb745 | |||
5b8ab1ab23 |
@ -1,35 +1,11 @@
|
|||||||
anyio==3.6.2
|
anyio==4.0.0
|
||||||
bcrypt==4.0.1
|
certifi==2023.7.22
|
||||||
certifi==2022.12.7
|
emoji==2.8.0
|
||||||
charset-normalizer==3.1.0
|
exceptiongroup==1.1.3
|
||||||
click==8.1.3
|
|
||||||
crypto==1.4.1
|
|
||||||
fastapi==0.95.0
|
|
||||||
greenlet==2.0.2
|
|
||||||
h11==0.14.0
|
h11==0.14.0
|
||||||
httptools==0.5.0
|
httpcore==0.18.0
|
||||||
|
httpx==0.25.0
|
||||||
idna==3.4
|
idna==3.4
|
||||||
install==1.3.5
|
|
||||||
mysql-connector-python==8.0.32
|
|
||||||
mysql-connector-python-rf==2.2.2
|
|
||||||
Naked==0.1.32
|
|
||||||
passlib==1.7.4
|
|
||||||
protobuf==3.20.3
|
|
||||||
pydantic==1.10.6
|
|
||||||
python-dotenv==1.0.0
|
python-dotenv==1.0.0
|
||||||
python-magic==0.4.27
|
python-telegram-bot==20.6
|
||||||
python-multipart==0.0.6
|
|
||||||
PyYAML==6.0
|
|
||||||
requests==2.28.2
|
|
||||||
shellescape==3.8.1
|
|
||||||
sniffio==1.3.0
|
sniffio==1.3.0
|
||||||
SQLAlchemy==1.4.41
|
|
||||||
sqlalchemy2-stubs==0.0.2a32
|
|
||||||
sqlmodel==0.0.8
|
|
||||||
starlette==0.26.1
|
|
||||||
typing_extensions==4.5.0
|
|
||||||
urllib3==1.26.15
|
|
||||||
uvicorn==0.21.1
|
|
||||||
uvloop==0.17.0
|
|
||||||
watchfiles==0.18.1
|
|
||||||
websockets==10.4
|
|
||||||
|
14
server.py
14
server.py
@ -1,3 +1,4 @@
|
|||||||
|
import pathlib
|
||||||
from typing import Union, Annotated
|
from typing import Union, Annotated
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from routes.user_routes import user_route
|
from routes.user_routes import user_route
|
||||||
@ -78,12 +79,19 @@ async def create_upload_file(file: UploadFile | None, package: Annotated[str, Fo
|
|||||||
os.makedirs(dir_last)
|
os.makedirs(dir_last)
|
||||||
if not os.path.exists(dir_stable):
|
if not os.path.exists(dir_stable):
|
||||||
os.makedirs(dir_stable)
|
os.makedirs(dir_stable)
|
||||||
with open(f"{dir_file}/{filename}", 'a') as f:
|
|
||||||
|
if os.path.exists(f"{dir_file}/{filename}"):
|
||||||
|
os.remove(f"{dir_file}/{filename}")
|
||||||
|
with open(f"{dir_file}/{filename}", 'wb') as f:
|
||||||
f.write(contents)
|
f.write(contents)
|
||||||
with open(f"{dir_last}/{filename}", 'a') as f:
|
if os.path.exists(f"{dir_last}/{filename}"):
|
||||||
|
os.remove(f"{dir_last}/{filename}")
|
||||||
|
with open(f"{dir_last}/{filename}", 'wb') as f:
|
||||||
f.write(contents)
|
f.write(contents)
|
||||||
if stable:
|
if stable:
|
||||||
with open(f"{dir_stable}/{filename}", 'a') as f:
|
if os.path.exists(f"{dir_stable}/{filename}"):
|
||||||
|
os.remove(f"{dir_stable}/{filename}")
|
||||||
|
with open(f"{dir_stable}/{filename}", 'wb') as f:
|
||||||
f.write(contents)
|
f.write(contents)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
return {"message": "There was an error uploading the file, error {err}".format(err=err)}
|
return {"message": "There was an error uploading the file, error {err}".format(err=err)}
|
||||||
|
Reference in New Issue
Block a user