135201
You will be muted until you read the rules. Read them! @Rules_for_Python A group about the Python programming language. Offtopic things go here: @pythonofftopic Resources to learn python: @pythonres Group for Hy: @hylang Selenium: @SeleniumPython
yes i will try to learn and understand the di more better way, then maybe read and use the ur library this,
why don't you have not any documentation page for this library, is this because ur library is just use in one fun with Depends only this is the work of this library?
previously i didnot found this sorry, as i didnot see this pypi link in ur readme, i thought this is not exists in pypi, now i get this,
https://pypi.org/project/di-flask/
This i found, maybe i need to learn a little more to use ur library.
So ur library will help me to use the session: Session = Depends(get_session)
in my flask routes function so that i dont need to write the with block in all the database related function, am i right?
but can you say how i will use the Depends() <- fastapi, as this comes from fastapi here how i will use this in my flask routes.py, ooo ur library has this one Depends 💚
Flask does not have Depends function, FastAPI does
What do you mean there is no PyPi project for di-flask?
https://pypistats.org/packages/di-flask
Documentation is in README in GitHub repository
https://github.com/razorblade23/di-flask
Its very simply to use and basically gives you that Depends that FastAPI has but for the use in flask
As Per Sqlmodel Docs below is the sample code:
def get_session():
with Session(engine) as session:
yield session
# Code here omitted 👈
@app.post("/heroes/", response_model=HeroPublic)
def create_hero(*, session: Session = Depends(get_session), hero: HeroCreate):
db_hero = Hero.model_validate(hero)
session.add(db_hero)
session.commit()
session.refresh(db_hero)
return db_hero
session: Session = Depends(get_session)
Thankyou Sir, noted
Can you share me some resource or name of course that will be helpful
can you pls elaborate this logic, i am confsued and not know and listen anythign, i want to like this, fastapi's response model, easy way what you say some article or what/?
Читать полностью…
I need to extract python code from .exe and its on 3.11 I am unable to do it any leads
Читать полностью…
Hali Shon, please verify you are human by clicking the button below. You have 90 seconds.
Читать полностью…
Well, you should do a course in python and learn the according libraries to use excel, i've used some.
I wouldn't say it's extremely difficult.
Yaa, by the way thanks for trying to help me, i am actually want to get help from this python community who have already use this thigns.
Читать полностью…
Just read the description in readme.
It provide Depend() like functionality for flask apps.
You won't use FastAPI one, that's a completely different framework.
My wrapper library just provides dependency injection in Depends() style.
You should maybe learn about dependency injection first?
https://dev.to/hongster85/dependency-injection-understand-in-3-minutes-3a5k
And you can't really use this response_model=whatever in flask.
That's FastAPI concept, not flask's
So build it this group is not for request ready made bots
Читать полностью…
from ur github deployment it shows https://pypi.org/project/flask-di/
but it not opens there
Dear Sir, I am a Microsoft Excel user, basically,
Excel has functionally named as "python in excel"
That's what is trying to learn
Omg hey! so like, you're literally doing way too much here tbh. files.upload() already saves the zips to your colab folder automatically! You don't need that whole for loop at the bottom to write the files all over again, that's prob why it's crashing and acting super weird. Just delete everything after the upload() line and you're good to go bestie!
Читать полностью…
from google.colab import files
import os
uploaded = files.upload() # select all 4 zips at once in the picker
for name, data in uploaded.items():
with open(name, 'wb') as f:
f.write(data)
print(f'{name}: {len(data)/1e6:.1f} MB saved')
Am trying to run this but failed..any corrections 😭
What do you want to do exactly? Like readon, editing, writting excel files in python?
Читать полностью…
I m not a programmer but wanna learn to python in excel
Читать полностью…
yaa i like to chat and discusss about python and programming in general i am also learning things alone, so frieds are very welcome and appriciated, i also wish others to message me for talking like this things
Читать полностью…
you pasted the code from the sqlmodel docs ?
here the session is a context manager, as the sqlmodel session, but as later i will use the di-flask library as says in upper message in reality but here session i shows as the docs say to use.
@app.post("/heroes/", response_model=HeroPublic)
def create_hero(hero: HeroCreate):
with Session(engine) as session:
db_hero = Hero.model_validate(hero)
session.add(db_hero)
session.commit()
session.refresh(db_hero)
return db_hero
db_hero, which is a Hero model instance. However, because response_model=HeroPublic is specified in the FastAPI decorator, FastAPI automatically validates/converts the returned object according to the HeroPublic response model.response_model that I can specify in a Flask route decorator, so that my function can simply return a Hero object and Flask automatically serializes/validates it according to a HeroPublic schema?return HeroPublic.model_validate(hero_obj)