Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Useful automations using Slack, GitHub, Jira, Google tools and more

What My Project Does

Build relatively simple but useful automations in Python deployed on AutoKitteh using integrations to various applications such as GitHub, Slack, Jira, Google Calendar, Google sheets and more. For example:

Categorize new emails in your Gmail inbox using ChatGPT and send notifications to the appropriate Slack channel.
Automatically set JIRA ticket assignees based on Google Calendar events.
Scan your Copilot users and request them to free up licenses if not used for two weeks.
"Break Glass" - Using Slack to orchestrate a temporal elevation of privileges in AWS. A developer asks for privileges in Slack using Slash command, the IT team can approve on deny in Slack form. If approved, the workflow elevates privileges in AWS and reduces back after some period of time.

All written in Python, very short and easy to modify: https://github.com/autokitteh/kittehub

Target Audience 

Can be used by any developer or in production.

You can install the platform and run automation on your PC / Cloud or ask access for the cloud service.

Comparison

Workflows in no-code/low code platforms like Zapier, 8n8 and more. The main difference is that it's a developer first platform (write workflows in code), and it supports durable execution. What is means is that you can write

/r/Python
https://redd.it/1elttxs
Heroku Flask Deployment w/ Gunicorn errors

So I have my Procfile set up as such

web: gunicorn app:app

and my flask run set up as

port = int(os.environ.get("PORT", 5000))
app.run(host="0.0.0.0", port=port)

but when i deploy to heroku i still get the defualt 'this is a development server' message. i dont know what i am doing wrong.

/r/flask
https://redd.it/1elxvc2
need a django minor project

hello developers, I need a unique django project (minor project) please. please share a project, I need help, I've to submit it to my college but i've zero time left to make it. so please guys

/r/django
https://redd.it/1em4621
Saving media folder

Hello everyone, Where do you save your media files in a server or VPS given you are not using storage buckets or other file storage services?

/r/django
https://redd.it/1em5of9
What’s the best way to integrate a shared PostGreSQL DB in development?

Hello,

We’re working on a large university group project which aims to develop a webapp with Django that will eventually be hosted on a virtual host provided by the university.

The server is running with Apache, Ubuntu Linux combined with a PostgreSQL DB.

So far we‘re in the development stage, programming locally on our devices, using Gitlab as version control. We currently use the default SQLite3 DB and upload it to Gitlab together with the code.

I already have access to the virtual host but haven’t played around with it much since that’s not really my expert field.

Now, I’ve read in several sources that it would be smarter to imitate the server tech stack, even in early development phases. That means, instead of using SQLite, we should be already using a PostgreSQL DB instead, even if we only work with dummy data so far.

Now here’s my question. What is the best practice to use a PostgreSQL DB, that synchronizes existing data between the different people involved in programming?

Obviously if I change something, i.e. adding a new user, I want my colleague to also have access to this newly created user the next time he makes changes to the project.

I googled this question

/r/django
https://redd.it/1em9s9b
Header duplicate issue

So I'm trying to do a post request through curl to my flask server. I coded the headers into it. I coded the header "Connection" value to be "keep-alive"
And well it works but somehow its also showing another header called "Connection" with the value "close" How to solve this? Because It should only show keep-alive.


/r/flask
https://redd.it/1emn9h9
Research The Puzzling Failure of Multimodal AI Chatbots

https://preview.redd.it/ummnvenf1ahd1.png?width=2592&format=png&auto=webp&s=7115ba5de026ada17b0636ec2fa3c3151b3e5eb6

Chatbot models such as GPT-4o and Gemini have demonstrated impressive capabilities in understanding both images and texts. However, it is not clear whether they can emulate the general intelligence and reasoning ability of humans. To this end, PuzzleVQA is a new benchmark of multimodal puzzles to explore the limits of current models. As shown above, even models such as GPT-4V struggle to understand simple abstract patterns that a child could grasp.

https://preview.redd.it/7l5fmuys1ahd1.png?width=2716&format=png&auto=webp&s=337118dbc55230637cec1b08b90ae943746ddbb0

Despite the apparent simplicity of the puzzles, we observe surprisingly poor performance for current multimodal AI models. Notably, there remains a massive gap towards human performance. Thus, the natural question arises: what caused the failure of the models? To answer this question, we ran a bottleneck analysis by progressively providing ground-truth "hints" to the models, such as image captions for perception or reasoning explanations. As shown above, we found that leading models face key challenges in visual perception and inductive reasoning. This means that they are not able to accurately perceive the objects in the images, and they are also poor at recognizing the correct patterns.

