automated terminal push
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import requests
|
||||
import json
|
||||
import socket
|
||||
import netifaces
|
||||
|
||||
## https://www.nylas.com/blog/use-python-requests-module-rest-apis/#how-to-use-python-requests
|
||||
## https://www.abstractapi.com/guides/ip-geolocation/get-ip-address-python
|
||||
@@ -21,13 +22,26 @@ def ip():
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def hostname():
|
||||
|
||||
try:
|
||||
|
||||
return socket.gethostname()
|
||||
|
||||
except Exception as e:
|
||||
|
||||
print(f"Error getting hostname: {e}")
|
||||
|
||||
return "unknown_host"
|
||||
|
||||
def addDownloadSuccess(url):
|
||||
|
||||
print("enter -> addDownloadSuccess()")
|
||||
|
||||
print("param / url / ",url)
|
||||
|
||||
data = {"url": url, "hostIP": ip(),"ip": ip(),}
|
||||
data = {"url": url, "hostIP": ip(),"ip": ip(),"hostName":hostname()}
|
||||
|
||||
json_data = json.dumps(data)
|
||||
|
||||
@@ -37,8 +51,6 @@ def addDownloadSuccess(url):
|
||||
|
||||
headers = {"Content-Type": "application/json"}
|
||||
|
||||
|
||||
|
||||
response = requests.post("https://apis.yankee.embanet.online/channel/monthly/games/success/add", data=json_data, headers=headers)
|
||||
|
||||
print(response.text)
|
||||
@@ -50,7 +62,7 @@ def addDownloadFailure(url):
|
||||
|
||||
print("param / url / ",url)
|
||||
|
||||
data = {"url": url, "hostIP": ip(),"ip": ip(),}
|
||||
data = {"url": url, "hostIP": ip(),"ip": ip(),"hostName":hostname()}
|
||||
|
||||
json_data = json.dumps(data)
|
||||
|
||||
@@ -60,50 +72,16 @@ def addDownloadFailure(url):
|
||||
|
||||
headers = {"Content-Type": "application/json"}
|
||||
|
||||
|
||||
|
||||
response = requests.post("https://apis.yankee.embanet.online/channel/monthly/games/failure/add", data=json_data, headers=headers)
|
||||
|
||||
print(response.text)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#print("params", params)
|
||||
|
||||
#response = requests.post("https://osiris.yankee.embanet.online/channel/monthly/games/success/exists", headers=headers, data=params, params=params)
|
||||
|
||||
#print("response2", response.json())
|
||||
|
||||
|
||||
def searchURLSuccesses(url):
|
||||
|
||||
print("enter -> callGET()")
|
||||
|
||||
print("param / url / ",url)
|
||||
|
||||
params = dict(
|
||||
origin='Chicago,IL',
|
||||
destination='Los+Angeles,CA',
|
||||
waypoints='Joplin,MO|Oklahoma+City,OK',
|
||||
sensor='false',
|
||||
url2=url
|
||||
)
|
||||
|
||||
|
||||
#data = {"name": "Jane Smith", "email": "janesmith@example.com", "url": url }
|
||||
|
||||
data = { "url": url }
|
||||
|
||||
headers = {"Content-Type": "application/json"}
|
||||
@@ -122,17 +100,6 @@ def searchURLFailures(url):
|
||||
|
||||
print("param / url / ",url)
|
||||
|
||||
params = dict(
|
||||
origin='Chicago,IL',
|
||||
destination='Los+Angeles,CA',
|
||||
waypoints='Joplin,MO|Oklahoma+City,OK',
|
||||
sensor='false',
|
||||
url2=url
|
||||
)
|
||||
|
||||
|
||||
#data = {"name": "Jane Smith", "email": "janesmith@example.com", "url": url }
|
||||
|
||||
data = { "url": url }
|
||||
|
||||
headers = {"Content-Type": "application/json"}
|
||||
|
||||
Reference in New Issue
Block a user