Ejemplo n.º 1
0
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((conn_test_com.CONN_IP, conn_test_com.CONN_PORT))

uid = 100005
(errCode,
 strJson) = conn_test_com.TcpLogin(100149, 'IMUser167',
                                   '96e79218965eb72c92a549dd5a330112',
                                   '00b6413a92d4c1c84ad99e0a', s)
print "login code:", errCode
print "json:", strJson

if int(errCode) != 0:
    print "login fail"
    exit(0)

reto = json.loads(strJson)
print reto

sid = reto[u'sid']
uid = reto[u'uid']

req_json = '''{
    "exinfo": "exinfo set test",
    "baseinfo": "niehao test baseinfo"
    
}'''

(errCode, strJson) = conn_test_com.TcpSendReq2(10104, uid, req_json, sid, s)
print "create team code:", errCode
print "json:", strJson
Ejemplo n.º 2
0
import socket
import conn_test_com
import json

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((conn_test_com.CONN_IP, conn_test_com.CONN_PORT))

(errCode,
 strJson) = conn_test_com.TcpLogin(s,
                                   platform='a',
                                   phonenum=conn_test_com.TEST_PHONE_NUM,
                                   passwd=conn_test_com.TEST_PWD)
print "login code:", errCode
print "json:", strJson

if int(errCode) != 0:
    print "login fail"
    exit(0)

reto = json.loads(strJson)
print reto

uid = reto[u'uid']
sid = reto[u'sid']

req_json = '{"teamid":100028001, "uid":100028}'
(errCode, strJson) = conn_test_com.TcpSendReq2(s, 50023, req_json, uid, sid)
print "set team info:", errCode
print "json:", strJson
Ejemplo n.º 3
0
#-*- coding: utf8 -*-

import socket
import conn_test_com
import json

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((conn_test_com.CONN_IP, conn_test_com.CONN_PORT))

(errCode, strJson) = conn_test_com.TcpLogin(s, platform='a', phonenum=conn_test_com.TEST_PHONE_NUM, passwd=conn_test_com.TEST_PWD)

print "login code:", errCode
print "json:", strJson

if int(errCode) != 0:
    print "login fail" 
    exit(0)
    
reto = json.loads(strJson)
print reto

sid = reto[u'sid']
uid = reto[u'uid']

create_team_json = '{"teamname":"attention2"}'
(errCode, strJson) = conn_test_com.TcpSendReq2(s, 50001, create_team_json, uid, sid)
print "create team code:", errCode
print "json:", strJson
Ejemplo n.º 4
0
(errCode,
 strJson) = conn_test_com.TcpLogin(s,
                                   platform='a',
                                   phonenum=conn_test_com.TEST_PHONE_NUM,
                                   cid='test',
                                   passwd=conn_test_com.TEST_PWD)

print "login code:", errCode
print "json:", strJson

reto = json.loads(strJson)
print reto

sid = reto[u'sid']
uid = reto[u'uid']

req_json = '{"msgid":1410771020985758, "uid":100079}'
(errCode, strJson) = conn_test_com.TcpSendReq2(30201, 100079, req_json, sid, s)

print "get team info:", errCode
print "json:", strJson

sid = reto[u'sid']
msgid = 1410774092487913

errcode, retjson = conn_test_com.TcpUserMsgReceived(100032, sid, s, msgid,
                                                    100033)

print "recv:", errcode, retjson
Ejemplo n.º 5
0
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((conn_test_com.CONN_IP, conn_test_com.CONN_PORT))

(errCode, strJson) = conn_test_com.default_login(s)

print "login code:", errCode
print "json:", strJson

reto = json.loads(strJson)
print reto

sid = reto[u'sid']
uid = reto[u'uid']

req_json = '''{
    "uidlist": [100040,100041,100042,100043],
    "vlist": [1, 0, 2],
    "propertylist": ["phonenum"]
}'''

for i in range(0, 1):
    (errCode, strJson) = conn_test_com.TcpSendReq2(s,
                                                   cmd=10105,
                                                   req_json=req_json,
                                                   uid=uid,
                                                   sid=sid)
    print "TcpSendReq2 code:", errCode
    print "json:", strJson
    print i, "---------------------"