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
I built a flask site that combines stock posts from different social medias and keeps track of the most talked about tickers

hey everyone,

Using flask I built a site that takes stock related posts from 10 different subreddits, as well as from thousands of users on twitter, tiktok, and youtube and combines them into one searchable place. it's been a pretty fun project that has taken me a couple hundred hours to complete and I'm really happy how it turned out. It has served me as a useful tool for investing if any of you are interested in that. Would love to hear any thoughts, feedback, ideas. Thanks!

Backend is python and mysql/frontend is html, css, js

hosted on pythonanywhere

https://www.stockcompiler.com/

/r/flask
https://redd.it/lb7qcn
save() takes 1 positional argument but 2 were given

I am trying to register as a seller ( is\_seller=True). But I am getting this issue of save() function cant take two positional arguments. I tried passing \*args and \*\*kwargs as well, but it is still not working.

My models:

class CustomUser(AbstractUser):
# username = models.CharField(max_length=255,)
first_name = models.CharField(max_length=255, verbose_name="First name")
last_name = models.CharField(max_length=255, verbose_name="Last name")
email = models.EmailField(unique=True)

is_seller = models.BooleanField(default=False)
is_customer = models.BooleanField(default=False)

USERNAME_FIELD = "email"
REQUIRED_FIELDS = ["first_name", "last_name"]

objects = CustomUserManager()

def __str__(self):
return self.email
My serializers:

class

/r/djangolearning
https://redd.it/lbldga
How to Send an email from Python

I wrote a article on how to send an email from Python using Gmail, smpt, MIMEMultipart and MIMEText. Check it out! https://conorjohanlon.com/send-an-email-from-python/

/r/Python
https://redd.it/lbnieq
I Made A Whatpulse Alternative! My Biggest Python Project Till Now!

Hello fellow redditors, thanks for checking this post.


WhatPulse is a small application that measures your keyboard/mouse usage, down- & uploads and your uptime. What I care about is the keyboard and mouse usage. I just like knowing how many clicks it took for that peripheral to fail. The issue I had with Whatpulse tho is that whenever my pc shuts down unexpectedly, the data gets corrupted and I start from 0 again. That happened a couple of times and it annoyed me so much that I decided to make my own program that will achieve the same thing and will save the data in a .txt file so that I can modify it easily if I wanted.

​

After 5-10 hours of work on it, this is what I ended up with. I think I spent more time than I should but I would blame that on the fact that I had to learn many new things like multi-threading. I tried my best to keep the code clean but I think it still looks messy. I also used the .pyw file extension instead of .py because I don't want the terminal to open. I have around 20 hours of learning

/r/Python
https://redd.it/lbj227
Create a Python program to scrape YouTube Channel Video Info (based on YouTube API)

For anyone who is looking for an interesting project to do, here's a tutorial series walk you through how to create a standalone Python program to extract a channel's videos info (views, like/dislike count, video title, description, tags, etc).

