File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ def main():
7272 print ("\n Data:" )
7373 print (data )
7474
75- post_data (data )
75+ send_data (data )
7676
7777def get_bandwidth ():
7878 # Get net in/out
@@ -99,14 +99,18 @@ def get_bandwidth():
9999 network = {"traffic_in" : current_in , "traffic_out" : current_out }
100100 return network
101101
102- def post_data (data ):
102+ def send_data (data ):
103103 try :
104104 endpoint = "http://monitor.localhost.local/api/"
105105 response = requests .get (url = endpoint , params = {"data" : data })
106106 print ("\n GET:" )
107107 print ("Response:" , response .status_code )
108108 print ("Headers:" , response .headers )
109- print ("Content:\n " , response .json ())
109+ print ("Content:" , response .content )
110+ try :
111+ print ("JSON Content:\n " , response .json ())
112+ except :
113+ print ("No JSON content" )
110114 except requests .exceptions .RequestException as e :
111115 print ("\n GET Error:\n " ,e )
112116 exit (0 )
You can’t perform that action at this time.
0 commit comments