https://arxiv.org/abs/2403.13315

/r/MachineLearning
https://redd.it/1emi095
Confused about the delete route in my blueprint

So I'm making a book tracking application based off the flask tutorial with a few extra features (like allowing the user to input their current page and calculating a completion status)

Right now, my delete function is acting funny. The blog delete function takes me to a route
"POST /3/delete HTTP/1.1"
My version returns
"POST /anonymous/to%20be%20deleted/update HTTP/1.1"
Notice how it the url_for function builds the route for update instead?
This is my book.delete function I have in the book blueprint....

@bp.route("/<book_author>/<book_title>/delete", methods=('POST',))
def delete(book_author, book_title):

#updated_book = get_author_book(book_title, book_author)
book_id = returnIdFromTitleAndAuthor(book_title, book_author)

print("book_id currently is: " + book_id['id'])

if book_id is None:
flash("No book of that title + author to delete.")

db = get_db()
db.execute("DELETE FROM books WHERE books.id = ?", (book_id['id'],))
db.commit()

#print("Book is outta here")
flash("Book Deleted")
return redirect(url_for("book.index"))

None of the print statements are showing, meaning the function isn't being called. Here is

/r/flask
https://redd.it/1emtg60
Thursday Daily Thread: Python Careers, Courses, and Furthering Education!

# Weekly Thread: Professional Use, Jobs, and Education 🏢

Welcome to this week's discussion on Python in the professional world! This is your spot to talk about job hunting, career growth, and educational resources in Python. Please note, this thread is not for recruitment.

---

## How it Works:

1. Career Talk: Discuss using Python in your job, or the job market for Python roles.
2. Education Q&A: Ask or answer questions about Python courses, certifications, and educational resources.
3. Workplace Chat: Share your experiences, challenges, or success stories about using Python professionally.

---

## Guidelines:

- This thread is not for recruitment. For job postings, please see r/PythonJobs or the recruitment thread in the sidebar.
- Keep discussions relevant to Python in the professional and educational context.

---

## Example Topics:

1. Career Paths: What kinds of roles are out there for Python developers?
2. Certifications: Are Python certifications worth it?
3. Course Recommendations: Any good advanced Python courses to recommend?
4. Workplace Tools: What Python libraries are indispensable in your professional work?
5. Interview Tips: What types of Python questions are commonly asked in interviews?

---

Let's help each other grow in our careers and education. Happy discussing! 🌟

/r/Python
https://redd.it/1emrh0k
Which one should I use, for a login service?

I'm trying to decide between these approaches:

The endpoint:

data = request.get_json()
response, status = auth_service.login(data)
return jsonify(response), status

1:

if not validate_credentials(email, password):
logger.warning(......)
create_audit(......)
abort(401, description="Email or Password Incorrect")


# errors_handler.py
u/errors_blueprint.app_errorhandler(401)
def unauthorized(error):
    response = {
        "success": False,
        "error": "Unauthorized",
        "description": error.description,
    }
    return jsonify(response), 401

2:

if not validate_credentials(email, password):
raise InvalidCredential("Email or Password Incorrect")



# Create an error handler for exception, including status code into custom exception
# and a default message, include logging and audit

3:

if not validate_credentials(email, password):
logger.warning(......)


/r/flask
https://redd.it/1emsh7r
Free Python Camp Aug 25-30

SIGN UP: https://docs.google.com/forms/d/e/1FAIpQLSd3lpMmRSlLqMfCaAVkc-RY4h3MZBLjJdDr6QwaZBiGe3GHw/viewform

Code Catalyst Academy (August Session) is a FREE online summer coding camp for people of all ages. The camp will be held from August 25 to 30 at 5-6 PM CST. We will be exploring Python fundamentals as well as some more advanced topics. You must join our Discord server as that is where we will conduct the camp. The discord link is in the following form where you can sign up:
https://docs.google.com/forms/d/e/1FAIpQLSd3lpMmRSlLqMfCaAVkc-RY4h3MZBLjJdDr6QwaZBiGe3GHw/viewform.

/r/Python
https://redd.it/1emw2sq
What “enchants” you about Python?

