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
Does Jupyter take input for Bash in VS Code?

I'm creating a .ipynb file in VS Code that is using Bash. I have the Jupyter extension installed in VS Code.

I want to create an input in the .ipynb file with the following code:


read input

echo $input




However, when I run the cell, VS Code does not give me a box for input.


How do I do input in Bash for the Jupyter notebook file?

/r/IPython
https://redd.it/x7shnd
Provider for sending emails in Django application

SOLVED: Thanks for your suggestions. Very helpful. Turns out I only needed to add an app password to get it to work again.

For a long time I used Gmail to send emails in my Django applications. I used their service to:

- Send emails to new users that were added to the system.
- Send error logs to my own email so I would notice errors occuring in my application.
- For resetting passwords

Since may 31st Google has stopped support for sending emails through an application. Does anyone have a recommendation for a replacement?

/r/django
https://redd.it/xakcgw
What is the point of request.content_md5 / Content-MD5 Header?

Flask has a `request.content_md5` which corresponds to the `Content-MD5` header. The [docs](https://flask.palletsprojects.com/en/2.2.x/api/#flask.Request.content_md5) say:

> The Content-MD5 entity-header field, as defined in RFC 1864, is an MD5 digest of the entity-body for the purpose of providing an end-to-end message integrity check (MIC) of the entity-body. (Note: a MIC is good for detecting accidental modification of the entity-body in transit, but is not proof against malicious attacks.)

What is the point of this?

I tried sending a request with a bogus value in the Content-MD5 header, and flask did not automatically fail the request.

Am I supposed to write some code that computes the hash of the request body and compare it against Content-MD5, if this is present, and then ask my clients to compute the MD5 and put it in the Content-MD5 header?

I would have assumed that clients would automatically do this as part of the client library, and the flask would automatically compare the md5 and fail with an error. It seems like this does not happen.

/r/flask
https://redd.it/xatptz
Sending E-Mail to the customer

Hi, devs. I am using Flask-Mail and I want to send the mail-like photos to the client. I can send plain text, but I want to make it better. WHere should I put this HTML code? Can someone guide me?

​

​

https://preview.redd.it/6uw5lnxoq1n91.png?width=521&format=png&auto=webp&s=a65e572b2683b4bd3312f4d967a62ae4fdaa87e8

/r/flask
https://redd.it/xarkgw
Sunday Daily Thread: What's everyone working on this week?

Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.

/r/Python
https://redd.it/xb3w16
Does Jupyter take input for Bash in VS Code?

I'm creating a .ipynb file in VS Code that is using Bash. I have the Jupyter extension installed in VS Code.

I want to create an input in the .ipynb file with the following code:


read input

echo $input




However, when I run the cell, VS Code does not give me a box for input.


How do I do input in Bash for the Jupyter notebook file?

/r/JupyterNotebooks
https://redd.it/x7shvc
Running Flask with VS Code Live Share

Hi, I am working on a project with a couple of friends in VS Code and I want to run the Flask app so that my friends can see the website. I know in HTML/Javascript, when you work with the Live Server extension, the collaborators can see the website in Live Share, but how do you do that in Flask? Thanks.

Edit: Right now, my friend is clicking on "127.0.0.1" in Live server and is seeing this:

" Access to 127.0.0.1 was deniedYou don't have authorization to view this page.HTTP ERROR 403"

/r/flask
https://redd.it/xb5j4t
Saturday Daily Thread: Resource Request and Sharing! Daily Thread

Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?

Use this thread to chat about and share Python resources!

/r/Python
https://redd.it/xaaivv
Is it normal for beginners to not "get" Django?

I'm coding along 'Django for beginners' book by William Vincent which many people recommend but I feel like a lotta times I am not really understanding a lot of things FULLY.

For example when I was learning python language, concepts were in sequential order, learn strings, than lists, than oops, etc while here it's all random, & while it took practice to master basic python concepts, they clicked from the start but here a lot of things I don't get like the book hasn't gone into details of stuff like importing from django.urls.abcd.xyz.holyshit...

So is the book not for me or will I start getting the concepts with more time I invest on Django? More practice, more tutorials.. Maybe it's difficult for me cuz this is my first experience with web dev..

Ik this post comes of more as a rant than a question but ig I just need reassurance from people who have experience with django.

(Side note: this is kinda feels the same when I started programming with c++, it took months for me to understand pointers, thank God I shifted to python)

/r/django
https://redd.it/xayaed
Is it possible to shift django app in virtual env

I have a django app (in my local windows, not in a venv) how can i shift it to a venv?

/r/django
https://redd.it/xbc7zq
Make your Tkinter app look truly modern with a single line of code!

Tkinter looks notoriously ugly, but did you know that you can make it look just as fancy and modern as Windows 11?

I'm pleased to announce that today I've released a new version of my gorgeous Sun Valley theme, with which you can make your Tkinter/ttk application look like Windows 11.

Check it out!

/r/Python
https://redd.it/xbgyov
Clarification on DRF Serializers

I'm still not a 100% on how serializers work. I get that they're used for serializing and de-serializing but WHY are they used for creating and updating models too?! Doesn't this break the Single Responsibility Principle? Anyway, my questions are:

​

1. When we "exclude" a field what does it actually mean?
1. Is it not serialized and de-serialized only or does it mean that it won't be saved when we call serializer.save()? The reason why I ask this is because this field is something I need to be setting in the backend python code instead of being passed in from the user.
2. Does read-only field mean they are passed back to clients but not required when getting data from clients / in api calls?

/r/djangolearning
https://redd.it/xbuqih
Automatically create models at startup in multiple models.py in flask

https://github.com/CodeHostedHere/channel\_response\_bot/blob/master/slash\_commands/models.py

Please see the repo above. I've tried adding db.create_all() but it seems my models.py is being ignored. I'd like the app to startup and create any missing tables in any module I make

/r/flask
https://redd.it/xbpnwd
Stripe As Payment Gateway

Dear community,

I’m building a SaaS solution.
I’m studying the payment integration and found stripe interesting as a payment gateway.

Any feedbacks from you about this company/solution ?

I read many negative feedbacks on stripe subreddit but also on trustpilot.

/r/django
https://redd.it/xbx8ys
Templating for HTMX out-of-band swaps

I'm trying out HTMX in a new project, and really enjoying it so far. One thing I'm struggling with though is how HTMX handles updating content in other areas of the page.

With the hx-swap-oob attribute, the default behaviour is to include the other updated areas of the page in the same template partial.

The problem this leads to is having multiple copies of the same snippet, or different snippets returned than the original partial being displayed.

I'm aware of the approach of using django-render-block as shown in the recent BugBytes video. Does anyone else have another approach they prefer for out-of-band swaps?

Thanks!

/r/django
https://redd.it/xcemnx
Monday Daily Thread: Project ideas!

Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code! If you're looking for project ideas, you might be interested in checking out Al Sweigart's, "The Big Book of Small Python Projects" which provides a list of projects and the code to make them work.

/r/Python
https://redd.it/xbxs9l
D Simple Questions Thread

Please post your questions here instead of creating a new thread. Encourage others who create new posts for questions to post here instead!

Thread will stay alive until next one so keep posting after the date in the title.

Thanks to everyone for answering questions in the previous thread!

/r/MachineLearning
https://redd.it/xbkqzz
create points accordingly to the curvature of the curve

Hello guys,

I have a scipy interpolate curve object and I would like to get a list of points on the curve wich have their distance depending on the curvature of the scipy curve.

I'm not sure I've made it clear so don't hesitate to ask me details.
Cheers

/r/IPython
https://redd.it/xclpk8
How to iterate through a a csv file in views.py?

Hello, I'm new to django. I cant find an answer to the following question anywhere.

I want to use the data of a csv file and make sentences out of it. Does anyone know of a good tutorial on how to do it?

​

This is close https://stackoverflow.com/questions/39003732/display-django-pandas-dataframe-in-a-django-template

/r/djangolearning
https://redd.it/xcjzs7