I need some help with an issue regarding enumerations in Flask.
I need some help with an issue regarding enumerations in Flask.
My model is as follows:
```python
class ApprovalStatus(PyEnum):
PENDING = 'pending'
APPROVED = 'approved'
REJECTED = 'rejected'
class Approval(db.Model):
id = db.Column(db.Integer, primary_key=True)
content_type = db.Column(db.String(50), nullable=False)
content_id = db.Column(db.Integer, nullable=False)
field_name = db.Column(db.String(50), nullable=False)
new_value = db.Column(db.Text, nullable=False)
status = db.Column(SQLAlchemyEnum(ApprovalStatus), default=ApprovalStatus.PENDING)
submitter_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
submit_time = db.Column(db.DateTime, default=current_time)
reviewer_id = db.Column(db.Integer, db.ForeignKey('user.id'))
review_time = db.Column(db.DateTime, default=current_time)
review_comment = db.Column(db.Text)
submitter = db.relationship('User', foreign_keys=[submitter_id\])
reviewer = db.relationship('User', foreign_keys=[reviewer_id\])
__table_args__ = (UniqueConstraint('content_type', 'content_id'),)
u/property
def content(self):
model = getattr(models, self.content_type)
return model.query.get(self.content_id)
```
However, I keep encountering the following error:
```
LookupError: 'pending' is not among the defined enum values. Enum name: approvalstatus. Possible values: PENDING, APPROVED, REJECTED
```
/r/flask
https://redd.it/1fc2ltr
I need some help with an issue regarding enumerations in Flask.
My model is as follows:
```python
class ApprovalStatus(PyEnum):
PENDING = 'pending'
APPROVED = 'approved'
REJECTED = 'rejected'
class Approval(db.Model):
id = db.Column(db.Integer, primary_key=True)
content_type = db.Column(db.String(50), nullable=False)
content_id = db.Column(db.Integer, nullable=False)
field_name = db.Column(db.String(50), nullable=False)
new_value = db.Column(db.Text, nullable=False)
status = db.Column(SQLAlchemyEnum(ApprovalStatus), default=ApprovalStatus.PENDING)
submitter_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False)
submit_time = db.Column(db.DateTime, default=current_time)
reviewer_id = db.Column(db.Integer, db.ForeignKey('user.id'))
review_time = db.Column(db.DateTime, default=current_time)
review_comment = db.Column(db.Text)
submitter = db.relationship('User', foreign_keys=[submitter_id\])
reviewer = db.relationship('User', foreign_keys=[reviewer_id\])
__table_args__ = (UniqueConstraint('content_type', 'content_id'),)
u/property
def content(self):
model = getattr(models, self.content_type)
return model.query.get(self.content_id)
```
However, I keep encountering the following error:
```
LookupError: 'pending' is not among the defined enum values. Enum name: approvalstatus. Possible values: PENDING, APPROVED, REJECTED
```
/r/flask
https://redd.it/1fc2ltr
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
Just Released Version 0.4.0 of Django Action Triggers!
First off, a huge thank you to everyone who provided feedback after the release of version 0.1.0! I've taken your input to heart and have been hard at work iterating. I’m excited to announce the release of **version 0.4.0** of **django-action-triggers**.
There’s still more to come in terms of features and addressing suggestions, but here’s an overview of the current progress.
# What is Django Action Triggers
[Django Action Triggers](https://github.com/Salaah01/django-action-triggers) is a Django library that lets you trigger specific actions based on database events, detected via Django Signals. With this library, you can configure **actions** that run asynchronously when certain triggers (e.g., a model save) are detected.
For example, you could set up a trigger that hits a webhook and sends a message to AWS SQS whenever a new sale record is saved.
# What's New in Version 0.4.0?
Here’s a quick comparison of **version 0.1.0** vs. **version 0.4.0**:
**Version 0.1.0** features:
* Webhook integration
* RabbitMQ integration
* Kafka integration
**Version 0.4.0** features:
* Webhook integration
* RabbitMQ integration
* Kafka integration
* Redis integration
* AWS SQS (Simple Queue Service) integration
* AWS SNS (Simple Notification Service) integration
* Actions all run asynchronously
* Actions can have a timeout
# Looking Forward
As always, I’d love to hear your feedback. This project started as a passion project but has
/r/Python
https://redd.it/1fc2t9a
First off, a huge thank you to everyone who provided feedback after the release of version 0.1.0! I've taken your input to heart and have been hard at work iterating. I’m excited to announce the release of **version 0.4.0** of **django-action-triggers**.
There’s still more to come in terms of features and addressing suggestions, but here’s an overview of the current progress.
# What is Django Action Triggers
[Django Action Triggers](https://github.com/Salaah01/django-action-triggers) is a Django library that lets you trigger specific actions based on database events, detected via Django Signals. With this library, you can configure **actions** that run asynchronously when certain triggers (e.g., a model save) are detected.
For example, you could set up a trigger that hits a webhook and sends a message to AWS SQS whenever a new sale record is saved.
# What's New in Version 0.4.0?
Here’s a quick comparison of **version 0.1.0** vs. **version 0.4.0**:
**Version 0.1.0** features:
* Webhook integration
* RabbitMQ integration
* Kafka integration
**Version 0.4.0** features:
* Webhook integration
* RabbitMQ integration
* Kafka integration
* Redis integration
* AWS SQS (Simple Queue Service) integration
* AWS SNS (Simple Notification Service) integration
* Actions all run asynchronously
* Actions can have a timeout
# Looking Forward
As always, I’d love to hear your feedback. This project started as a passion project but has
/r/Python
https://redd.it/1fc2t9a
GitHub
GitHub - Salaah01/django-action-triggers: A Django library for asynchronously triggering actions in response to database changes.…
A Django library for asynchronously triggering actions in response to database changes. It supports integration with webhooks, message brokers (e.g., Kafka, RabbitMQ), and can trigger other process...
Audio Book Reader: Read .epub, .rtf, and .txt as audio books!
https://github.com/RNRetailer/audio-book-reader
What My Project Does
This program is for the Linux terminal.
It breaks text files into lines and reads them out loud one line at a time.
Your progress for each file is stored in a .json file.
You can choose to skip to a certain line by passing it as a parameter when running the script.
Please make an issue or a pull request if you think any changes are needed.
Thanks!
Target Audience (e.g., Is it meant for production, just a toy project, etc.)
Anyone who uses Linux and wants to have a text file read out loud to them.
Comparison (A brief comparison explaining how it differs from existing alternatives.)
I haven't looked into alternatives in this space, I just made it on a whim.
/r/Python
https://redd.it/1fb3f8p
https://github.com/RNRetailer/audio-book-reader
What My Project Does
This program is for the Linux terminal.
It breaks text files into lines and reads them out loud one line at a time.
Your progress for each file is stored in a .json file.
You can choose to skip to a certain line by passing it as a parameter when running the script.
Please make an issue or a pull request if you think any changes are needed.
Thanks!
Target Audience (e.g., Is it meant for production, just a toy project, etc.)
Anyone who uses Linux and wants to have a text file read out loud to them.
Comparison (A brief comparison explaining how it differs from existing alternatives.)
I haven't looked into alternatives in this space, I just made it on a whim.
/r/Python
https://redd.it/1fb3f8p
GitHub
GitHub - RNRetailer/audio-book-reader: Reads text files and outputs audio one sentence at a time. Saves progress. Runs in Linux…
Reads text files and outputs audio one sentence at a time. Saves progress. Runs in Linux terminal. - RNRetailer/audio-book-reader
How do I stop my Socket IO chat room from disconnecting users 30 seconds after joining the room? I'm hosting using Adaptable's free plan.
I've been working on a chat room application using Flask and JS where you can join a room and message people and it works fine on my local server but when I access the site from Adaptable, 30 seconds into joining a room, it boots the user out, so I was wondering if anyone knows why this is happening. I've tried a couple solutions already including implementing a heartbeat. Any help would be great, I'm just trying to diagnose the issue. Thanks!
/r/flask
https://redd.it/1fcag2y
I've been working on a chat room application using Flask and JS where you can join a room and message people and it works fine on my local server but when I access the site from Adaptable, 30 seconds into joining a room, it boots the user out, so I was wondering if anyone knows why this is happening. I've tried a couple solutions already including implementing a heartbeat. Any help would be great, I'm just trying to diagnose the issue. Thanks!
/r/flask
https://redd.it/1fcag2y
Reddit
From the flask community on Reddit
Explore this post and more from the flask community
My first flask app
As an avid sports lover, I've often faced the challenge of finding training partners, especially after relocating to a new city. This inspired me to create Sport CoTrain, a platform where fellow sports lovers can connect, post their activities, and find co-trainers.
I've built this app using Flask and basic HTML, keeping it simple yet functional. While it's still in its early stages, I'm excited to share it with the community and would greatly appreciate your feedback.
Sport CoTrain aims to solve a common problem for active individuals, making it easier to maintain an engaging workout routine and meet like-minded people. I'm looking forward to hearing your thoughts and suggestions to improve the app.
Thank you all for your time and potential input!
Link to app: https://sportcotrain.com/
/r/flask
https://redd.it/1fccgt7
As an avid sports lover, I've often faced the challenge of finding training partners, especially after relocating to a new city. This inspired me to create Sport CoTrain, a platform where fellow sports lovers can connect, post their activities, and find co-trainers.
I've built this app using Flask and basic HTML, keeping it simple yet functional. While it's still in its early stages, I'm excited to share it with the community and would greatly appreciate your feedback.
Sport CoTrain aims to solve a common problem for active individuals, making it easier to maintain an engaging workout routine and meet like-minded people. I'm looking forward to hearing your thoughts and suggestions to improve the app.
Thank you all for your time and potential input!
Link to app: https://sportcotrain.com/
/r/flask
https://redd.it/1fccgt7
Monday Daily Thread: Project ideas!
# Weekly Thread: Project Ideas 💡
Welcome to our weekly Project Ideas thread! Whether you're a newbie looking for a first project or an expert seeking a new challenge, this is the place for you.
## How it Works:
1. **Suggest a Project**: Comment your project idea—be it beginner-friendly or advanced.
2. **Build & Share**: If you complete a project, reply to the original comment, share your experience, and attach your source code.
3. **Explore**: Looking for ideas? Check out Al Sweigart's ["The Big Book of Small Python Projects"](https://www.amazon.com/Big-Book-Small-Python-Programming/dp/1718501242) for inspiration.
## Guidelines:
* Clearly state the difficulty level.
* Provide a brief description and, if possible, outline the tech stack.
* Feel free to link to tutorials or resources that might help.
# Example Submissions:
## Project Idea: Chatbot
**Difficulty**: Intermediate
**Tech Stack**: Python, NLP, Flask/FastAPI/Litestar
**Description**: Create a chatbot that can answer FAQs for a website.
**Resources**: [Building a Chatbot with Python](https://www.youtube.com/watch?v=a37BL0stIuM)
# Project Idea: Weather Dashboard
**Difficulty**: Beginner
**Tech Stack**: HTML, CSS, JavaScript, API
**Description**: Build a dashboard that displays real-time weather information using a weather API.
**Resources**: [Weather API Tutorial](https://www.youtube.com/watch?v=9P5MY_2i7K8)
## Project Idea: File Organizer
**Difficulty**: Beginner
**Tech Stack**: Python, File I/O
**Description**: Create a script that organizes files in a directory into sub-folders based on file type.
**Resources**: [Automate the Boring Stuff: Organizing Files](https://automatetheboringstuff.com/2e/chapter9/)
Let's help each other grow. Happy
/r/Python
https://redd.it/1fcc2z6
# Weekly Thread: Project Ideas 💡
Welcome to our weekly Project Ideas thread! Whether you're a newbie looking for a first project or an expert seeking a new challenge, this is the place for you.
## How it Works:
1. **Suggest a Project**: Comment your project idea—be it beginner-friendly or advanced.
2. **Build & Share**: If you complete a project, reply to the original comment, share your experience, and attach your source code.
3. **Explore**: Looking for ideas? Check out Al Sweigart's ["The Big Book of Small Python Projects"](https://www.amazon.com/Big-Book-Small-Python-Programming/dp/1718501242) for inspiration.
## Guidelines:
* Clearly state the difficulty level.
* Provide a brief description and, if possible, outline the tech stack.
* Feel free to link to tutorials or resources that might help.
# Example Submissions:
## Project Idea: Chatbot
**Difficulty**: Intermediate
**Tech Stack**: Python, NLP, Flask/FastAPI/Litestar
**Description**: Create a chatbot that can answer FAQs for a website.
**Resources**: [Building a Chatbot with Python](https://www.youtube.com/watch?v=a37BL0stIuM)
# Project Idea: Weather Dashboard
**Difficulty**: Beginner
**Tech Stack**: HTML, CSS, JavaScript, API
**Description**: Build a dashboard that displays real-time weather information using a weather API.
**Resources**: [Weather API Tutorial](https://www.youtube.com/watch?v=9P5MY_2i7K8)
## Project Idea: File Organizer
**Difficulty**: Beginner
**Tech Stack**: Python, File I/O
**Description**: Create a script that organizes files in a directory into sub-folders based on file type.
**Resources**: [Automate the Boring Stuff: Organizing Files](https://automatetheboringstuff.com/2e/chapter9/)
Let's help each other grow. Happy
/r/Python
https://redd.it/1fcc2z6
YouTube
Build & Integrate your own custom chatbot to a website (Python & JavaScript)
In this fun project you learn how to build a custom chatbot in Python and then integrate this to a website using Flask and JavaScript.
Starter Files: https://github.com/patrickloeber/chatbot-deployment
Get my Free NumPy Handbook: https://www.python-engi…
Starter Files: https://github.com/patrickloeber/chatbot-deployment
Get my Free NumPy Handbook: https://www.python-engi…
Complete Serverless Django Deployment
Hi,
I am planning to deploy a django (DRF) project. After doing a bunch of research AWS Lambda was the cheapest option. Did a little more digging and found Cockroach DB, it offers integration with Django and also offers Serverless pricing model.
So I made a final decision of deploying the django (DRF) project to AWS Lambda and use Cockroach DB with serverless model for database.
Anybody faced any issues with running Django in AWS Lambda with Cockroack DB in production? What are the cons that I can expect with this deployment plan?
/r/django
https://redd.it/1fc8pxg
Hi,
I am planning to deploy a django (DRF) project. After doing a bunch of research AWS Lambda was the cheapest option. Did a little more digging and found Cockroach DB, it offers integration with Django and also offers Serverless pricing model.
So I made a final decision of deploying the django (DRF) project to AWS Lambda and use Cockroach DB with serverless model for database.
Anybody faced any issues with running Django in AWS Lambda with Cockroack DB in production? What are the cons that I can expect with this deployment plan?
/r/django
https://redd.it/1fc8pxg
Cockroachlabs
CockroachDB | Distributed SQL for always-on customer experiences
CockroachDB is a distributed database with standard SQL for cloud applications. CockroachDB powers companies like Comcast, Lush, and Bose.
Django admin to take header value from browser
Hi ,
My application is running on AWS lambda and now I have added cognito authorizer for security reason , but /admin is giving me unauthorised because it doesn't have the token , so Is there a way like before I hit /admin it takes a value from local storage if exist else hit my token url and pass this token in request headers.
any help around this will be appreciable
/r/django
https://redd.it/1fck8on
Hi ,
My application is running on AWS lambda and now I have added cognito authorizer for security reason , but /admin is giving me unauthorised because it doesn't have the token , so Is there a way like before I hit /admin it takes a value from local storage if exist else hit my token url and pass this token in request headers.
any help around this will be appreciable
/r/django
https://redd.it/1fck8on
Reddit
From the django community on Reddit
Explore this post and more from the django community
Snappea: A Simple Task Queue for Django
https://www.bugsink.com/blog/snappea-design/
/r/django
https://redd.it/1fcnqvt
https://www.bugsink.com/blog/snappea-design/
/r/django
https://redd.it/1fcnqvt
Bugsink
Snappea: A Simple Task Queue for Python
Snappea is a simple task queue that we built ourselves. It's a lightweight and easy-to-use solution that doesn't require any external dependencies.
Just Released Version 0.4.0 of Django Action Triggers!
First off, a huge thank you to everyone who provided feedback after the release of version 0.1.0! I've taken your input to heart and have been hard at work iterating. I’m excited to announce the release of **version 0.4.0** of **django-action-triggers**.
There’s still more to come in terms of features and addressing suggestions, but here’s an overview of the current progress.
# What is Django Action Triggers
[Django Action Triggers](https://github.com/Salaah01/django-action-triggers) is a Django library that lets you trigger specific actions based on database events, detected via Django Signals. With this library, you can configure **actions** that run asynchronously when certain triggers (e.g., a model save) are detected.
For example, you could set up a trigger that hits a webhook and sends a message to AWS SQS whenever a new sale record is saved.
# What's New in Version 0.4.0?
Here’s a quick comparison of **version 0.1.0** vs. **version 0.4.0**:
**Version 0.1.0** features:
* Webhook integration
* RabbitMQ integration
* Kafka integration
**Version 0.4.0** features:
* Webhook integration
* RabbitMQ integration
* Kafka integration
* Redis integration
* AWS SQS (Simple Queue Service) integration
* AWS SNS (Simple Notification Service) integration
* Actions all run asynchronously
* Actions can have a timeout
# Looking Forward
As always, I’d love to hear your feedback. This project started as a passion project but has
/r/djangolearning
https://redd.it/1fc2svw
First off, a huge thank you to everyone who provided feedback after the release of version 0.1.0! I've taken your input to heart and have been hard at work iterating. I’m excited to announce the release of **version 0.4.0** of **django-action-triggers**.
There’s still more to come in terms of features and addressing suggestions, but here’s an overview of the current progress.
# What is Django Action Triggers
[Django Action Triggers](https://github.com/Salaah01/django-action-triggers) is a Django library that lets you trigger specific actions based on database events, detected via Django Signals. With this library, you can configure **actions** that run asynchronously when certain triggers (e.g., a model save) are detected.
For example, you could set up a trigger that hits a webhook and sends a message to AWS SQS whenever a new sale record is saved.
# What's New in Version 0.4.0?
Here’s a quick comparison of **version 0.1.0** vs. **version 0.4.0**:
**Version 0.1.0** features:
* Webhook integration
* RabbitMQ integration
* Kafka integration
**Version 0.4.0** features:
* Webhook integration
* RabbitMQ integration
* Kafka integration
* Redis integration
* AWS SQS (Simple Queue Service) integration
* AWS SNS (Simple Notification Service) integration
* Actions all run asynchronously
* Actions can have a timeout
# Looking Forward
As always, I’d love to hear your feedback. This project started as a passion project but has
/r/djangolearning
https://redd.it/1fc2svw
GitHub
GitHub - Salaah01/django-action-triggers: A Django library for asynchronously triggering actions in response to database changes.…
A Django library for asynchronously triggering actions in response to database changes. It supports integration with webhooks, message brokers (e.g., Kafka, RabbitMQ), and can trigger other process...
PyWeek 38: A Python Game Jam
PyWeek is a twice-a-year game jam (that's been running for over 15 years) where you have a week to create a game in Python that fits the theme voted on by the community. You can enter by yourself or with a team of your choosing. The games are judged and voted on by the other PyWeek participants.
Once you've signed, you can immediately go vote on the different themes! Head over here to vote: [https://pyweek.org/p/42/](https://pyweek.org/p/42/)
**Important Dates**
* Theme is revealed and PyWeek starts: Sunday, September 15th, 2024 (midnight UTC)
* Challenge ends: Sunday, September 22nd (midnight UTC)
* Judging ends & winners announced: Sunday, October 6th (midnight UTC)
**Helpful Links & Other Info**
* Sign up on the PyWeek website: [https://pyweek.org/38/](https://pyweek.org/38/)
* PyWeek Rules: [https://pyweek.readthedocs.io/en/latest/rules.html](https://pyweek.readthedocs.io/en/latest/rules.html)
If you're interested in working with other folks or have more questions, there is a dedicated channel over on the Python Discord server for PyWeek. You're welcome to ping me directly there.
I'll also try to keep an eye on this thread if folks have questions\~
/r/Python
https://redd.it/1fccov9
PyWeek is a twice-a-year game jam (that's been running for over 15 years) where you have a week to create a game in Python that fits the theme voted on by the community. You can enter by yourself or with a team of your choosing. The games are judged and voted on by the other PyWeek participants.
Once you've signed, you can immediately go vote on the different themes! Head over here to vote: [https://pyweek.org/p/42/](https://pyweek.org/p/42/)
**Important Dates**
* Theme is revealed and PyWeek starts: Sunday, September 15th, 2024 (midnight UTC)
* Challenge ends: Sunday, September 22nd (midnight UTC)
* Judging ends & winners announced: Sunday, October 6th (midnight UTC)
**Helpful Links & Other Info**
* Sign up on the PyWeek website: [https://pyweek.org/38/](https://pyweek.org/38/)
* PyWeek Rules: [https://pyweek.readthedocs.io/en/latest/rules.html](https://pyweek.readthedocs.io/en/latest/rules.html)
If you're interested in working with other folks or have more questions, there is a dedicated channel over on the Python Discord server for PyWeek. You're welcome to ping me directly there.
I'll also try to keep an eye on this thread if folks have questions\~
/r/Python
https://redd.it/1fccov9
Build web applications with wwwpy: For backend developers looking to minimize frontend headaches
All while providing strong customization, extension, and scalability!
Hey guys, my name is Simon and this is my first post.
I'm here for two reasons. One, share some thoughts about libraries you may be familiar with, like: Streamlit, Gradio, Dash, Anvil, Panel, Reflex, Taipy, NiceGUI, Remo, Pyweb, PyJs, Flet, Mesop and Hyperdiv. Two, get to know what problems you are dealing with that pushed you to use one of the above.
Don't get me wrong, the libraries listed have amazing features but I'm purposely looking at the missing parts.
Here are some pain points I've identified:
Slow UI rendering with big datasets or multiple visualization
Difficult to scale programming model and UI interaction
Extending or building components is costly, difficult or involving long toolchains
Overly simplistic architectures for complex applications
Scalability challenges in transitioning from demos to fully-fledged applications
Python runs server-side, while browser capabilities remain distant and restricted by the framework's architecture. (markdown, server side api, pushing updates to the DOM)
The famous libraries mentioned are particularly close to my heart because it's the field where I invested the most time working on. I've been developing software as a consultant for nearly 35 years and in the last 15 I developed web applications and
/r/Python
https://redd.it/1fcwvuk
All while providing strong customization, extension, and scalability!
Hey guys, my name is Simon and this is my first post.
I'm here for two reasons. One, share some thoughts about libraries you may be familiar with, like: Streamlit, Gradio, Dash, Anvil, Panel, Reflex, Taipy, NiceGUI, Remo, Pyweb, PyJs, Flet, Mesop and Hyperdiv. Two, get to know what problems you are dealing with that pushed you to use one of the above.
Don't get me wrong, the libraries listed have amazing features but I'm purposely looking at the missing parts.
Here are some pain points I've identified:
Slow UI rendering with big datasets or multiple visualization
Difficult to scale programming model and UI interaction
Extending or building components is costly, difficult or involving long toolchains
Overly simplistic architectures for complex applications
Scalability challenges in transitioning from demos to fully-fledged applications
Python runs server-side, while browser capabilities remain distant and restricted by the framework's architecture. (markdown, server side api, pushing updates to the DOM)
The famous libraries mentioned are particularly close to my heart because it's the field where I invested the most time working on. I've been developing software as a consultant for nearly 35 years and in the last 15 I developed web applications and
/r/Python
https://redd.it/1fcwvuk
Reddit
From the Python community on Reddit
Explore this post and more from the Python community
Library for generating REST API clients using methods annotated with type hints
What My Project Does
Meatie is a Python metaprogramming library that eliminates the need for boilerplate code when integrating with REST APIs. The library generates code for calling a REST API based on method signatures annotated with type hints. Meatie abstracts away mechanics related to HTTP communication, such as building URLs, encoding query parameters, serializing and deserializing request and response body. With some modest additional configuration, generated methods provide rate limiting, retries, and caching. Meatie works with major HTTP client libraries (request, httpx, aiohttp). It offers integration with Pydantic V1 and V2. The minimum officially supported version is Python 3.9.
Code Example
from typing import Annotated
from aiohttp import ClientSession
from meatie import api_ref, endpoint
from meatie_aiohttp import Client
from meatie_example.store import Product, Basket, BasketQuote # Pydantic models
class OnlineStore(Client):
def init(self, session: ClientSession) -> None:
super().init(session)
@endpoint("/api/v1/products")
/r/Python
https://redd.it/1fcz4bd
What My Project Does
Meatie is a Python metaprogramming library that eliminates the need for boilerplate code when integrating with REST APIs. The library generates code for calling a REST API based on method signatures annotated with type hints. Meatie abstracts away mechanics related to HTTP communication, such as building URLs, encoding query parameters, serializing and deserializing request and response body. With some modest additional configuration, generated methods provide rate limiting, retries, and caching. Meatie works with major HTTP client libraries (request, httpx, aiohttp). It offers integration with Pydantic V1 and V2. The minimum officially supported version is Python 3.9.
Code Example
from typing import Annotated
from aiohttp import ClientSession
from meatie import api_ref, endpoint
from meatie_aiohttp import Client
from meatie_example.store import Product, Basket, BasketQuote # Pydantic models
class OnlineStore(Client):
def init(self, session: ClientSession) -> None:
super().init(session)
@endpoint("/api/v1/products")
/r/Python
https://redd.it/1fcz4bd
Reddit
From the Python community on Reddit: Library for generating REST API clients using methods annotated with type hints
Explore this post and more from the Python 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/1fd4fhr
# 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/1fd4fhr
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
Laravel raises a $57 million series A from Accel – what about Django?
https://laravel-news.com/laravel-raises-57-million-series-a
Laravel has pulled in $57M from Accel, and it’s got me wondering on why isn’t Django receiving similar financial recognition? What’s holding Django back, and how do we as a community make sure we stay competitive? Thoughts?
/r/django
https://redd.it/1fcsgjn
https://laravel-news.com/laravel-raises-57-million-series-a
Laravel has pulled in $57M from Accel, and it’s got me wondering on why isn’t Django receiving similar financial recognition? What’s holding Django back, and how do we as a community make sure we stay competitive? Thoughts?
/r/django
https://redd.it/1fcsgjn
Laravel News
Laravel raises a $57 million Series A from Accel - Laravel News
Laravel has raised a $57M Series A in partnership with Accel
What are some good open-source projects to contribute to?
I’m looking to get involved in open-source and would love your suggestions for projects related to Django that need contributors. Whether they’re beginner-friendly or more advanced, I’m open to any recommendations!
/r/django
https://redd.it/1fcudnc
I’m looking to get involved in open-source and would love your suggestions for projects related to Django that need contributors. Whether they’re beginner-friendly or more advanced, I’m open to any recommendations!
/r/django
https://redd.it/1fcudnc
Reddit
From the django community on Reddit
Explore this post and more from the django community
Computational Collision Physics
Hello, so I recently wrote a paper on my Python project based on collision physics. If possible, I would to love to hear anyone's honest feedback about it and possible areas of improvement. Additionally, could anyone suggest any other notable academic sites where I can publish my paper?
https://www.academia.edu/123663289/Computational\_Physics\_Collision\_Project
/r/Python
https://redd.it/1fd9k40
Hello, so I recently wrote a paper on my Python project based on collision physics. If possible, I would to love to hear anyone's honest feedback about it and possible areas of improvement. Additionally, could anyone suggest any other notable academic sites where I can publish my paper?
https://www.academia.edu/123663289/Computational\_Physics\_Collision\_Project
/r/Python
https://redd.it/1fd9k40
www.academia.edu
Computational Physics Collision Project
This project focuses on collision physics which is simulated through Python. Using both elastic and inelastic collisions, the simulation presents the dynamics of colliding entities in one and two dimensions, effectively demonstrating the principles
Help with CSS being overwritten by bootstrap
I am loading my base.css stylesheet after the bootstrap loader. Any clue why my css is being overwritten still? Do i need to redeclare the stylesheet in the extended template "orders.html"?
https://preview.redd.it/6b4ff00l9vnd1.png?width=1920&format=png&auto=webp&s=56017247893bfd6414876090db94d8828f046e43
https://preview.redd.it/w3dyfi0l9vnd1.png?width=1280&format=png&auto=webp&s=3742409f45606c57ec613bc895e48b43cd0c5324
https://preview.redd.it/9772c20l9vnd1.png?width=1920&format=png&auto=webp&s=a296e3f51b44e049d2ecb8f52253ab97dedaca5f
https://preview.redd.it/aizjc10l9vnd1.png?width=1920&format=png&auto=webp&s=f43987b6bca09d3beda79f73290a095f39ef5c81
/r/djangolearning
https://redd.it/1fd3iri
I am loading my base.css stylesheet after the bootstrap loader. Any clue why my css is being overwritten still? Do i need to redeclare the stylesheet in the extended template "orders.html"?
https://preview.redd.it/6b4ff00l9vnd1.png?width=1920&format=png&auto=webp&s=56017247893bfd6414876090db94d8828f046e43
https://preview.redd.it/w3dyfi0l9vnd1.png?width=1280&format=png&auto=webp&s=3742409f45606c57ec613bc895e48b43cd0c5324
https://preview.redd.it/9772c20l9vnd1.png?width=1920&format=png&auto=webp&s=a296e3f51b44e049d2ecb8f52253ab97dedaca5f
https://preview.redd.it/aizjc10l9vnd1.png?width=1920&format=png&auto=webp&s=f43987b6bca09d3beda79f73290a095f39ef5c81
/r/djangolearning
https://redd.it/1fd3iri
What job boards do you use?
I've been looking for a senior Django (also Flask or FastAPI) dev for a couple of months now and the quality of candidates I got was abysmal.
So I'm wondering if I'm using the wrong channel (Linkedin). Where do you guys typically look for jobs?
/r/django
https://redd.it/1fdd99j
I've been looking for a senior Django (also Flask or FastAPI) dev for a couple of months now and the quality of candidates I got was abysmal.
So I'm wondering if I'm using the wrong channel (Linkedin). Where do you guys typically look for jobs?
/r/django
https://redd.it/1fdd99j
Reddit
From the django community on Reddit
Explore this post and more from the django community
Issue: Microsoft SSO Integration State Mismatch (Django + Azure App Service)
I’m working on integrating Microsoft SSO into my Django app (hosted on Azure App Service). The SSO login flow seems to work up to the point where the callback is received, but I’m consistently encountering a "State Mismatch" error. I’ve tried multiple solutions, and I’m hoping someone could help me resolve this issue.
# Django & Azure Configuration:
Django version: 5.0.6
Python version: 3.12
SSO Integration Package: `django-microsoft-sso`
Azure App Service: Hosted with App Service Plan for deployment.
Time Zone: Central Time (US & Canada) on local development and UTC on the Azure server.
Session Engine: Using default Django session engine with database-backed sessions (
ERROR 2024-09-09 14:12:40,723 - State Mismatch. Time expired?
INFO "GET /microsoft_sso/callback/?code=... HTTP/1.1" 302 0
DEBUG views Login failed at 2024-09-09 19:xx:xxpm: Displaying login_failed page.
DEBUG views Session ID during login_failed: None
DEBUG views Session contents during login_failed: {}
DEBUG views CSRF token during login_failed: None
SSO Callback Code:
import logging
import os
import binascii
from django.contrib.auth import login
from django.shortcuts import redirect, render
from django.urls import reverse
from django.conf import settings
from django.contrib.auth.models import User
from django.utils.timezone import now
logger = logging.getLogger(__name__)
def microsoft_sso_callback(request):
logger.debug(f"Start Microsoft SSO login. Current Server Time: {now()}")
# Retrieve the state from the callback and session
state = request.GET.get('state')
session_state = request.session.get('oauth2_state')
logger.debug(f"Received state in callback: {state}")
logger.debug(f"Session state before validation: {session_state}")
logger.debug(f"Session ID during callback: {request.session.session_key}")
logger.debug(f"Session contents during callback: {dict(request.session.items())}")
#
/r/djangolearning
https://redd.it/1fd83fu
I’m working on integrating Microsoft SSO into my Django app (hosted on Azure App Service). The SSO login flow seems to work up to the point where the callback is received, but I’m consistently encountering a "State Mismatch" error. I’ve tried multiple solutions, and I’m hoping someone could help me resolve this issue.
# Django & Azure Configuration:
Django version: 5.0.6
Python version: 3.12
SSO Integration Package: `django-microsoft-sso`
Azure App Service: Hosted with App Service Plan for deployment.
Time Zone: Central Time (US & Canada) on local development and UTC on the Azure server.
Session Engine: Using default Django session engine with database-backed sessions (
django.contrib.sessions.backends.db).ERROR 2024-09-09 14:12:40,723 - State Mismatch. Time expired?
INFO "GET /microsoft_sso/callback/?code=... HTTP/1.1" 302 0
DEBUG views Login failed at 2024-09-09 19:xx:xxpm: Displaying login_failed page.
DEBUG views Session ID during login_failed: None
DEBUG views Session contents during login_failed: {}
DEBUG views CSRF token during login_failed: None
SSO Callback Code:
import logging
import os
import binascii
from django.contrib.auth import login
from django.shortcuts import redirect, render
from django.urls import reverse
from django.conf import settings
from django.contrib.auth.models import User
from django.utils.timezone import now
logger = logging.getLogger(__name__)
def microsoft_sso_callback(request):
logger.debug(f"Start Microsoft SSO login. Current Server Time: {now()}")
# Retrieve the state from the callback and session
state = request.GET.get('state')
session_state = request.session.get('oauth2_state')
logger.debug(f"Received state in callback: {state}")
logger.debug(f"Session state before validation: {session_state}")
logger.debug(f"Session ID during callback: {request.session.session_key}")
logger.debug(f"Session contents during callback: {dict(request.session.items())}")
#
/r/djangolearning
https://redd.it/1fd83fu
Reddit
From the djangolearning community on Reddit
Explore this post and more from the djangolearning community
Seasoned Developers: What does you .gitignore look like?
Help a novice out. When building with Django, what are the essentials to add to a gitignore file before pushing to remote?
/r/django
https://redd.it/1fdigtr
Help a novice out. When building with Django, what are the essentials to add to a gitignore file before pushing to remote?
/r/django
https://redd.it/1fdigtr
Reddit
From the django community on Reddit
Explore this post and more from the django community