small changes to run module

This commit is contained in:
2014-10-30 14:37:05 +01:00
parent d1a5bcdc45
commit 50d9f023cd
2 changed files with 8 additions and 4 deletions

View File

@@ -2,7 +2,10 @@
import requests import requests
with open('config.json', 'r') as config: import os
MODULE_DIR = os.path.dirname(__file__)
with open(os.path.join(MODULE_DIR, 'config.json'), 'r') as config:
import json import json
config = json.load(config) config = json.load(config)
@@ -15,8 +18,9 @@ def request_url(path):
#print (r.json()) #print (r.json())
payload = { payload = {
'filepath': 'pro', 'filepath': 'shots',
'command' : 'info'} 'command' : 'info',
}
r = requests.get(request_url('/file'), params=payload, auth=('bam', 'bam'), stream=True) r = requests.get(request_url('/file'), params=payload, auth=('bam', 'bam'), stream=True)
local_filename = payload['filepath'].split('/')[-1] local_filename = payload['filepath'].split('/')[-1]

View File

@@ -122,7 +122,7 @@ class FileAPI(Resource):
log = r.log_default(None, None, 5, filepath) log = r.log_default(None, None, 5, filepath)
log = [l for l in log] log = [l for l in log]
return jsonify( return jsonify(
filepath=filepath, filepath=filepath,
log=log) log=log)