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
guiscrcpy - An Open Source Android Screen Mirroring GUI written in Python at v4.10.0

Hello 👋

I had been working on a GUI interface, in Python; for the fastest Android Screen Mirroring Software, `scrcpy`, for over a year. guiscrcpy is a UI built using `qtpy`. What makes guiscrcpy different from other GUI implementations of scrcpy is that, guiscrcpy is completely standalone, "plug-and-play". This is not a fork of scrcpy itself, but its helper GUI for scrcpy.

​

Screenshot of guiscrcpy on KDE Plasma, Linux v3.8

Source Code: https://github.com/srevinsaju/guiscrcpy

Try it out now, I have Windows (.exe), Linux (.AppImage), snaps and macOS (.app, untested) here on the latest release

guiscrcpy gave me a lot of experience in writing Python, every version was a small improvement, but it made a huge difference in how I look into other software, learn from other popular python projects and much more. I am still learning more, trying to correct, learn, from the mistakes of past.

Please feel free to share your ideas, thoughts, features 😄😇

/r/Python
https://redd.it/m9sgb1
I made a python script that can edit a video and automatically upload in one line of code.

With 1 line of code, you can specify a video and an text overlay and upload videos to tiktok, chromedriver has been modified to avoid bot detection.

https://reddit.com/link/m9vy7b/video/eyrmvdqvndo61/player

​

You can also change hashtag using the hashtag.txt file. 1 per line.

If you found this useful, please check it out and maybe star.

https://github.com/makiisthenes/TiktokAutoUploader

Example Usage# Use a video from your directory.Main("VideosDirPath").uploadVideo("test1.mp4", "This is text \\n overlay on \\n the video", private=True)

/r/Python
https://redd.it/m9vy7b
As a backend dev, how do I make frontend that doesn't suck? Any easy wins?

I'm not a front-end developer and generally not a creative person. Currently learning Django framework and have a couple of simple web applications under my belt.

I'd like to develop expertise on the backend side of things, but it would really help to not create ugliest looking websites in the world. Just want to add enough oomph to have the customers use my webapps, without having to learn a full-fledged frontend framework (at least not yet).

I'm looking for some timeless, easy-to-apply and most prevalent techniques that will give me give me maximum benefit for time spent learning to use them. Basically how hanging fruits when it comes to frontend.

Forgive me for my limited experience and perhaps incorrect jargon, but I can think of these few based on my observations.

Hover effects( with a decent pop-out) - commonly used on navbar links, images, cards etc.
Section separators (mostly on landing pages)
Using cartoon illustrations on your landing page(hero section)
Creative backgrounds using patterns/gradients
A good icon set(came to know about heroicons and noun projects recently. Loved it!)

CSS/JS libraries with easy to use special effects/transitions/use-case


animate.css (with jquery fade-in/fade-outs, slideup/down)
wow.js (appear on scroll)
dropzone.js
jquery datepickers
carousels, counters, modals

I hope you get

/r/django
https://redd.it/ma1hc2
API permissions made easy using Django Rest Framework

Building APIs is not a straightforward job. One has to not only write the business logic but also have a permission layer to protect an unauthenticated user from accessing APIs that are public.

Restricting unauthenticated access alone is not enough though, there are cases where a user need not be authenticated for read permissions but should not be given write permissions.

For instance, if I am building a website for cake recipes, I would want anybody to view all the recipes but only an authenticated user should be able to edit the recipes.

What we essentially need to accomplish is role based access. This is where Django Rest Framework shines.

Handling all of these cases should be a separate module that you can just plug in at the end once your business logic is complete.

Guess what? It is actually that simple if you use Django Rest Framework. So before we go any further please install DRF in your django app.

## Authentication classes

As mentioned earlier, there are two distinct concepts that need to be applied here. 

The first one being identifying a user that is making a request based on various authentication backends that can be configured in settings.py of your django project.

This can be done

/r/django
https://redd.it/m9makx
Media is too big
VIEW IN TELEGRAM
Really proud of my first full on Django project so thought I'd share.

https://redd.it/ma3wa8
@pythondaily
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!

/r/Python
https://redd.it/ma9qce
(1048, “Column 'brandid' cannot be null”) in django rest framework



I am trying to create an api where a user can add their products. I am sending raw json data from postman but it is giving this error.

**IntegrityError at /api/addproducts (1048, "Column 'brand\
id' cannot be null")

I am sending brand id in the data. I am not sure what is happening.

​

https://preview.redd.it/0uh7k9w0vio61.jpg?width=358&format=pjpg&auto=webp&s=8fa24a21c375c4f1ee2f20673c5be7ba6297555f



Here I am sending merchant_id as well as categories ids but why brand field is creating an error I am not sure.

My models:

class Category(models.Model):
name = models.CharField(maxlength=100, unique=True)
image = models.ImageField(null=True, blank=True)


class Meta:
verbose
nameplural = "Categories"

def str(self):
return
self.name

class Brand(models.Model):
brand
category = models.ForeignKey(Category,ondelete=models.CASCADE,blank=True,null=True)
name = models.CharField(max
length=100, unique=True)
image

/r/django
https://redd.it/magmjh
I created a lightweight file copier/sorter to help with high school.

As a 9th grader, I have many unorganized files because of online school. Not just that, I also do photography and sometimes the file names on my camera match up with ones at a specific directory even if the photograph is different which makes it a pain to copy. Though avoidable problems, I decided to use this as a chance to create a program. I created autosort.

Preview

Autosort has the ability to copy files from several directories into folders with other options such as not overwriting duplicate files, removing metadata, sorting by file type, etc!

