Ejemplo n.º 1
0
def get_statuses(count):
    hq = httpsqs.Httpsqs('202.85.215.157', 1218)
    weibos = []
    for i in range(count):
        #resp=hq.get('mining.comments_watch')
        #resp={"user_id": 17, "user_weibo_id": 2938518380, "status_id": 3550700656896440, "post_id": 327749, "time": "2013-02-28 15:27:19", "scene_id": 24}
        resp='{"user_id": 1566, "user_weibo_id": 1399737075, "status_id": 3550761994164937, "post_id": 327760, "time": "2013-02-28 19:31:03", "scene_id": 32}'
        if httpsqs.isOK(resp):
            weibo = json.loads(resp)
            weibos.append(weibo)
            time.sleep(1)
    return weibos
Ejemplo n.º 2
0
#Verion 1.1
#Author wendal([email protected])
#If you find a bug, pls mail me

#PLEASE start you httpsqs first!!!

print("init httpsqs client")
hq = httpsqs.Httpsqs('sunfarms.net')
#if you didn't use default 1218
#hq = httpsqs.Httpsqs('localhost',8020)

#PUT
print("Test PUT -------------------------------------")
data = 'This is a httpsqs client'  #data can be a file
resp = hq.put('QueueABC', data)
if httpsqs.isOK(resp):
    print("PUT OK")
else:
    print("PUT FAIL --> " + resp)

#GET
print("Test GET -------------------------------------")
resp = hq.get('QueueABC')
if httpsqs.isOK(resp):
    print("GET OK --> " + resp)
else:
    print("GET FAIL --> " + resp)

#Status
print("Test Status ----------------------------------")
resp = hq.status('QueueABC')
Ejemplo n.º 3
0
# Author wendal([email protected])
# If you find a bug, pls mail me


# PLEASE start you httpsqs first!!!

print("init httpsqs client")
hq = httpsqs.Httpsqs("sunfarms.net")
# if you didn't use default 1218
# hq = httpsqs.Httpsqs('localhost',8020)

# PUT
print("Test PUT -------------------------------------")
data = "This is a httpsqs client"  # data can be a file
resp = hq.put("QueueABC", data)
if httpsqs.isOK(resp):
    print("PUT OK")
else:
    print("PUT FAIL --> " + resp)

# GET
print("Test GET -------------------------------------")
resp = hq.get("QueueABC")
if httpsqs.isOK(resp):
    print("GET OK --> " + resp)
else:
    print("GET FAIL --> " + resp)

# Status
print("Test Status ----------------------------------")
resp = hq.status("QueueABC")