python | Unsorted

Telegram-канал python - Python

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

Subscribe to a channel

Python

Thank you sweetie 😊

Читать полностью…

Python

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!

Читать полностью…

Python

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 😭

Читать полностью…

Python

🚫 ‎MRXSIM | Unit 7X2 [8444063387] is already banned.

Читать полностью…

Python

What do you want to do exactly? Like readon, editing, writting excel files in python?

Читать полностью…

Python

I m not a programmer but wanna learn to python in excel

Читать полностью…

Python

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

Читать полностью…

Python

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.

Читать полностью…

Python

@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

i was reading sqlmodel docs, i am using Flask+Sqlmodel

As I understand it, the function actually returns 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.

My question is: how can I achieve the same thing in Flask? 🤔

For example, is there an equivalent of FastAPI's 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?
Or, in Flask, is the recommended approach to explicitly convert the object before returning it, something like:
return HeroPublic.model_validate(hero_obj)

Or is there a better/standard approach for production ready code or how you guys real developers tackle this ???

Читать полностью…

Python

I was trying to use SqlModel , Pydantic in a flask web app, the problem i am finding, like my confusion is i found some code examples like they are using flask.g, actually i am confused should i will use this in my real code to generate session for the sqlmodel, as in flask there is not any Depends like fastapi has one,

i am confused how i should start using the session when i will follow the sqlmodel functions for login, register or some others things,
my main problem is shoudl i start using this, i dont know will this ok in real production,

def get_db_session() -> Session:
if "db_session" not in g:
g.db_session = Session(engine)
return g.db_session

Читать полностью…

Python

Read it
pererikbergman/repository-design-pattern-e28c0f3e4a30" rel="nofollow">https://medium.com/@pererikbergman/repository-design-pattern-e28c0f3e4a30

Apply to your project

Does not matter if its Django, Flask, or whatever else you may choose

Design patterns are language (and framework) agnostic

Читать полностью…

Python

hello everyone
who can help me with repository pattern in django ?

Читать полностью…

Python

That's really for off-topic.

Читать полностью…

Python

So putting AI when it's not needed at all

Читать полностью…

Python

https://pybegin.pages.dev/

Читать полностью…

Python

I need to extract python code from .exe and its on 3.11 I am unable to do it any leads

Читать полностью…

Python

i think most popular one is flask marshmallow

Читать полностью…

Python

Hali Shon, please verify you are human by clicking the button below. You have 90 seconds.

Читать полностью…

Python

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.

Читать полностью…

Python

Can anyone guide me pls

Читать полностью…

Python

Can you help me to learn on topic - python in excel

Читать полностью…

Python

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.

Читать полностью…

Python

Any one having strategy for funded account?

Читать полностью…

Python

I have made FastAPI style DI for flask if you want to use it: https://github.com/razorblade23/di-flask

Otherwise, you can use g to keep the session "opened" but i would advise against that as session should be closed on every transaction.

Its better to open session on each transaction and close it afterwards, prefferebly using with Session(engine) as session: context manager

Читать полностью…

Python

Also me and other people, but this is the wrong group to talk about that

Читать полностью…

Python

who has any documentations to learn fast ?

Читать полностью…

Python

A different group where you can talk about what you do and ask about how other people feel without being told that your contributions aren't suited for the group.

Читать полностью…

Python

that was contextual spam

Читать полностью…

Python

Create a telegram bot that answers with a beginner project everytime someone asks for beginner projects

Читать полностью…

Python

any beginner projects to start with?

Читать полностью…
Subscribe to a channel