Forums

IP Adress?

Hey guys! For an API I use I need to set an "allowed IP". Does pythonanywhere provide one?

Not really -- the IP address of your code depends on where it's running (in a console/in a scheduled or always-on task/in a website's code) and can also change from time to time.

If the API has some way you can automatically whitelist an IP, then perhaps you could find the IP address of your running code at the time the script starts up, then whitelist it, then do the rest of your API access? You can always find the current IP address with code like this:

import requests
ip = requests.get("https://api.ipify.org?format=json").json()["ip"]