For those more experienced who work with python or really like this language:

What sparked your interest in Python rather than any other language? What possibilities motivated you and what positions did/do you aspire to when dedicating yourself to this language?



/r/Python
https://redd.it/1em0heb
Deploying a Django project. Need some guidance!!

Deploying my first project/MVP. The stack is Django, HTML, Tailwind CSS and probably using Postgres. I’m about speed and want to get this out before next week. So I’m thinking of deploying it on a docker container and have the container on a VM. Does this sounds about right? I have my domain! Just need guidance!

/r/django
https://redd.it/1emt1m8
Career Advice: Mid-Senior Django Developer

Hey guys, I've been in IT for few years now. I've been trying to switch into Development side. I need your suggestion what topics or expectations you have from Mid/Senior Django Developer.
It would be great if you can mention those topics as well.
Thank You all in advance 🙂

/r/django
https://redd.it/1en2tzc
What's your go-to method of debugging a django endpoint?

As a typescript developer, I've inherited a django project that doesn't have any documentation or tests. One of the endpoints is behaving weirdly, but the only way to debug it is to spin up a local server and start hitting the endpoint!

In my typescript codebase, if I want to mess around and run different functions in isolation, I just make a script that imports the ORM (and whatever other dependencies), imports my functions, and runs em. It's really nice to be able to run different bits of code willy-nilly without having to hit endpoints. It seems like django admin commands might fill that role in django, but it doesn't seem like that's a common practice, so I'm not sure I want to spend the time setting it up if there's something better.

How do y'all typically debug stuff in a django project?

/r/django
https://redd.it/1en7bb9
Unable to get flask login to work with flutter

I'm trying to get flask login to work with my mobile flutter app, but it doesn't seem like flutter sends the cookies with the request resulting in 401 whenever I log in and try to access a login required resource.

What I have tried:
In my flutter frontend, on first reponse manually save cookies and set in for all subsequent requests. The cookie seems to be correctly set when I debug in my backend, but I still somehow get 401.

I've also tried a cookie management library for flutter, dio_cookie_manager, but to no avail. The cookies don't seem to be properly set.

Any idea? Should I switch to JWT or something else? Ideally I'd like to keep using flask login and figure out a way to make it work with my flutter mobile app. Thanks

/r/flask
https://redd.it/1emrqp3
What are the real downsides of python? And can you really do everything with it?

Im new to coding and I've been interested in making a project I've always wanted to make (A Digital Audio Workstation aka Music Software) but I'm not quite sure python is an option I can go with since the internet apparently keeps saying python is more ideal for simpler software, data analysis, etc.

(im not trying to get hanz zimmer to switch to switch to my app btw, the idea is just a simpler software to get your ideas running so it wouldn't be very cpu consuming I imagine)

/r/Python
https://redd.it/1en1rl2
I made my first ecommerce and what I have got so far

Hi, I build my own ecommerce website using django, DRF, Next.js I can’t share the site because of security reason. However, I want to share what I have got so far..

Reason why I built by myself while there are so many good ecommerce solutions because I thought if I use Next.js, it would dramatically increase sales rate.

In reality, Single page app doesnt make much differences..

Here is the report,

Ad spent: $300
Sales: $200
Total Amount in Cart: $1000
Purchase Rate from cart: 20%
Purchase Rate from ad: 1.6%
Ad click: 2.3%

I am focusing on Purchase rate.. so many people add to cart but few people buy..



/r/django
https://redd.it/1encgd3
Where to deploy flask apps with autoscale other than replit, pythonanywhere?

I used to deploy it on Pythonanywhere but I saw that not all libraries exist and the requests library has a lot of errors when making HTML calls.
then I moved to Replit which has a nice UI and any feature in a normal IDE (locally).
It was great, I used to deploy my apps with autoscale and used to pay around 2 to 5$ monthly because my apps are only for a few users.
But now replit Autoscale and reserved VM require replit CORE which is 20$ a month and I don't want to pay that much for a small app.
So is there another platform with:
- good UI and IDE (not necessarily but it would be good)
- work the same as local IDE (has all libraries)
- making HTML calls normally like when I make locally without any problem
- has autoscale payment without the need to subscribe to a special plan
- a 24/7 run option (I need to scrape data to my database every 1 hour)

/r/flask
https://redd.it/1enfbb9