Skip to content
This repository has been archived by the owner on Jan 28, 2020. It is now read-only.

Commit

Permalink
Update server.py
Browse files Browse the repository at this point in the history
fix path
  • Loading branch information
FM1337 authored and architdate committed Mar 13, 2019
1 parent 2326262 commit 0266487
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions server.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/python -u

import subprocess
import os
import io
Expand All @@ -15,6 +17,10 @@ def ensureFolderExists(folder):

def datePath():
return datetime.now().strftime("%Y%m%d")

@app.route('/', methods=['GET'])
def hello():
return "PKSM"

@app.route('/api/legalize', methods = ['POST'])
def api_legalize():
Expand All @@ -28,7 +34,7 @@ def api_legalize():
inputPath = os.path.join(storeFolder, str(uuid.uuid4()) + ".pkx")
with open(inputPath, 'wb') as f:
f.write(request.data)
proc = subprocess.Popen(['CoreConsole/bin/Debug/CoreConsole.exe', '-alm', '--version', request.headers.get('Version'), '-i', inputPath], stdout=subprocess.PIPE, shell=True)
proc = subprocess.Popen(['CoreConsole\\bin\\Debug\\CoreConsole.exe', '-alm', '--version', request.headers.get('Version'), '-i', inputPath], stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
with open(inputPath, 'rb') as f:
pkx = f.read()
Expand All @@ -39,4 +45,4 @@ def api_legalize():

if __name__ == '__main__':
ensureFolderExists(DIR_OUTPUT)
app.run(host='0.0.0.0', port=5000)
app.run(host='0.0.0.0', port=5000)

0 comments on commit 0266487

Please sign in to comment.