Part 1: Create a Python class to interact with YouTube Data AP (https://youtu.be/RgtsBdeQ4Vc).

Part 2: Export a channel's videos' information to a Google Spreadsheets using Google Sheets API (https://youtu.be/Xsk3dLgTkx4).

Part 3: Export a channel's videos' information to an Excel and a CSV files using pandas library (https://youtu.be/NohwewVexvI).

/r/Python
https://redd.it/lbph9v
Do we like Medium links, here?

I've seen a lot of links for Medium on here. Personally, I hate Medium, so I always complain. Typically I'm met with downvotes, which is fine. But to that point, I have to ask...do we support folks posting their own Medium links here? I have a few things I'd like to share with the community, but if it's cool with everyone here to post it on Medium and then post the Medium link here, I don't mind grabbing whatever piddly kickbacks that Medium offers. I just don't want to be "That guy", you know?


Love this community, thanks for being so open, welcoming, and supportive of all the new devs out there!

/r/Python
https://redd.it/lbrr19
Maxima

It has been probably been brought up before so please be kind, or don't.

I know about maixma-jupyter, but there has to be a manual way to just incorporate maxima in Jupyter in the notebook.

I guess what I am saying is there a more difficult way to get maxima involved in a new jupyter notebook?

/r/JupyterNotebooks
https://redd.it/lbzc8m
Hosting on Django cpanel

Hie guys. I want to host my Django website on a shared server on Cpanel. I'm having trouble though. I'm seeing this index.html page.

default index.html page

I thought the passenger_wsgi.py file was supposed to run first but it's not. How do I make the passenger_wsgi file handle all the incoming requests? This is my first time and I'm so confused and there arent any tutorials or info on this online. If you need any more information I'm ready to give it.

/r/djangolearning
https://redd.it/lbsgvz
Thursday Daily Thread: Python careers!

Discussion of using Python in a professional environment, getting jobs in Python and more!

This thread is not for recruitment, please see r/PythonJobs or the thread in the sidebar for that.

/r/Python
https://redd.it/lc26ka
How can i use a variable from js to django?

So I have a model Articles which contains some articles from a page. And I want to show all info from db to a modal page on my site. The problem is that idk how to send the js variable which contains article's div id to django,so i could extract article with this pk.
I really struggle with that problem 2 days.Hope u know how to do that

/r/djangolearning
https://redd.it/lbl8si
Created and described a family of (Symmetric) Triangle Subdivision Tiles, the Python code is open source and straightforward. You can create 1000's of different images with a few lines of Python code




https://preview.redd.it/ti7keev7odf61.jpg?width=3840&format=pjpg&auto=webp&s=4b969e081c2a326acbc53fbe2d5aaa776437e120

Direct link to Python code:
https://github.com/josvromans/python\_shapes/blob/master/shapes/triangle\_subdivision.py
Explanation here (any feedback on the article is highly appreciated):
https://www.josvromans.com/blog/2021/1/triangle-subdivisions/


If you are into symmetry groups, please let me know if my math and terminology is correct. I hope to improve the blog post, and maybe publish it as a paper. But not before I got in touch with some experts in the field first...

/r/Python
https://redd.it/lc65v6
How to get started with Docker for a Django app(plus deployment options)?

So far I've only worked on very basic Django apps which I didnt bother deploying. Im currently about to start on a web app which will need some async work done - like sending out emails etc. I read about about Celery is used for this. Also, I want to deploy my app in a docker container on some cloud platform

​

Keeping all this in mind, which is the best way for me to go with respect to deployment(AWS/Heroku/Anything else). How should I dockerize my application? Should I have a Dockerfile from the start or should I 'dockerize' the application later? Basically, what are the best practices to follow when deploying a dockerized Django app which I should consider?

/r/djangolearning
https://redd.it/lb5ry6
I made a porn blocker! noFap baby

If you are interested in downloading it

you can find it at my github.

www.github.com/best-code/pornblocker

if you switch to the source branch you can look at the code.

I made two of them. One for people with python already on their machines and one executable for those who dont.

​

The executable is in the "New Folder" folder in the source branch and the non executable version is just those four files

AddLink.py

AddLinkExe.py

hostscopy.txt

firstTime.txt

​

hope this helps even just one of you guys out!

/r/Python
https://redd.it/lc7c9o
I made a Finance Database with over 180.000 tickers to make Investment Decisions easier

In my spare time I love to go through Financial data to understand what kind of companies exist and how sectors and industries evolve. However, I found that it required a lot of effort to figure out which companies belong to which industry and I often ran into paywalls that blocked me from accessing the exact data I was looking for. Platforms like Bloomberg offer such services but at ridiculous prices (up to $24.000 a year). This can make investment decisions for the Average Joe rather difficult especially if you don't want to follow 'the herd'. I wanted to change that.

Insert the **FinanceDatabase**. A database of over 180.000 symbols (80k+ companies, 15k+ ETFs, 30k+ Funds, 3k+ Cryptocurrencies and more) that is fully categorised per country, industry, sector, category and more. It features a 'Searcher' package (pip install FinanceDatabase) that has a user-friendly way of collecting the exact data you want (downloaded straight from the repository). For example, the following code returns all (listed) airlines in the United States (check Examples for more info) :

import FinanceDatabase as fd

airlinesus = fd.selectequities(country='United States', industry='Airlines')

And the following gives insights in ETFs

/r/Python
https://redd.it/lcexoa
Researchers From Google Brain Introduces Symbolic Programming And A Python Library Called PyGlove For Automated machine learning

A team of researchers from Google Brain introduces a new way of programming automated machine learning (AutoML) based on symbolic programming. The team also introduces a new python library called PyGlove that demonstrates the new paradigm’s promising results.

At present, Neural networks are extensively being adopted in various fields. However, determining the correct neural network architecture for a particular task becomes time and resource-consuming because of the increasing complexity in their architecture. Complicated architectures also lead to difficulty in hyperparameter selection. Automated Machine Learning (AutoML) is highly encouraged for automating these selection choices. In May 2017, Google coined AutoML for its neural architecture search (NAS). The approach is widely accepted in the ML research community to automate network hyperparameter and architecture choices.

Paper Summary: https://www.marktechpost.com/2021/02/03/researchers-from-google-brain-introduces-symbolic-programming-and-a-python-library-called-pyglove-for-automated-machine-learning/

Paper: https://arxiv.org/pdf/2101.08809.pdf

/r/Python
https://redd.it/lc9r1d
Has anyone used htmx with django?

Just starting to explore htmx. In a few of my pages, quite some ajax calls are there and it's a very user-driven page (meaning more reactive in nature and not just 1 final submit button).

Would like to know whether anyone here has experience using this combination of htmx and django. Any advice?

/r/django
https://redd.it/lceklc