import requests target_url = 'https://openwrt.club/ip' headers = { 'User-Agent': 'hello python' } def myip(): ip_data = requests.get(target_url) print(ip_data.json()) if __name__ == '__main__': myip()