akinv commited on
Commit
71fdc3d
1 Parent(s): f6f346e
Files changed (2) hide show
  1. Service.py +7 -2
  2. handler.py +1 -1
Service.py CHANGED
@@ -12,9 +12,10 @@ urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
12
 
13
 
14
  class Service:
15
- def __init__(self, orderId, hash):
16
  load_dotenv()
17
 
 
18
  self.service_endpoint = os.getenv('SERVICE_ENDPOINT')
19
  self.app_dir = os.getenv('APP_DIR')
20
  self.instance_dir = os.getenv('INSTANCE_DIR')
@@ -136,8 +137,12 @@ class Service:
136
  headers['Accept'] = 'application/json'
137
 
138
  files = {'generated': open(self.archive_output_images, 'rb')}
 
 
 
 
139
  try:
140
- requests.post(self.service_endpoint + 'finish',
141
  headers=headers,
142
  data=self.params,
143
  files=files,
 
12
 
13
 
14
  class Service:
15
+ def __init__(self, orderId, hash, isApp):
16
  load_dotenv()
17
 
18
+ self.isApp = isApp
19
  self.service_endpoint = os.getenv('SERVICE_ENDPOINT')
20
  self.app_dir = os.getenv('APP_DIR')
21
  self.instance_dir = os.getenv('INSTANCE_DIR')
 
137
  headers['Accept'] = 'application/json'
138
 
139
  files = {'generated': open(self.archive_output_images, 'rb')}
140
+ endpoint = self.service_endpoint + 'finish'
141
+ if int(self.isApp) == 1:
142
+ endpoint = self.service_endpoint + 'app/finish'
143
+
144
  try:
145
+ requests.post(endpoint,
146
  headers=headers,
147
  data=self.params,
148
  files=files,
handler.py CHANGED
@@ -57,7 +57,7 @@ class EndpointHandler:
57
  ch.basic_ack(delivery_tag=method.delivery_tag)
58
  self.connection.close()
59
  payload = json.loads(body)
60
- service = Service(orderId=payload['orderId'], hash=payload['hash'])
61
  capture_message('Started: ' + payload['orderId'])
62
 
63
  # Download images
 
57
  ch.basic_ack(delivery_tag=method.delivery_tag)
58
  self.connection.close()
59
  payload = json.loads(body)
60
+ service = Service(orderId=payload['orderId'], hash=payload['hash'], isApp=payload['isApp'])
61
  capture_message('Started: ' + payload['orderId'])
62
 
63
  # Download images