<commit_before>import data.clients, data.players, data.blocks 
from twisted.web.resource import Resource
from twisted.internet import reactor
from config import webapi as webapi
import json, calendar, datetime, plugins

upStart = calendar.timegm(datetime.datetime.utcnow().utctimetuple())

class WebAPI(Resource):
	isLeaf = True

	def render_GET(self, request):
		currData = {'playerCount' : len(data.clients.connectedClients), 'blocksCached' : len(data.blocks.blockList), 'playersCached' : len(data.players.playerList), 'upSince' : upStart}
		request.setHeader("content-type", "application/json")
		return json.dumps(currData)

@plugins.onStartHook
def setupWebAPI():
	if webapi:
		from twisted.web import server
		import plugins.WebAPI as jsonsite
		wEndpoint = TCP4ServerEndpoint(reactor, 8080, interface=ifaceIp)
		wEndpoint.listen(server.Site(jsonsite.WebAPI()))
	<commit_msg>Fix modular WebAPI.<commit_after>import data.clients, data.players, data.blocks 
from twisted.web.resource import Resource
from twisted.internet import reactor
from config import webapi as webapi
import json, calendar, datetime, plugins

upStart = calendar.timegm(datetime.datetime.utcnow().utctimetuple())

class WebAPI(Resource):
	isLeaf = True

	def render_GET(self, request):
		currData = {'playerCount' : len(data.clients.connectedClients), 'blocksCached' : len(data.blocks.blockList), 'playersCached' : len(data.players.playerList), 'upSince' : upStart}
		request.setHeader("content-type", "application/json")
		return json.dumps(currData)

@plugins.onStartHook
def setupWebAPI():
	if webapi:
		from twisted.web import server
		wEndpoint = TCP4ServerEndpoint(reactor, 8080, interface=ifaceIp)
		wEndpoint.listen(server.Site(WebAPI()))
	
{'fraction_non_alphanumeric': 0.114335461404527, 'fraction_numerical': 0.005803830528148578, 'mean_word_length': 6.305084745762712, 'pattern_counts': {'":': 0, '<': 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': '3065012', 'n_tokens_mistral': 565, 'n_tokens_neox': 537, 'n_words': 124}