This is an automated archive made by the Lemmit Bot.

The original was posted on /r/selfhosted by /u/BelugaBilliam on 2024-04-09 07:45:38.


Hello - I’m sharing…well, because maybe someone else will find this useful.

I have wanted to create a little cronjob script that checks traffic to work every day, as I live around a major US city and traffic varies very frequently, and every day can be a 30+ minute swing in arrival time. I found out that TomToms map/traffic and other such api requests, are free - up to 2500 a day for their traffic api specifically, and I didn’t have to put a card on file. I made an account and just had my api key ready. Noob friendly which is nice.

I have been looking for a way to pull this data without having to pay per request - or put my card on file. I don’t want to accidentally get charged, and since I didn’t need to put a card with TomTom, likely the api key will stop working if I hit max, but for a few requests a day, thats nowhere near the 2500/day max. If you are in the same boat as me and want to create something similar, check out TomToms dev api for traffic and similar data. Realtime data which is nice.

If anyone wants to see my python script to pull the data for reference, let me know, and I can throw my code up on github for reference or a guide to do it yourself. My python program just looks at the longitude/latitude of my house and my workplace, uses the api for the traffic time, then sends to my ntfy server (which pings my phone). I setup a cronjob to run the script in the morning so I don’t have to check the traffic just look at my phone screen when my alarm goes off and I know how much I need to rush. I like to sleep in as long as I can :)

Just wanted to share this with the community, in case anyone else builds a similar project and could find this useful.