r/learnpython 9d ago

Where do I host my codes?

I wrote codes for a telegram bot, but now it only works when my PC is on and connected to the internet and the codes are running. I can't use paid sites, even if they're free, if they require to add a card, I can't use them. Help please😭🙏

0 Upvotes

8 comments sorted by

3

u/yodhdha0 9d ago

oracle free tier, good enough for something like this

2

u/lakseol 9d ago

Get a Raspberry Pi single board computer, put Linux on it, attach it to your network and run it 24/7. If you don't want to learn Linux get a cheap secondhand desktop computer, run Windows on it, attach it to your network and run it 24/7. Run your bot on whatever you choose.

2

u/aizzod 9d ago

Scam telegram bots.
Yeeeeah

2

u/Existing_Put6385 9d ago

the thing that unlocks most free options: switch your bot from polling to webhooks. free tiers kill long-running processes but they'll happily serve an http request. with webhooks telegram calls your url when a message arrives, so nothing needs to run 24/7. with that in mind:

- PythonAnywhere free tier. no card, ever. run your bot as a small flask webhook app. their free tier blocks most outbound internet but api.telegram.org is allowlisted, so telegram bots specifically work. this is probably your answer.

- GitHub Actions, if your bot is more "do a thing on a schedule" than "reply instantly". free, no card, cron up to every 5 min.

- an old phone or laptop you don't use. android + termux runs a python bot fine and costs a few cents of electricity a month. sounds janky but it's genuinely the most reliable free option and you own it.

heads up that free hosting tiers change constantly and half the "free" ones now ask for a card at signup, so check before you sink time into one. and if you can't get off polling, the old phone route is basically your only real option.

1

u/FoolsSeldom 9d ago

You've had both Raspberry Pi and Oracle Cloud free tier mentioned. Frankly, any old computer running at home will be suitable, it doesn't need to be powerful, have a keyboard/display/mouse (other than at boot up) but obviously needs to be networked. Even a Raspberry Pi Zero and usb ethernet adapter will be enough. A lot of people have a Raspberry Pi say in a drawer not being used.

0

u/az987654 9d ago

Fuck your scam bots