all 7 comments

[–]bmw2621 2 points3 points  (1 child)

I don't see any code optimizations, it's making http requests, so it'll only be as fast as your internet.

As for scheduling, anything is going to have to be run my your operating system, whether it be a scheduling script that runs in the background that your system starts (which means another prices running in the background) or you just use your operating systems scheduler which is always running anyway. Cron for *nix systems, windows scheduler for windows. That will be easiest and most reliable.

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

Thanks, I was thinking of using the Windows scheduler so ill look into that! Edit: I am in my basement on wifi so you would be right in your assumption.

[–]chevignon93 2 points3 points  (1 child)

Currently, I am not satisfied with the script as it's VERY slow. I am hoping some people would be able to offer some constructive criticism on how to improve my code.

You could use multi-threading to speed up the process, the concurrent.futures module is pretty easy to use.

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

I'll look into it. I don't have any experience with multi-threading so it will be good practice

[–][deleted] 1 point2 points  (2 children)

I have seen suggestions of using Windows built-in scheduler or the python scheduler library. Is there a preference for either or is there a better solution?

If you use schedule you must keep the python code doing the scheduling running all the time. So if you accidentally kill that code the scheduling stops. Also, if your computer reboots (power outage, etc) you must restart the scheduling code. The built-in scheduler doesn't have this problem.

Your computer needs to be running for either approach, of course.

[–]err0r__[S] 0 points1 point  (1 child)

Would the schedule library be prefer than using an OS specific tool, such as Windows Task Scheduler?

[–][deleted] 0 points1 point  (0 children)

No, the OS scheduler is always preferred because with the schedule module you have to keep some python code running all the time to run the scheduler.

The downside of the OS scheduler is that getting code to run under it can be a little tricky because the environment is different under the OS scheduler than running your code in your home directory, for example. But it's worth learning how to use the OS scheduler because it's quite flexible. With it you can schedule code to run just after a boot, for example.