def _post_payload_worker(self, context, payload, api_key, call_plugins_later_func=None): # This function runs on worker thread. error, statink_response = UploadToStatInk(payload, api_key, self.url_statink_v1_battle, self.show_response_enabled, (self.dry_run == 'server')) if not call_plugins_later_func: return # Trigger a event. if error: call_plugins_later_func( 'on_output_statink_submission_error', params=statink_response, context=context ) elif statink_response.get('id', 0) == 0: call_plugins_later_func( 'on_output_statink_submission_dryrun', params=statink_response, context=context ) else: call_plugins_later_func( 'on_output_statink_submission_done', params=statink_response, context=context )
def _post_payload_worker(self, context, payload, api_key): # This function runs on worker thread. error, statink_response = UploadToStatInk(payload, api_key, self.url_statink_v1_battle, self.show_response_enabled, (self.dry_run == 'server')) # Trigger a event. try: call_plugins_func = \ context['engine']['service']['call_plugins_later'] except: call_plugins_func = call_plugins_mock if error: call_plugins_func('on_output_statink_submission_error', params=statink_response) elif statink_response.get('id', 0) == 0: call_plugins_func('on_output_statink_submission_dryrun', params=statink_response) else: call_plugins_func('on_output_statink_submission_done', params=statink_response)
def main(): args = get_args() f = open(args['payload'], 'rb') payload = umsgpack.unpack(f) f.close() url = 'https://stat.ink/api/v1/battle' api_key = (args['api_key'] or IkaConfig.OUTPUT_ARGS['StatInk']['api_key']) error, response = UploadToStatInk(payload, api_key, url, args['video_id']) print(response.get('url'))