Flask-based via telegram bot
I have built a secure and scalable Flask-based platform that integrates with a Telegram bot to streamline photo uploads into an online album.
Users can seamlessly create categories and assign photos directly through the bot interface.
All interactions are safeguarded with a robust authentication flow, requiring username, password, and TOTP (Time-based One-Time Password) verification to ensure high-level security and user integrity.
Any more features or ideas you can suggest for me?
/r/flask
https://redd.it/1k88wu1
I have built a secure and scalable Flask-based platform that integrates with a Telegram bot to streamline photo uploads into an online album.
Users can seamlessly create categories and assign photos directly through the bot interface.
All interactions are safeguarded with a robust authentication flow, requiring username, password, and TOTP (Time-based One-Time Password) verification to ensure high-level security and user integrity.
Any more features or ideas you can suggest for me?
/r/flask
https://redd.it/1k88wu1
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
D IJCAI 2025 Paper Result & Discussion
This is the discussion for accepted/rejected papers in IJCAI 2025. Results are supposed to be released within the next 24 hours.
/r/MachineLearning
https://redd.it/1k9twhg
This is the discussion for accepted/rejected papers in IJCAI 2025. Results are supposed to be released within the next 24 hours.
/r/MachineLearning
https://redd.it/1k9twhg
Reddit
From the MachineLearning community on Reddit
Explore this post and more from the MachineLearning community
Tuesday Daily Thread: Advanced questions
# Weekly Wednesday Thread: Advanced Questions 🐍
Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.
## How it Works:
1. **Ask Away**: Post your advanced Python questions here.
2. **Expert Insights**: Get answers from experienced developers.
3. **Resource Pool**: Share or discover tutorials, articles, and tips.
## Guidelines:
* This thread is for **advanced questions only**. Beginner questions are welcome in our [Daily Beginner Thread](#daily-beginner-thread-link) every Thursday.
* Questions that are not advanced may be removed and redirected to the appropriate thread.
## Recommended Resources:
* If you don't receive a response, consider exploring r/LearnPython or join the [Python Discord Server](https://discord.gg/python) for quicker assistance.
## Example Questions:
1. **How can you implement a custom memory allocator in Python?**
2. **What are the best practices for optimizing Cython code for heavy numerical computations?**
3. **How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?**
4. **Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?**
5. **How would you go about implementing a distributed task queue using Celery and RabbitMQ?**
6. **What are some advanced use-cases for Python's decorators?**
7. **How can you achieve real-time data streaming in Python with WebSockets?**
8. **What are the
/r/Python
https://redd.it/1kaagpl
# Weekly Wednesday Thread: Advanced Questions 🐍
Dive deep into Python with our Advanced Questions thread! This space is reserved for questions about more advanced Python topics, frameworks, and best practices.
## How it Works:
1. **Ask Away**: Post your advanced Python questions here.
2. **Expert Insights**: Get answers from experienced developers.
3. **Resource Pool**: Share or discover tutorials, articles, and tips.
## Guidelines:
* This thread is for **advanced questions only**. Beginner questions are welcome in our [Daily Beginner Thread](#daily-beginner-thread-link) every Thursday.
* Questions that are not advanced may be removed and redirected to the appropriate thread.
## Recommended Resources:
* If you don't receive a response, consider exploring r/LearnPython or join the [Python Discord Server](https://discord.gg/python) for quicker assistance.
## Example Questions:
1. **How can you implement a custom memory allocator in Python?**
2. **What are the best practices for optimizing Cython code for heavy numerical computations?**
3. **How do you set up a multi-threaded architecture using Python's Global Interpreter Lock (GIL)?**
4. **Can you explain the intricacies of metaclasses and how they influence object-oriented design in Python?**
5. **How would you go about implementing a distributed task queue using Celery and RabbitMQ?**
6. **What are some advanced use-cases for Python's decorators?**
7. **How can you achieve real-time data streaming in Python with WebSockets?**
8. **What are the
/r/Python
https://redd.it/1kaagpl
Discord
Join the Python Discord Server!
We're a large community focused around the Python programming language. We believe that anyone can learn to code. | 412982 members
Clean method for ORM
Hello People,
I just picked up a ticket in which there appears to be DB savings in the clean() method of a model. I’ve never seen this before and I think it’s probably not good practice as clean() should be validating data only and not actually saving anything to the DB.
My question, how do you go about updating an attribute from another model?
Such as ModelA gets updated. So we have to update ModelB timestamp.
I was thinking of using a postsave() but unsure.
Context:
Model1:
Cost Model
def clean():
cost.account.timestamp = timezone.now()
cost.account.validatedsave()
Model2:
Account Model
/r/django
https://redd.it/1ka6ht5
Hello People,
I just picked up a ticket in which there appears to be DB savings in the clean() method of a model. I’ve never seen this before and I think it’s probably not good practice as clean() should be validating data only and not actually saving anything to the DB.
My question, how do you go about updating an attribute from another model?
Such as ModelA gets updated. So we have to update ModelB timestamp.
I was thinking of using a postsave() but unsure.
Context:
Model1:
Cost Model
def clean():
cost.account.timestamp = timezone.now()
cost.account.validatedsave()
Model2:
Account Model
/r/django
https://redd.it/1ka6ht5
Reddit
From the django community on Reddit
Explore this post and more from the django community
Looking for Django project
Hey everyone!
I'm planning to start a Django project and I'm looking for some cool and interesting project title ideas. It can be anything—web apps, automation tools, dashboards, or something creative! If you have any suggestions or ideas, please drop them here.
Would love to hear your thoughts!
/r/djangolearning
https://redd.it/1k6bu2v
Hey everyone!
I'm planning to start a Django project and I'm looking for some cool and interesting project title ideas. It can be anything—web apps, automation tools, dashboards, or something creative! If you have any suggestions or ideas, please drop them here.
Would love to hear your thoughts!
/r/djangolearning
https://redd.it/1k6bu2v
Reddit
From the djangolearning community on Reddit
Explore this post and more from the djangolearning community
lblprof: Easily see your python code’s performance, Line by Line
Hello [r/Python](https://www.reddit.com/r/Python/),
I built this small python package ([lblprof](https://github.com/le-codeur-rapide/lblprof)) because I needed it for other projects optimization (also just for fun haha) and **I would love to have some feedback on it.**
# What my project Does ?
The goal is to be able to know very quickly how much time was spent on each line during my code execution.
I don't aim to be precise at the nano second like other lower level profiling tool, but I really care at seeing **easily** where my 100s of milliseconds are spent. I built this project to replace the old good `print(start - time.time())` that I was abusing.
This package profile your code and display a tree in the terminal showing the duration of each line (you can expand each call to display the duration of each line in this frame)
Example of the terminal UI: [terminalui\_showcase.png (1210×523)](https://raw.githubusercontent.com/le-codeur-rapide/lblprof/refs/heads/main/docs/terminalui_showcase.png)
# Target Audience
Devs who want a quick insight into how their code’s execution time is distributed. (what are the longest lines ? Does the concurrence work ? Which of these imports is taking so much time ? ...)
# Installation
pip install lblprof
The only dependency of this package is pydantic, the rest is standard library.
# Usage
This package contains **4 main functions**:
* `start_tracing()`: Start the tracing of
/r/Python
https://redd.it/1ka71qs
Hello [r/Python](https://www.reddit.com/r/Python/),
I built this small python package ([lblprof](https://github.com/le-codeur-rapide/lblprof)) because I needed it for other projects optimization (also just for fun haha) and **I would love to have some feedback on it.**
# What my project Does ?
The goal is to be able to know very quickly how much time was spent on each line during my code execution.
I don't aim to be precise at the nano second like other lower level profiling tool, but I really care at seeing **easily** where my 100s of milliseconds are spent. I built this project to replace the old good `print(start - time.time())` that I was abusing.
This package profile your code and display a tree in the terminal showing the duration of each line (you can expand each call to display the duration of each line in this frame)
Example of the terminal UI: [terminalui\_showcase.png (1210×523)](https://raw.githubusercontent.com/le-codeur-rapide/lblprof/refs/heads/main/docs/terminalui_showcase.png)
# Target Audience
Devs who want a quick insight into how their code’s execution time is distributed. (what are the longest lines ? Does the concurrence work ? Which of these imports is taking so much time ? ...)
# Installation
pip install lblprof
The only dependency of this package is pydantic, the rest is standard library.
# Usage
This package contains **4 main functions**:
* `start_tracing()`: Start the tracing of
/r/Python
https://redd.it/1ka71qs
Reddit
Python
The official Python community for Reddit! Stay up to date with the latest news, packages, and meta information relating to the Python programming language.
---
If you have questions or are new to Python use r/LearnPython
---
If you have questions or are new to Python use r/LearnPython
Django Alerts with Google Chat
https://medium.com/me/stats/post/c9e8a033a229
/r/django
https://redd.it/1kaj7gi
https://medium.com/me/stats/post/c9e8a033a229
/r/django
https://redd.it/1kaj7gi
Some security in LLM based apps
Hi everyone!
I'm excited to share a project I've been working on: Resk-LLM, a Python library designed to enhance the security of applications based on Large Language Models (LLMs) like OpenAI, Anthropic, Cohere, and others.
## What My Project Does
Resk-LLM focuses on adding a protective layer to LLM interactions, helping developers experiment with strategies to mitigate risks like prompt injection, data leaks, and content moderation challenges.
🔗 GitHub Repository: https://github.com/Resk-Security/Resk-LLM
## Motivation
As LLMs become more integrated into apps, security challenges like prompt injection, data leakage, and manipulation attacks have become serious concerns.
However, many developers lack accessible tools to experiment with LLM security mechanisms easily.
While some solutions exist, they are often closed-source, narrowly scoped, or too tied to a single provider.
I built Resk-LLM to make it easier for developers to prototype, test, and understand LLM vulnerabilities and defenses — with a focus on transparency, flexibility, and multi-provider support.
The project is still experimental and intended for learning and prototyping, not production-grade security yet — but I'm excited to open it up for feedback and contributions.
## Target Audience
Resk-LLM is aimed at:
Developers building LLM-based applications who want to explore basic security protections.
Security researchers interested in LLM attack surface exploration.
Hobbyists or students learning about the security challenges of generative
/r/Python
https://redd.it/1kahx5r
Hi everyone!
I'm excited to share a project I've been working on: Resk-LLM, a Python library designed to enhance the security of applications based on Large Language Models (LLMs) like OpenAI, Anthropic, Cohere, and others.
## What My Project Does
Resk-LLM focuses on adding a protective layer to LLM interactions, helping developers experiment with strategies to mitigate risks like prompt injection, data leaks, and content moderation challenges.
🔗 GitHub Repository: https://github.com/Resk-Security/Resk-LLM
## Motivation
As LLMs become more integrated into apps, security challenges like prompt injection, data leakage, and manipulation attacks have become serious concerns.
However, many developers lack accessible tools to experiment with LLM security mechanisms easily.
While some solutions exist, they are often closed-source, narrowly scoped, or too tied to a single provider.
I built Resk-LLM to make it easier for developers to prototype, test, and understand LLM vulnerabilities and defenses — with a focus on transparency, flexibility, and multi-provider support.
The project is still experimental and intended for learning and prototyping, not production-grade security yet — but I'm excited to open it up for feedback and contributions.
## Target Audience
Resk-LLM is aimed at:
Developers building LLM-based applications who want to explore basic security protections.
Security researchers interested in LLM attack surface exploration.
Hobbyists or students learning about the security challenges of generative
/r/Python
https://redd.it/1kahx5r
GitHub
GitHub - Resk-Security/Resk-LLM: Resk is a robust Python library designed to enhance security and manage context when interacting…
Resk is a robust Python library designed to enhance security and manage context when interacting with LLMs. It provides a protective layer for API calls, safeguarding against common vulnerabili...
Implementing a confirmation view after a form submission
Hi everyone,
I'm very new to Django and web development. I have a simple form where a user can enter a list of data, say names. Since the user isn't savvy with SQL, I want the app to basically update some rows in our database based on the list. But before the changes are written to the database, I want there to be a view which basically shows what the user entered into the form. So here's the interface/sequence I'm trying to implement:
1. User is presented with a textbox which allows them to submit a list, eg "Bob, John"
2. Django app presents the user with a summary of the input and asks them to confirm, eg "you have entered 2 names, double check that this is correct". If the database doesn't know about Bob or John, then this is when it would notify the user.
3. The Django app performs the relevant update
I've been researching this online and I'm seeing different recommendations. The simplest solution seems to be to have a confirmation view which has a hidden input with the same data as the original form? But then wouldn't the app be processing the input data twice? Do you guys have
/r/django
https://redd.it/1kanhms
Hi everyone,
I'm very new to Django and web development. I have a simple form where a user can enter a list of data, say names. Since the user isn't savvy with SQL, I want the app to basically update some rows in our database based on the list. But before the changes are written to the database, I want there to be a view which basically shows what the user entered into the form. So here's the interface/sequence I'm trying to implement:
1. User is presented with a textbox which allows them to submit a list, eg "Bob, John"
2. Django app presents the user with a summary of the input and asks them to confirm, eg "you have entered 2 names, double check that this is correct". If the database doesn't know about Bob or John, then this is when it would notify the user.
3. The Django app performs the relevant update
I've been researching this online and I'm seeing different recommendations. The simplest solution seems to be to have a confirmation view which has a hidden input with the same data as the original form? But then wouldn't the app be processing the input data twice? Do you guys have
/r/django
https://redd.it/1kanhms
Reddit
From the django community on Reddit
Explore this post and more from the django community
RYLR: Python Library for Lora uart modules
Hi, RYLR is a simple python library to work with the RYLR896/406 modules. It can be use for configuration of the modules, send message and receive messages from the module.
What does it do:
Configuration modules
Get Configuration data from modules
Send message
Receive messages from module
Target Audience?
Developers working with rylr897/406 modules
Comparison?
Currently there isn't a library for this task
/r/Python
https://redd.it/1kak4r7
Hi, RYLR is a simple python library to work with the RYLR896/406 modules. It can be use for configuration of the modules, send message and receive messages from the module.
What does it do:
Configuration modules
Get Configuration data from modules
Send message
Receive messages from module
Target Audience?
Developers working with rylr897/406 modules
Comparison?
Currently there isn't a library for this task
/r/Python
https://redd.it/1kak4r7
GitHub
GitHub - Michael-Jalloh/RYLR: Python library for RYLR LoRa transceivers to simplifies communication with RYLR modules using Python
Python library for RYLR LoRa transceivers to simplifies communication with RYLR modules using Python - Michael-Jalloh/RYLR
[P] hacking on graph-grounded retrieval for SEC filings + an AI “legal pen-tester”—looking for feedback & maybe collaborators
Hey ML friends,
Quick intro: I’m an ex-BigLaw attorney turned founder. For the past few months I’ve been teaching myself anything AI/ML, and prototyping two related ideas and would love your thoughts (or a sanity check):
1. **Graph-first ingestion & retrieval**
* Take 300-page SEC filings → normalise tables, footnotes, exhibits → emit embedding JSON-L/markdown representations .
* Goal: 50 ms query latency over the whole doc with traceable citations.
* Current status: building a patent-pending pipeline
2. **Legal pen-testing RAG loop**
* Corpus: 40 yrs of SEC enforcement actions + 400 class-action complaints.
* Potential work thrusts: For any draft disclosure, rank sentences by estimated Rule 10b-5 litigation lift and suggest rewrites with supporting precedent.
All in all, we are playing with long-context retrieval. Need to push a retrieval encoder beyond today's oken window so an entire listing document fits in a single pass. This might include extending the LoCo/M2-BERT playbook potentially to pull the right spans from full-length filings (tens-of-thousands of tokens) without brittle chunking. We are also experimenting with some scaffolding techniques to approximate infinite context window. Not an expert in this so would love to hear your thoughts on best
/r/MachineLearning
https://redd.it/1kag8w2
Hey ML friends,
Quick intro: I’m an ex-BigLaw attorney turned founder. For the past few months I’ve been teaching myself anything AI/ML, and prototyping two related ideas and would love your thoughts (or a sanity check):
1. **Graph-first ingestion & retrieval**
* Take 300-page SEC filings → normalise tables, footnotes, exhibits → emit embedding JSON-L/markdown representations .
* Goal: 50 ms query latency over the whole doc with traceable citations.
* Current status: building a patent-pending pipeline
2. **Legal pen-testing RAG loop**
* Corpus: 40 yrs of SEC enforcement actions + 400 class-action complaints.
* Potential work thrusts: For any draft disclosure, rank sentences by estimated Rule 10b-5 litigation lift and suggest rewrites with supporting precedent.
All in all, we are playing with long-context retrieval. Need to push a retrieval encoder beyond today's oken window so an entire listing document fits in a single pass. This might include extending the LoCo/M2-BERT playbook potentially to pull the right spans from full-length filings (tens-of-thousands of tokens) without brittle chunking. We are also experimenting with some scaffolding techniques to approximate infinite context window. Not an expert in this so would love to hear your thoughts on best
/r/MachineLearning
https://redd.it/1kag8w2
Reddit
From the MachineLearning community on Reddit
Explore this post and more from the MachineLearning community
Descriptive statistics in Python
This tutorial explains about measures of shape and association in descriptive statistics with python
https://youtu.be/iBUbDU8iGro?si=Cyhmr0Gy3J68rMOr
/r/Python
https://redd.it/1kao9lg
This tutorial explains about measures of shape and association in descriptive statistics with python
https://youtu.be/iBUbDU8iGro?si=Cyhmr0Gy3J68rMOr
/r/Python
https://redd.it/1kao9lg
YouTube
Descriptive Statistics in Python - Part 2
This video is part 2 tutorial of Descriptive Statistics in Python. This tutorial explains measures of shape(skewness, kurtosis) and measures of association(covariance, correlation) of descriptive statistics.
Other interesting videos:
Link for Statistics…
Other interesting videos:
Link for Statistics…
Bring Python 3.10’s match/case to 3.7+ with patterna
# Python Structural Pattern Matching for 3.7+
Patterna is a pure Python library that backports the structural pattern matching functionality (match/case statements) introduced in Python 3.10 to earlier Python versions (3.7 and above). It provides a decorator-based approach to enable pattern matching in your code without requiring Python 3.10.
# Installation
pip3 install patterna
# GitHub, PyPI, Docs
GitHub: saadman/patterna
PyPI: patterna/0.1.0.dev1/
(Post edited for those who wants more context into the inner workings)
Wiki For those Further interested in the inner workings: https://deepwiki.com/saadmanrafat/patterna
# Usage
from patterna import match
class Point:
matchargs = ("x", "y")
def init(self, x, y):
self.x = x
self.y = y
u/match
def describepoint(point):
match point:
case Point(0, 0):
/r/Python
https://redd.it/1kardx9
# Python Structural Pattern Matching for 3.7+
Patterna is a pure Python library that backports the structural pattern matching functionality (match/case statements) introduced in Python 3.10 to earlier Python versions (3.7 and above). It provides a decorator-based approach to enable pattern matching in your code without requiring Python 3.10.
# Installation
pip3 install patterna
# GitHub, PyPI, Docs
GitHub: saadman/patterna
PyPI: patterna/0.1.0.dev1/
(Post edited for those who wants more context into the inner workings)
Wiki For those Further interested in the inner workings: https://deepwiki.com/saadmanrafat/patterna
# Usage
from patterna import match
class Point:
matchargs = ("x", "y")
def init(self, x, y):
self.x = x
self.y = y
u/match
def describepoint(point):
match point:
case Point(0, 0):
/r/Python
https://redd.it/1kardx9
GitHub
GitHub - saadmanrafat/patterna: Simple, flexible pattern matching for Python 3.7+, inspired by match/case.
Simple, flexible pattern matching for Python 3.7+, inspired by match/case. - saadmanrafat/patterna
Python projects for beginners
Hello,
I'm very new to Python and looking beginner friendly tasks for practice.
I don't have any idea what I could prgramm.
I know you can use Python for practically everything.
My interest is programming a calculator or a game.
I've already asked chat gpt for ideas but it gives you the codes to cooy but that's no very helpful.
Do you have any ideas which codes helped you?
Are there good sites you could recomment?
Thanks
/r/Python
https://redd.it/1kat5bh
Hello,
I'm very new to Python and looking beginner friendly tasks for practice.
I don't have any idea what I could prgramm.
I know you can use Python for practically everything.
My interest is programming a calculator or a game.
I've already asked chat gpt for ideas but it gives you the codes to cooy but that's no very helpful.
Do you have any ideas which codes helped you?
Are there good sites you could recomment?
Thanks
/r/Python
https://redd.it/1kat5bh
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
What is lightweight framework means in context of flask
What exactly lightweight framework means always heard that throughout various yt videos and documentation about flask that flask is a lightweight framework.
My question is flasks can't create big websites or web application as compared to django or nodejs ..
/r/flask
https://redd.it/1kat0pw
What exactly lightweight framework means always heard that throughout various yt videos and documentation about flask that flask is a lightweight framework.
My question is flasks can't create big websites or web application as compared to django or nodejs ..
/r/flask
https://redd.it/1kat0pw
Reddit
From the flask community on Reddit
Explore this post and more from the flask community