Replace curl with little python script

This commit is contained in:
Tom Wilkie
2015-05-27 14:51:37 +00:00
parent 04145ce991
commit 8bccec8a78
7 changed files with 48 additions and 14 deletions

View File

@@ -1,6 +1,8 @@
import os
import socket
import requests
import random
from concurrent.futures import ThreadPoolExecutor
from flask import Flask
from redis import Redis
@@ -9,6 +11,8 @@ app = Flask(__name__)
redis = Redis(host='redis', port=6379)
pool = ThreadPoolExecutor(max_workers=10)
goapps = ['http://goapp1:8080/', 'http://goapp2:8080/']
def do_redis():
redis.incr('hits')
return redis.get('hits')
@@ -23,7 +27,7 @@ def do_qotd():
s.close()
def do_search():
r = requests.get('http://goapp:8080/')
r = requests.get(random.choice(goapps))
return r.text