<commit_before># TODO: non-indo handling (eg, can't get data) 

import requests
import time
import datetime
import copy

import sysinfo

#server = 'http://snorlax/'
#server = 'http://localhost/'
server = 'http://status/'

key    = 'banana'

def update(payload,mode="update"):
	"""Updates the server, initial or update depending on mode"""
	payload.update({"key":key})
	req = requests.post(server+mode,data=payload,timeout=6)
	return req

while True:
	try:
		traffic = sysinfo.traffic('eth1')

		# send some limits to define this platform
		req = update({
			# memory in MB
			"Memory": int(sysinfo.memory()["total"]/1024),
			# total storage capacity in GB
			"Storage": int(sysinfo.storage()["total"]/1048576),
		},"init")

		print req.text
		req.raise_for_status()

		print
		print "Online",
		print datetime.datetime.now()

		# in a loop, update the server
		while True:
			req = update({
				# memory used in MB
				"Memory": int(sysinfo.memory()["used"]/1024),
				# total storage capacity in GB
				"Storage": int(sysinfo.storage()["used"]/1048576),
				# total synchronous internet bandwidth in Mbps
				# false if this is unknown
				"TX": int(traffic.tx/131072),
				"RX": int(traffic.rx/131072),
				# temp in degrees celcius
				"Temperature": sysinfo.temperature(),
				# uptime in days
				"Uptime": (sysinfo.uptime()/84600),<commit_msg>network device can be set via env var now<commit_after># TODO: non-indo handling (eg, can't get data) 

import requests
import time
import datetime
import copy
import os
import sysinfo

#server = 'http://snorlax/'
#server = 'http://localhost/'
server = 'http://status/'

key    = 'banana'

def update(payload,mode="update"):
	"""Updates the server, initial or update depending on mode"""
	payload.update({"key":key})
	req = requests.post(server+mode,data=payload,timeout=6)
	return req

while True:
	try:
		traffic = sysinfo.traffic(os.getenv('NDEV') or 'eth0')

		# send some limits to define this platform
		req = update({
			# memory in MB
			"Memory": int(sysinfo.memory()["total"]/1024),
			# total storage capacity in GB
			"Storage": int(sysinfo.storage()["total"]/1048576),
		},"init")

		print req.text
		req.raise_for_status()

		print
		print "Online",
		print datetime.datetime.now()

		# in a loop, update the server
		while True:
			req = update({
				# memory used in MB
				"Memory": int(sysinfo.memory()["used"]/1024),
				# total storage capacity in GB
				"Storage": int(sysinfo.storage()["used"]/1048576),
				# total synchronous internet bandwidth in Mbps
				# false if this is unknown
				"TX": int(traffic.tx/131072),
				"RX": int(traffic.rx/131072),
				# temp in degrees celcius
				"Temperature": sysinfo.temperature(),
				# uptime in days
				"Uptime": (sysinfo.uptime()/84600),
{'fraction_non_alphanumeric': 0.1453952139231327, 'fraction_numerical': 0.02973168963016679, 'mean_word_length': 3.831873905429072, 'pattern_counts': {'":': 18, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '864909', 'n_tokens_mistral': 1085, 'n_tokens_neox': 904, 'n_words': 263}