#!/usr/bin/python
# -*- coding:utf-8 -*-
import solr
import pycurl
import cStringIO
import threading
import time
import os
import sys
import random
import urllib
def test(ip,value):
test_4=urllib.quote(value)
test_1='http://'+ip+'/solr/collection1/select?q=content:'+test_4+'&wt=json&indent=true'
#os.popen('curl %s'%test_1)
buf=cStringIO.StringIO()
c=pycurl.Curl()
c.setopt(c.URL,test_1)
c.setopt(c.WRITEFUNCTION,buf.write)
c.perform()
print buf.getvalue()
buf.close()
if __name__ == '__main__':
c=0
ss=sys.argv[1]
dict={'1':'排','2':'毒','3':'我','4':'有','5':'我','6':'选','7':'择','8':'之','9':'排','10':'毒','11':'方','12':'法','13':'知','14':'多','15':'少','16':'老','1
7':'年','18':'护','19':'理','20':'技','21':'术','22':'进','23':'出','24':'口','25':'业','26':'务','27':'发','28':'展','29':'与','30':'共','31':'享','32':'郑','33':'造'
,'34':'桓','35':'浙','36':'江','37':'大','38':'学','39':'出','40':'版','41':'社','42':'眼','43':'耳','44':'鼻','45':'咽','46':'喉','47':'护','48':'理','49':'许','50':'
建','51':'平','52':'律','53':'程','54':'序','55':'主','56':'义','57':'对','58':'预','59':'防','60':'行','61':'政','62':'的','63':'控','64':'制'}
while True:
for i in range(100):
list_1=[]
for kk in range(random.randint(1,5)):
ee=random.randint(1,64)
dd=dict[str(ee)]
list_1.append(dd)
value="".join(list_1)
print value
time_1=time.time()
print '++++'
a=threading.Thread(target=test,args=(ss,value))
a.start()
time_2=time.time()
d=time_2-time_1
print d