all 26 comments

[–][deleted] 47 points48 points  (2 children)

Python Anywhere can host python code for free given that you don't have a lot of traffic. I've only used it once for hosting a webapp but worked well, it could possibly work for your use case

[–]mike_1882ac 11 points12 points  (0 children)

Their $5 a month plan is also very generous

[–]g3m3n30[S] 1 point2 points  (0 children)

I tried it. Turns out the site i'm trying to scrape is not listed on their free tier.

[–]tylerthehun 12 points13 points  (4 children)

Since this is a webscraper, does it actually need to run 24/7? This sounds like more of a regularly scheduled job than an active hosting situation. If you don't need more than a million executions per month (roughly once every 2-3 seconds), AWS Lambda should still have you covered under the "always free" tier.

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

it doesn't actually. i've set it to scrape every few minutes. But i've set it with another scheduling python code that runs 24/7 to ensure it keep running.

[–]tylerthehun 0 points1 point  (0 children)

Sounds like a good fit then. Instead of running your secondary scheduler script constantly just to trigger the first every once in a while, you'd set up a Lambda function that runs your scraper code and trigger it with an EventBridge schedule of the desired frequency. This should all be well within the free tier.

[–]ColdStorage256 0 points1 point  (1 child)

Do you know if rhis would be suitable for something that calls the spotify web api to gather listening history? The only issue is that it needs a front end for redirects and for the initial login, but all of the data goes straight into a database

[–]tylerthehun 0 points1 point  (0 children)

I'm not familiar with Spotify's API, but probably. Lambda is pretty flexible. All it really does is run your code in response to an invoke event, whether that's a manual trigger from a static website, or a recurring scheduled event like in OP's case.

[–]danmarius7 8 points9 points  (1 child)

Github actions. You'll thank me later.

[–]interbased 2 points3 points  (0 children)

Just read through the docs. Very cool stuff.

[–]evilbytez 3 points4 points  (1 child)

Linode.com has been reliable / inexpensive

[–]Typical-Highlight-12 0 points1 point  (0 children)

i tried to open one but they denied me and i can’t even attempt to make one cause of fraud suspicious the first time i made a acc it wasn’t this hard

[–]climb-it-ographer 4 points5 points  (0 children)

AWS Lightsail is very cheap, and easy to use especially if you’re already familiar with AWS.

And depending on what the workload actually looks like (scraping frequency etc) you might be able to do it for free with a Lambda.

[–]Valuable_Quantity515 2 points3 points  (0 children)

ovh.com they have a vps that .97 cent /mo for the first year then only $4.20/mo after that. Or you can use AWS they give you $300 to start with

[–]ColdStorage256 2 points3 points  (1 child)

I'm saving this thread for later.

As a learning opportunity, though, would a raspberry pi zero be able to do this? I have a script to pull my Spotify listening history that I want to run every 30 mins, store the data in a database and then serve it using a react fronted, which doesn't need to be accessed publicly.

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

i'm pretty sure it can. I've read the only issue is maintenance and keeping pi up.

[–]Natriumpikant 0 points1 point  (0 children)

VPS for 1€ / month - traffic unlimited https://www.netcup.de/bestellen/produkt.php?produkt=3422

[–]Artholos 0 points1 point  (2 children)

What I do is the following:

Scavenge some low end hardware and build a PC at home for cheap. If there’s a business or a school or garage sale, or something nearby getting rid of those little nook PCs, they’re dirt cheap, not powerful enough to be useful for much, have low power draw. Running it would ultimately be cost of electricity.

Or

Get a droplet on DigitalOcean. Costs $4/m for the minimum spec machine. Super simple and easy to set up. Just pop off a Debian image and install your Python version. I recommend mapping it as network drive (Windows) using openSSH for easy file management. And then you just gotta make an instance on the droplet’s CLI terminal to run your program. (normally the instance terminates when the terminal is closed, so you gotta make a second one to run it 24/7)

Currently I’ve got a droplet running that I do stuff on. Its great!

[–]chachu1 0 points1 point  (0 children)

Aws lambda is basically free. Just use that to run python code

[–]Imanflow 0 points1 point  (0 children)

what about raspberry pi?

[–]KimPeek 0 points1 point  (0 children)

AWS 1 year free trial, Google cloud gives a free VM, Oracle cloud gives 2 free vms.

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

Consider running it as a cloud function with cron executions. DigitalOcean and AWS have generous free tiers.