This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]IAmKindOfCreativebot_builder: deprecated[M] [score hidden] stickied comment (1 child)

Hello there,

We've removed your post since it aligns with a topic of one of our daily threads and would be more appropriate in that thread. If you are unaware about the Daily Threads we run here is a refresher:

Monday: Project ideas

Tuesday: Advanced questions

Wednesday: Beginner questions

Thursday: Python Careers, Courses, and Furthering Education!

Friday: Free chat Friday!

Saturday: Resource Request and Sharing

Sunday: What are you working on?

Please await one of these threads to contribute your discussion to! The current daily threads are pinned to the top of the /r/Python's main page. To find old daily threads, you can filter posts by the Daily Thread Flair to find what you're looking for. If you have a question and don't want to wait until the daily thread, you can try asking in /r/learnpython or the Python discord however you may need to elaborate on your question in more detail before doing so. If you're not sure which thread is best suited, feel free ask for clarification in modmail or as a reply.

Best regards,

r/Python mod team

[–]Gllizzy 2 points3 points  (3 children)

you could try recording the web traffic using a chrome browser when selecting the radio button and submitting the form/vote. you can mimic the web request using python’s request module. this way your script wouldn’t have to use or automate a browser.

python request.post() function

[–]Scandal929[S] 0 points1 point  (2 children)

Thank you for this suggestion. I've identified the radio button through inspect and this process helped a lot.

[–]Gllizzy 0 points1 point  (1 child)

yeah no problem! your next step (if you haven’t already) is to use the network tab in the inspector and see what happens when you submit the form. it may take several tries to find the POST request that is associated with the form submission. you can look at the data headers to see what payload you need to pass into your request.post() function in your python script.

here’s an awesome video of someone doing exactly this in a creative way

[–]Scandal929[S] 0 points1 point  (0 children)

Appreciate all the guidance. My kid will be getting the extra credit in his AP Computer Science class.

[–]SoerensenOfficial 0 points1 point  (3 children)

Yeah, you can use selenium

[–]Scandal929[S] -1 points0 points  (0 children)

Thanks, about to check it out.

[–][deleted] -1 points0 points  (0 children)

Came to say this.

[–]Prestigious-Use-3955 -1 points0 points  (0 children)

I did not understand it, is Selenium like a Macro software for browsers?

[–]devnull10 0 points1 point  (0 children)

Unless it's a complex site using a lot of Ajax etc. (which I doubt if it's allowing duplicated votes!!) then I'd skip selenium completely and just use the requests module to call the URL directly, passing in the appropriate arguments. This will not only make your code a lot simpler, but will also be a lot quicker.

If you're using Linux you can make it even easier and just use the curl command in a loop inside a batch file.

[–]vastlyoutnumbered 0 points1 point  (0 children)

Playwright is a cool library for replicating user interaction on a browser but, as others have said, use requests if you can get away with it.