2019-01-28 21:42:28 +08:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import requests
|
|
|
|
|
|
|
|
import gevent
|
|
|
|
|
|
|
|
|
|
|
|
from Queue import Queue
|
|
|
|
|
|
|
|
q=Queue()
|
|
|
|
|
|
|
|
import commands
|
|
|
|
|
|
|
|
from gevent import monkey
|
|
|
|
|
|
|
|
monkey.patch_all()
|
|
|
|
import os
|
2019-10-09 16:59:21 +08:00
|
|
|
out=commands.getoutput('find . -type f')
|
2019-01-28 21:42:28 +08:00
|
|
|
|
|
|
|
lines=out.split("\n")
|
|
|
|
|
|
|
|
for i in lines:
|
|
|
|
q.put(i)
|
|
|
|
|
|
|
|
|
|
|
|
def task():
|
|
|
|
while True:
|
|
|
|
name=q.get(block=False)
|
|
|
|
if name=="":
|
|
|
|
break
|
2019-10-09 16:59:21 +08:00
|
|
|
url = 'http://10.1.5.20:8080/group1/upload'
|
2019-01-28 21:42:28 +08:00
|
|
|
files = {'file': open(name, 'rb')}
|
2019-01-28 21:56:35 +08:00
|
|
|
options = {'output': 'json', 'path': '', 'scene': ''}
|
|
|
|
try:
|
|
|
|
r = requests.post(url, files=files)
|
|
|
|
except Exception as er:
|
|
|
|
print(er)
|
2019-01-28 21:42:28 +08:00
|
|
|
|
|
|
|
th=[]
|
|
|
|
for i in range(200):
|
|
|
|
th.append(gevent.spawn(task))
|
|
|
|
gevent.joinall(th)
|
|
|
|
|