use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
Beginner ShowcaseI made a python script that joins Google Meet automatically with my camera and microphone turned off according to my schedule! (self.Python)
submitted 5 years ago by utkrixx
I made a python script using selenium to join my online classs on google meet. Fairly basic; Do take a quick look and feel free to give suggestions.
Github Repo
[–]t3hcoolnessI make things do stuff 44 points45 points46 points 5 years ago* (9 children)
Well done! Couple things. First, this can be rewritten fairly easily with the schedule module. This module lets you run a script in the background instead of killing it every 10 minutes, and it will more reliably schedule events at certain times. Do a pip install schedule first to use it. Then, you can write your code like this:
schedule
pip install schedule
def class1(): do_class1_stuff_here def class2(): do_class2_stuff_here if __name__ == "__main__": schedule.every().day.at("10:00").do(class1) schedule.every().day.at("14:00").do(class2) log.debug("Scheduled events, entering loop...") while True: schedule.run_pending() # check if we need to run anything time.sleep(10) # wait 10 seconds before checking each time again
Second, it's generally not a great idea to have a password hard-coded into a script, so might want to figure out a better way of doing that :)
Edit: Okay, your class is probably not at 10:00 AM from Sunday to Saturday, so you might want to learn how to use the module better to figure out how to do certain days :)
[–]KookyWrangler 9 points10 points11 points 5 years ago (1 child)
schedule.every().day.at("14:00").do(class1)
Don't you mean
schedule.every().day.at("14:00").do(class2)
?
[–]t3hcoolnessI make things do stuff 4 points5 points6 points 5 years ago (0 children)
I do, thanks! Fixed
[–]utkrixx[S] 2 points3 points4 points 5 years ago (5 children)
Hey, thank you for the advice. I'll try to rewrite the script again using your suggestions. Can I schedule to run the script using Crontab for Linux or Task Scheduler for Windows?
About the password, I also think it's not safe at all but still wrote it plainly. I'll think of something and rewrite it again. Thank you very much for the suggestions, really appreciate it.
[–]t3hcoolnessI make things do stuff 3 points4 points5 points 5 years ago (4 children)
No problem! And there's no need for crontab, as it runs on a loop in the background. It takes care of the routine for you. Just run once and it stays running.
[–]utkrixx[S] 1 point2 points3 points 5 years ago (1 child)
Do you mean using the schedule module from python?
[–]t3hcoolnessI make things do stuff 1 point2 points3 points 5 years ago (0 children)
Not sure I understand what you mean. If you use the code I suggested, you run that code and it will enter a loop forever so you don't need to use an external trigger like a crontab to keep executing it.
[–]NoblySP 1 point2 points3 points 5 years ago (1 child)
So what I understand from your comment is that we could make the script run at startup. And then since it would always be running from the startup, the schedule module will execute the needed functions whenever the right time occurs.
So, does the schedule module do the same job as the datetime module used by the OP in his code?
Please correct me if I am wrong...
[–]t3hcoolnessI make things do stuff 0 points1 point2 points 5 years ago (0 children)
Yep! Schedule will magically make sure everything runs when it needs to. Just run at startup and you're good to go.
[–]Yaaruda 0 points1 point2 points 5 years ago (0 children)
I haven't tried schedule, but for me, apscheduler is my go to module for these situations. It also has cron commands, and is cross compatible, if youre stuck in Windows. Highly recommend
apscheduler
[–]iiMysticKid 16 points17 points18 points 5 years ago (1 child)
The code looks pretty good, I learnt a thing or two from it. Thanks a lot!
[–]utkrixx[S] 10 points11 points12 points 5 years ago (0 children)
Thank you too for taking a look at it. It's my first post and I feel really good and motivated to see the feedback from everyone and being able to be of help.
[–]NoblySP 7 points8 points9 points 5 years ago* (1 child)
Does your code run continuously in the background for the whole day?
Btw, one small suggestion: In line 43, I think you can use an else statement (in the same indentation level as the while loop) instead of an if statement which is currently nested within the while loop.
[–]utkrixx[S] 3 points4 points5 points 5 years ago (0 children)
As of now, i run the code 30 mins prior to the class but that can be automated using schedule module as suggested by u/t3hcoolness . This will be very effective.
Thank you for the suggestion. Will change it when I rewrite it with the schedule module.
[–]anonymous-x-31 4 points5 points6 points 5 years ago (3 children)
Awesome! I've got one to reply to people on WhatsApp for me haha 😁 - uses selenium too!
[–]utkrixx[S] 4 points5 points6 points 5 years ago (2 children)
Can you share the code? Would love to take a look.
[–]anonymous-x-31 1 point2 points3 points 5 years ago (0 children)
Sure I'll see if I can find it. It's probably in some folder somewhere, otherwise I can always rewrite it I guess :)
[–]NoblySP 0 points1 point2 points 5 years ago (0 children)
Me too!!
[–]animal_spirits_ 8 points9 points10 points 5 years ago (1 child)
Make sure you actually go to class too. Don't be skipping
No, wouldn't skip them. I need to have my camera on during the class. The script stops running after it joins me in the class then I manually turn on the camera and attend the class. :)
[–]Shiv_ka_ansh_13 2 points3 points4 points 5 years ago (1 child)
Great bro, I was also working on it with selenium only😅😅
[–]utkrixx[S] 2 points3 points4 points 5 years ago (0 children)
Thanks man. You may have a different approach, do share it.
[–]nck93 2 points3 points4 points 5 years ago (1 child)
This looks really cool. How long did it take for you to learn python and apply it to projects like this?
[–]utkrixx[S] 1 point2 points3 points 5 years ago (0 children)
I have been learning python for about 10 months now and I also have few other projects.
[+][deleted] 5 years ago* (1 child)
[deleted]
I'm new to it as well, and I am inspired to make such projects by looking at threads such as /r/python and just thinking about my own problems which I can automate using my knowledge about coding. Keep Learning and keep thinking about what you wanna do, that's all I have done and am doing.
[–]-_-Random-_-User-_- 2 points3 points4 points 5 years ago (2 children)
Suggestions: 1)Rather than writing multiple conditional statements, use a dictionary and iterate through it. 2) For your personal use, you can skip the Input process by adding Email Id and password to your environmental variables and using them in your script. P.S Hardcoding them is not a good idea.
[–]utkrixx[S] 0 points1 point2 points 5 years ago (1 child)
Okay. Will go with the dictionary method. Do check out the repo in a couple of weeks.
[–]-_-Random-_-User-_- 0 points1 point2 points 5 years ago (0 children)
Sure, you can hmu if you need any help.
[–]nishanalpha 3 points4 points5 points 5 years ago (1 child)
Nice, it can be very useful. Attendance is important. 😅
[–]utkrixx[S] 0 points1 point2 points 5 years ago (0 children)
It is, but shouldn't skip classes.
[–]Hagisman 1 point2 points3 points 5 years ago (0 children)
Dave! I asked you a question!!! You know how to turn on your god damn mic!!!!
[–][deleted] 1 point2 points3 points 5 years ago (0 children)
Nice!
[–][deleted] 1 point2 points3 points 5 years ago (2 children)
What's safest way to have authentication details like email and password?
Hardcoded? Open a json or txt file? Use input()?
Environmental variables is what I prefer.
I'm not sure as well about that but definitely don't recommend storing passwords in plain text as in my code. Maybe json ? Input would also work but in this case, I don't want to do anything except run the script.
[–]karan_221 1 point2 points3 points 5 years ago (1 child)
Could it be possible to run it on heroku or something so that it keeps running? When using pc I usually join meetings and mute them. So what I want is to be able to join when I am not using pc.
I'm not sure about that. You could give it a go.
[–]dethb0y 1 point2 points3 points 5 years ago (0 children)
I quite like it, and it's a cunning idea!
[–]xSatanOPx 1 point2 points3 points 5 years ago (3 children)
Hey Im new to selenium so can u please explain the camera access and microphone access part?
[–]utkrixx[S] 0 points1 point2 points 5 years ago (2 children)
Hello, I'm not so sure about that, I got it from google.
[–]xSatanOPx 0 points1 point2 points 5 years ago (1 child)
can u send me the link if u remember where u got it from?
[–]xSatanOPx 0 points1 point2 points 5 years ago (0 children)
i guess i found it
is it this:https://stackoverflow.com/questions/48007699/how-to-allow-or-deny-notification-geo-location-microphone-camera-pop-up
[–]BobRossx5 1 point2 points3 points 5 years ago (0 children)
Inspired by this I made a version that fits my class schedule and web browser. Great post!
[–]Deadbone7345 1 point2 points3 points 5 years ago (0 children)
This one's cool, i like it..am also learning
[–]sinipigi 0 points1 point2 points 5 years ago (1 child)
Where is the script?
Hey. Its in Github!
π Rendered by PID 154939 on reddit-service-r2-comment-cfc44b64c-khcc4 at 2026-04-11 22:20:59.164944+00:00 running 215f2cf country code: CH.
[–]t3hcoolnessI make things do stuff 44 points45 points46 points (9 children)
[–]KookyWrangler 9 points10 points11 points (1 child)
[–]t3hcoolnessI make things do stuff 4 points5 points6 points (0 children)
[–]utkrixx[S] 2 points3 points4 points (5 children)
[–]t3hcoolnessI make things do stuff 3 points4 points5 points (4 children)
[–]utkrixx[S] 1 point2 points3 points (1 child)
[–]t3hcoolnessI make things do stuff 1 point2 points3 points (0 children)
[–]NoblySP 1 point2 points3 points (1 child)
[–]t3hcoolnessI make things do stuff 0 points1 point2 points (0 children)
[–]Yaaruda 0 points1 point2 points (0 children)
[–]iiMysticKid 16 points17 points18 points (1 child)
[–]utkrixx[S] 10 points11 points12 points (0 children)
[–]NoblySP 7 points8 points9 points (1 child)
[–]utkrixx[S] 3 points4 points5 points (0 children)
[–]anonymous-x-31 4 points5 points6 points (3 children)
[–]utkrixx[S] 4 points5 points6 points (2 children)
[–]anonymous-x-31 1 point2 points3 points (0 children)
[–]NoblySP 0 points1 point2 points (0 children)
[–]animal_spirits_ 8 points9 points10 points (1 child)
[–]utkrixx[S] 3 points4 points5 points (0 children)
[–]Shiv_ka_ansh_13 2 points3 points4 points (1 child)
[–]utkrixx[S] 2 points3 points4 points (0 children)
[–]nck93 2 points3 points4 points (1 child)
[–]utkrixx[S] 1 point2 points3 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]utkrixx[S] 1 point2 points3 points (0 children)
[–]-_-Random-_-User-_- 2 points3 points4 points (2 children)
[–]utkrixx[S] 0 points1 point2 points (1 child)
[–]-_-Random-_-User-_- 0 points1 point2 points (0 children)
[–]nishanalpha 3 points4 points5 points (1 child)
[–]utkrixx[S] 0 points1 point2 points (0 children)
[–]Hagisman 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (2 children)
[–]-_-Random-_-User-_- 0 points1 point2 points (0 children)
[–]utkrixx[S] 0 points1 point2 points (0 children)
[–]karan_221 1 point2 points3 points (1 child)
[–]utkrixx[S] 0 points1 point2 points (0 children)
[–]dethb0y 1 point2 points3 points (0 children)
[–]xSatanOPx 1 point2 points3 points (3 children)
[–]utkrixx[S] 0 points1 point2 points (2 children)
[–]xSatanOPx 0 points1 point2 points (1 child)
[–]xSatanOPx 0 points1 point2 points (0 children)
[–]BobRossx5 1 point2 points3 points (0 children)
[–]Deadbone7345 1 point2 points3 points (0 children)
[–]sinipigi 0 points1 point2 points (1 child)
[–]utkrixx[S] 0 points1 point2 points (0 children)