Esempio n. 1
0
# -*- coding: utf-8 -*-
import KBEngine
from KBEDebug import *
import random
import math
import time
import const
import switch
from socket import *
import base64

http_ip = const.HTTP_SERVER_IP
if KBEngine.publish() == 0:
    http_ip = const.HTTP_DEBUG_SERVER_IP
else:
    http_ip = gethostbyname(http_ip)
    INFO_MSG("HTTP_SERVER_IP: :%s." % (http_ip))


class SimpleHttpClient(object):
    def __init__(self):
        self.udpClient = socket(AF_INET, SOCK_DGRAM)

    def sendTcpHttpLog(self, operation, json_dict):
        value = str(json_dict)
        value = value.replace(' ', '%20')
        value = value.replace('#', '栋')
        #value = base64.encodestring(value)
        sendStr = "GET /log_get_reward.php?key=" + operation + "&value=" + value + " HTTP/1.1\r\nHost: " + http_ip + "\r\nConnection: Close\r\n\r\n"

        tcpClient = socket(AF_INET, SOCK_STREAM)
Esempio n. 2
0
def INFO_MSG(*args):
    if KBEngine.publish() <= 1:
        KBEngine.scriptLogType(KBEngine.LOG_TYPE_INFO)
        printMsg(args, False)
Esempio n. 3
0
def DEBUG_MSG(*args):
    if KBEngine.publish() == 0:
        KBEngine.scriptLogType(KBEngine.LOG_TYPE_DBG)
        printMsg(args, True)
Esempio n. 4
0
def DEBUG_MSG(*args): 
	if KBEngine.publish() == 0:
		KBEngine.scriptLogType(KBEngine.LOG_TYPE_DBG)
		printMsg(args, True)
Esempio n. 5
0
 def canExecuteInnerCommand(self):
     return not KBEngine.publish()
Esempio n. 6
0
def INFO_MSG(*args): 
	if KBEngine.publish() <= 1:
		KBEngine.scriptLogType(KBEngine.LOG_TYPE_INFO)
		printMsg(args, False)
Esempio n. 7
0
def DEBUG_MSG(*args): 
	if KBEngine.publish() == 0:
		printMsg("Debug:",   args, True)
Esempio n. 8
0
def DEBUG_MSG(*args):
    if KBEngine.publish() == 0:
        printMsg("Debug:", args, True)