Python Daily – Telegram
Python Daily
2.56K subscribers
1.49K photos
53 videos
2 files
39.1K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Loading private key of a certificate in local windows machine store

To use Microsoft graph API we use a service principal and a certificate. I can retrieve the certificate if it’s in azure key vault and use it to get an MSAL token for authentication. I am unable to do that if the certificate is in local windows machine certificate store.
Has anyone ever did this? I can’t find any working samples on the internet.
Would really appreciate a solution.

/r/Python
https://redd.it/1fz0ud0
How to configure celery?

I am currently running a flask backend server that is used for various features and one of the features I have added is a model for prediction that takes about 5 to 10 minutes to train on hitting an api on frontend which works fine but the api itself timesout after 2 minutes although the model still gets trained and stored for each user. Now issue is to prevent a mad user experience I wanted to train the model in background and came across celery with redis which I was already for storing sessions so thought to use it and everything runs only just when I use @shared_task decorator to run my task it give Error 61 of connection refused although on running the celery command and backend it says celery is connected. Can someone help me here?

Edit - I used rabbitmq as the broker and redis as result backend and everything worked smoothly. Thanks everyone

/r/flask
https://redd.it/1fyajiz
Production level project help..

I am using boto3 with flask to convert video files (wth mediaConverter), after job done then only saving the video related data in mongodb, but how can I get to know the job is done, so I used sqs and SNS of AWS is it good in production level
Or u have some other approaches..

I want different scenarios and solutions instead of sns and sqs help with this please 🥺


/r/flask
https://redd.it/1fy7fi7
2024 Python Developers Survey

The 2024 Python Developers Survey run by the Python Software Foundation in partnership with JetBrains is now open!

Survey Link - 10-15 minutes to complete

Blog post

/r/Python
https://redd.it/1fz1siq
I make a python library for use as wrapper and transform a pdf in html without lose format

Hello everyone, how are you? I recently created a library wrapper for PDF2HTMLEX for use in Python, this library can transform PDF files to HTML and also convert all PDF files in a folder to HTML semi-automatically.

I would appreciate your feedback by using it, making pull requests or stars if you like:



Repository URL:

https://github.com/gabriel-batistuta/pypdf2htmlEX



The library can be downloaded from PYPI as well:

https://pypi.org/project/pypdf2htmlex/

/r/Python
https://redd.it/1fz9ynu
I just wanna tell you guys that I did it!

I'm sorry oif this is not the right space but I didn't have someone to share this and would actually understand my happiness.

I was finally able to deploy my Django application on Digital Ocean with Postgres, Nginx, and Gunicorn on its Ubuntu machine. I also pointed my domain to the IP and set up the SSL certification. This took me days and I had to destroy the machine multiple times. Oh I also configured redis and celery with different workers.

I'm so hyped 😂😂

/r/django
https://redd.it/1fywr26
Beginner's Guide for Django Deployment

Hey all,

I've noticed beginners struggling with Django deployment, so I wanted to share this free and open-source guide. It is beginner-friendly, explains the process clearly, and helps you get your project deployed quickly.

Any contributions are welcome from the community to improve this guide. If you find it useful, please consider giving the GitHub repo a star (it helps a lot!)

Link: Beginner's Guide for Django Deployment

GitHub Repo: https://github.com/bhavya-tech/django-deployment

Feel free to ask questions here, I will be happy to help!

Happy coding!

/r/django
https://redd.it/1fz1t5d
Wednesday Daily Thread: Beginner questions

# Weekly Thread: Beginner Questions 🐍

Welcome to our Beginner Questions thread! Whether you're new to Python or just looking to clarify some basics, this is the thread for you.

## How it Works:

1. Ask Anything: Feel free to ask any Python-related question. There are no bad questions here!
2. Community Support: Get answers and advice from the community.
3. Resource Sharing: Discover tutorials, articles, and beginner-friendly resources.

## Guidelines:

This thread is specifically for beginner questions. For more advanced queries, check out our [Advanced Questions Thread](#advanced-questions-thread-link).

## Recommended Resources:

If you don't receive a response, consider exploring r/LearnPython or join the Python Discord Server for quicker assistance.

## Example Questions:

1. What is the difference between a list and a tuple?
2. How do I read a CSV file in Python?
3. What are Python decorators and how do I use them?
4. How do I install a Python package using pip?
5. What is a virtual environment and why should I use one?

Let's help each other learn Python! 🌟

/r/Python
https://redd.it/1fzeenv
so i made a download website LOL

Yeah, so I'll probably get tracked down by the government, but who cares? XD Look at that site!

Basically, it's a download site for movies. They're in zip files, etc.


FBI Comin for me boys

https://javu.xyz/

/r/flask
https://redd.it/1fzn2vq
I Made Spotify Premium, But This Time It's Free

A while ago, I shared how I built a Python noscript to download my Spotify Liked Songs as MP3s. Since then, I decided to take the project one step further. Instead of manually running the noscript every time I added new songs, I’ve now automated the entire process to check for new liked songs every day and download them automatically.

Here’s how it works:

- Extracts my Liked Songs from Spotify using the spotipy library.

- Compares them with the list of songs already downloaded to avoid duplicates.

- Uses youtubesearchpython to find the top YouTube result for any new songs.

- Downloads the audio as an MP3 using yt-dlp and stores them in the Songs directory on my desktop.

It’s simple, but it now saves me even more time. I no longer have to worry about manually managing my favorite songs!

This project was so fun to work on, and now I've made it even smarter, by making it run automatically using the Windows built-in Task Scheduler!


I was thinking of making this like a paid tool, with a small cost of $2, but I figured let's share this with people so they can also benefit :)

Here's the GitHub repo:
https://github.com/aneeb02/SpotiFlopy

/r/Python
https://redd.it/1fzidjo
Routes not getting registered. 404 error

I'm using Flask for the first time, and I'm a baby programmer. This is my base template.

from flask import render_template
from app import app
from app.data_handler import DataHandler

data_handler = DataHandler()

@app.route('/')
def home():
    return render_template('about.html')

@app.route('/about')
def about():
    return render_template('about.html')

@app.route('/my_works')
def my_works():
    projects = data_handler.get_projects()
    print(projects)  # Check what projects are loaded
    return render_template('my_works.html', projects=projects)

@app.route('/project/<int:project_id>')
def project_detail(project_id):
    project = data_handler.get_project(project_id)
    if project is not None:
        return render_template('project_detail.html', project=project)
    else:
        print("Project not found")
        return "Project not found", 404


/r/flask
https://redd.it/1fzi7sd
is there a way to make pyright recognize related name fields?

from django.db import models

class A(models.Model):
id = models.IntegerField()

class B(models.Model):
id = models.IntegerField()
fkA = models.ForeignKey(A, ondelete=models.CASCADE, relatedname="fkB")

a = A(id=1)
b = B(id=2, fkA=a)
a.fk
B #Here it says it cannot access attribute fkB for class A

take for example the code snippet above. is there a way to make pyright know that fk\
B fields for class A exists?

/r/django
https://redd.it/1fzlr75
Do multiple requests create multiple instances of a middleware object?

For example, let's say you have some middleware that does something with process_view(), to run some code before a view is rendered. If you have you Django app deployed with Guincorn and Nginix, does every client request get its own instantiation of that middleware class? Or do they all share the same instantiation of that object in memory wherever your code is deployed? (or does each of Gunicorn's workers create its own instantiation?)

/r/djangolearning
https://redd.it/1fzswzm
What personal challenges have you solved using Python? Any interesting projects or automations?

Hey everyone! I'm curious—what have you used Python for in your daily life? Are there any small, repetitive tasks you've automated that made things easier or saved you time? I'd love to hear about it!


I stumbled upon an old article on this Python a while ago. I think it's worth revisiting this topic about it again.



/r/Python
https://redd.it/1fzupwm
N Jurgen Schmidhuber on 2024 Physics Nobel Prize

The NobelPrizeinPhysics2024 for Hopfield & Hinton rewards plagiarism and incorrect attribution in computer science. It's mostly about Amari's "Hopfield network" and the "Boltzmann Machine."



1. The Lenz-Ising recurrent architecture with neuron-like elements was published in 1925 . In 1972, Shun-Ichi Amari made it adaptive such that it could learn to associate input patterns with output patterns by changing its connection weights. However, Amari is only briefly cited in the "Scientific Background to the Nobel Prize in Physics 2024." Unfortunately, Amari's net was later called the "Hopfield network." Hopfield republished it 10 years later, without citing Amari, not even in later papers.

2. The related Boltzmann Machine paper by Ackley, Hinton, and Sejnowski (1985) was about learning internal representations in hidden units of neural networks (NNs) S20. It didn't cite the first working algorithm for deep learning of internal representations by Ivakhnenko & Lapa. It didn't cite Amari's separate work (1967-68) on learning internal representations in deep NNs end-to-end through stochastic gradient descent (SGD). Not even the later surveys by the authors nor the "Scientific Background to the Nobel Prize in Physics 2024" mention these origins of deep learning. (BM also did not cite relevant prior work by Sherrington & Kirkpatrick &

/r/MachineLearning
https://redd.it/1fzw5b1
Speeding up unit tests in CI/CD

I have a large Django project that currently takes ca. 30 minutes to run all the unit tests serially in our CI/CD pipeline and we want speed this up as it's blocking our releases.

I have a Ruby background and am new to Python - so I'm investigating the options available in the Python ecosystem to speed this up. So far I've found:

[pytest-xdist](https://pypi.org/project/pytest-xdist/)
pytest-split
[pytest-parallel](https://pypi.org/project/pytest-parallel/)
pytest-run-parallel
[tox](https://tox.wiki/en/latest/index.html) parallel (not exactly what I need, as I only have one environment)
CircleCI's test splitting - I've used this for Ruby, and it didn't do so well when some classes had a lot of tests in them

I'd love to hear your experiences of these tools and if you have any other suggestions.

/r/Python
https://redd.it/1fzreee
How should I get started with Django?

I recently started to work with Django but I'm completely utterly humbled and devastated at the same time whenever I try to add a new function with an API call into my react project. I really don't understand the magic behind it and usually need to get help from other colleagues.
The Django documents are (I'm sorry) terrible. The more I read into it the more questions arise.
Are there any sources that can give me a better insight on how to work with API in Django and maybe API in general?

I appreciate any sources given (except Django docs)

/r/djangolearning
https://redd.it/1g02p1b