Github: https://github.com/vihdutta/autosort

I am really proud of this program and I hope you all have some thoughts to share with me!

/r/Python
https://redd.it/m9y1k8
[D] An example of machine learning bias on popular. Is this specific case a problem? Thoughts?

/r/MachineLearning
https://redd.it/ma8xbq
Tab completion be like

/r/django
https://redd.it/maojw9
The Python Discord Topic for the week of March 22: Profiling and Optimization in Python

## Topic for the week of March 22: Profiling and Optimization in Python
> We are partnering with the Python Discord community to explore topics related to the python language each week. On the discords sidebar, under Weekly Topic you can find a live chat to discuss and explore this topic, or click here to jump directly to it. These topics are curated and organized by /u/Kutiekatj9

Python is typically known as a "slow" language compared to C, C++, and other statically typed languages. This slowness comes partially from the fact that Python is a dynamically typed language.

This feature is great for shortening developer time, but it does mean there's extra overhead in the interpreter with type checking. Luckily, Python is fast enough for most applications and the cases where it isn't, we already have solutions!

We're going to discuss the solutions that aren't "switch to Rust": profiling and optimization of Python!

Let's set some ground rules first:
1) Premature optimization is the root of all evil. Don't assume you need faster code until you have a verified use case that you actually do.
2) When you do, or trying to figure out if you do, you profile it first. The slowdown may

/r/Python
https://redd.it/mateua
Cryptocurrency trading bot

Hi guys,

I started a project of a cryptocurrency trading bot with a GUI last year around this time, and I just wanted to the share the current status of this project.

Currently, you can run a simulation, backtest, or a real live bot with the program. You have to write your strategies yourself in the Strategy class, but once that's done, the GUI updates itself automatically and you can select your strategies from the GUI itself.

The program also has Telegram integration, ability to download past data, view news, and a bit more.

I would love to see what you guys think, and it would be awesome if people wanted to contribute to this project (it's open-source after all).

Since this is my first real project out of college, the code is a bit of a mess, but I tried my best. Any constructive criticism is greatly appreciated. One main thing to do right now is revert all the insertions to appends in the code. Not sure why, but when I started, the code had the newest data in the front of the list, so every time there's new data, it had to be inserted to the front of the list which

/r/Python
https://redd.it/mao7qk
API endpoint or ORM management command for adding web-scraped data to database ?

I am web scraping football scores using selenium and wondering whether I should setup an API (Rest Framework) endpoint and run the script from my local PC, or set up the script as Django management command using the ORM.

Any thoughts ? Thanks

/r/django
https://redd.it/mal188
I resurrected an abandoned tiling window manager

PyTyle is a tiling manager for Linux meant to be used on top of other window managers. This project was abandoned by its creator 11 years ago. I spent the last month adjusting it for Python 3, fixing bugs, writing documentation and optimizing. I've just started adding new features requested by users.

I intend to continue developing and maintaining PyTyle.

https://preview.redd.it/qt39eydqqmo61.png?width=1920&format=png&auto=webp&s=60e7e8fbedcc73ba823fdd8ee5aea03af39bd53d

/r/Python
https://redd.it/mavrii
No-code or learn Django?

Hi all,

I’ve been trying to build a social bookmarking site with discussions similar to Reddit. I’ve been using the no-code platform Bubble so far. On the surface, the progress is amazing. Logins and UI is all there. But I am having some issues. Nested comments are almost impossible (I have checked on the bubble forums). Working on large lists times things out. There are also some speed issues. Lastly, if I ever want to migrate to in-house traditional building, there is vendor lock-in and I can’t move users to a new platform (or do I save passwords??). Should I just keep making workarounds or learn a framework. I have a few months free coming and have a bit of background with Django. Do you think it would be worth it or even possible? My background is in economics and finance? I know that there are some Reddit clones built on Django floating around so I could work off of them. My only issues is I will be going back to a very intense job (consulting) so I am worried I won’t have enough time to learn enough to get it all working and on the job my skills will likely

/r/django
https://redd.it/mb0h2x
Finally, I was able to fetch raw heart rate and sleep data from Fitbit API today and plot them using python. I am so excited about this.

I have requested data from the Fitbit API using tokens and plotted the Heart rate data and sleep data using pandas for the last 4 days. The gaps in the middle of the Heart rate plot indicate I was not wearing the device.

​

HR Data

​

Sleep data



Here is the detailed Description + code How I made it to work. It took me a long time to figure out as there are no good online resources on this. So, I am happy to share it with you.

How to get the API token: https://github.com/arpanghosh8453/programs/blob/master/Fitbit%20Data%20Analyzer/How%20to%20get%20the%20OAuth%20Token.pdf

Python code + ipynb file ( Jupyter notebook): https://github.com/arpanghosh8453/programs/tree/master/Fitbit%20Data%20Analyzer

I am a beginner and this is one of my biggest achievements without any significant help :)

/r/Python
https://redd.it/maokdp
Post-save signal on e-commerce app

Hello,

I am creating an e-commerce app and am struggling with how my CartItem and Cart models interact.

I am looking to create or update the Cart based on the creation of new CartItem instances, which I believe can be done by using post-save signals. However, a Cart instance is not created.

* [signals.py](https://wtools.io/code/raw/b4oJ)

* [relevant models](https://wtools.io/code/raw/b4oI)

* [relevant views](https://wtools.io/code/raw/b4oH)

Any help would be greatly appreciated! If there is any missing relevant info, let me know and I can provide that as well.

Thanks in advance!

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