Skip to content

Instantly share code, notes, and snippets.

@misterhay
Created November 20, 2022 20:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save misterhay/7c79a13019f5ad0f895040e689150522 to your computer and use it in GitHub Desktop.
Save misterhay/7c79a13019f5ad0f895040e689150522 to your computer and use it in GitHub Desktop.
Logging IP address
import socket
from datetime import datetime
import requests
ip = socket.gethostbyname_ex(socket.gethostname())[-1]
ethercalc_id = 'iplog'
base_url = 'https://ethercalc.net/'
post_url = base_url+'_/'+ethercalc_id
date_and_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
r = requests.post(post_url, data = date_and_time +','+ str(ip))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment