def generate_build_params(form: dict, root_bundle: str) -> dict: try: version_code = str(validate_version(form["version_code"])).strip() version_name = str(validate_version(form["version_name"])).strip() email = str(validate_email(form["email"])).strip() ios_company_name = str(validate_field( form["ios_company_name"])).strip() is_build = str_to_bool(validate_field(form["build_market"])) is_create_app = str_to_bool(form["create_app"]) id_build_email = str(validate_email(form["build_email"])).strip() id_company_id = str(validate_field(form["company_id"])).strip() branch = str(validate_field(form["branch"])).strip() except BaseError as e: raise e build_params = { build_params_scheme.id_need_build: is_build, build_params_scheme.id_create_app: is_create_app, build_params_scheme.id_need_clear: True, build_params_scheme.id_def_bundle: root_bundle, build_params_scheme.id_version_code: version_code, build_params_scheme.id_version_name: version_name, build_params_scheme.id_email: email, build_params_scheme.ios_company_name: ios_company_name, build_params_scheme.id_build_email: id_build_email, build_params_scheme.branch: branch, build_params_scheme.id_company_id: id_company_id } return build_params
def __init__(self, application, theme, params): self.application: Application = application self.theme = theme logging.debug(application) logging.debug(theme) # Build params self.need_build = validate_field( params[build_params_scheme.id_need_build]) self.need_clear = validate_field( params[build_params_scheme.id_need_clear]) self.create_app = validate_field( params[build_params_scheme.id_create_app]) self.version_name = validate_field( params[build_params_scheme.id_version_name]) self.version_code = validate_field( params[build_params_scheme.id_version_code]) self.bundle = validate_field(params[build_params_scheme.id_def_bundle]) self.email = validate_field(params[build_params_scheme.id_email]) self.ios_company_name = validate_field( params[build_params_scheme.ios_company_name]) self.id_build_email = validate_field( params[build_params_scheme.id_build_email]) self.id_company_id = validate_field( params[build_params_scheme.id_company_id]) # Build paths self.finish_path = self.get_final_path(application.bundle_ios) self.params_path = self.get_ios_params_path(self.finish_path) self.constants_path = self.get_ios_constant_path(self.finish_path) self.launch_screen_path = self.get_ios_launch_path(self.finish_path) self.res_path = merge(config.RES_PATH, application.bundle) self.country = am.get_country(application.country) self.new_bundle = application.bundle_ios
def generate_build_config(form: dict, index: int) -> BuildConfig: try: version_code = int(validate_version(form["version_code"])) version_name = str(validate_version(form["version_name"])).strip() email = str(validate_email(form["email"])).strip() build_type = str(validate_field(form["build_type"])).strip() ios_company_name = str(validate_field( form["ios_company_name"])).strip() build_market = str_to_bool(validate_field(form["build_market"])) is_create_app = str_to_bool(form["create_app"]) id_build_email = str(validate_email(form["build_email"])).strip() id_company_id = str(validate_field(form["company_id"])).strip() branch = str(validate_field(form["branch"])).strip() except BaseError as e: raise e return BuildConfig(build_type=build_type, build_market=build_market, create_app=is_create_app, email=email, app_id=index, version_code=version_code, version_name=version_name, ios_company_name=ios_company_name, branch=branch, build_email=id_build_email, company_id=id_company_id)
def app_build(): if request.method == api.post: logging.info(request.form) try: form = request.form build_type = validate_field(form["build_type"]) index = validate_field(form["id"]) is_ios: bool = False is_android: bool = False if build_type == "ios": is_ios = True elif build_type == "android": is_android = True # create_app: bool = str_to_bool(validate_field(form["create_app"])) build_params = build_helper.generate_build_params(form, config.ROOT_BUNDLE) except BaseError as e: traceback.print_exc() error_response = e.generate_error() logging.error(error_response) return error_response # Variables for database app_db = ApplicationRepository(config.DATA_URL) theme_db = theme_rep.ThemeRepository(config.DATA_URL) application = app_db.get_app_by_id(index) # App DICT from DB theme = theme_db.get_theme_by_hash(application.theme) # Theme from DB res_man = ResourceManager(config.RESOURCE_PATH, config.TEMP_PATH) res_saved = res_man.validate_resources(application.bundle) print(res_saved) producer = BuildProducer(config.QUEUE_NAME) producer.connect() if is_ios: message = BuildProducer.generate_message(application, theme, build_params, build_type="ios") logging.info("For rabbit producer generated Message {%s}" % message) producer.send(message=message) elif is_android: message = BuildProducer.generate_message(application, theme, build_params, build_type="android") logging.info("For rabbit producer generated Message {%s}" % message) producer.send(message=message) producer.disconnect() # application.status = Application.STATUS_WAITING app_db.update_app(application) return BuildAction.create_action_build(action=BaseAction.REDIRECT_ACTION, subcode=BuildAction.BUILD_CREATED, data=BuildAction.data_created_build(api.get_build_info))
def build_update_driver_new(): # Variables for database app_db = DriverApplicationNewRepository(config.DATA_URL) logging.info("Build updating " + str(request.form)) data = request.form app_index = validate_field(data["app_index"]) status = validate_field(data["status"]) # TODO REWORK THIS! It is not best practices application = app_db.get_app_by_id(app_index) application.status = status app_db.update_app(application) return ""
def execute_client(result_json, method, build_type, ch): application: Application try: app_json = result_json["application"] application = app_helper.parse_app_by_json(app_json) params = result_json["params"] theme_json = result_json["theme"] branch = validate_field(params[build_params_scheme.branch]) send_message( f"[Begin] Началась сборка приложения {application.app_name} | {str(application.bundle)} | {str(branch)} | {str(build_type).upper()}" ) if os.path.exists(config.MASTER_PATH[build_type]): shutil.rmtree(config.MASTER_PATH[build_type]) git_man.git_clone(config.REPOSITORIES[build_type], config.MASTER_PATH[build_type], branch=branch) # git_man.git_pull(config.MASTER_PATH[build_type]) if build_type == LauncherFactory.BUILD_IOS: git_man.generate_pods(config.MASTER_PATH[build_type], config.COMMON_ASSETS_PATH) builder: Launcher = LauncherFactory.create_launcher( application=application, theme=theme_json, params=params, build_type=build_type) MobileApi.post_build_status(config.BASE_URL, application.id, Application.STATUS_EXECUTING, build_type) builder.generate() MobileApi.post_build_status(config.BASE_URL, application.id, Application.STATUS_SUCCESS, build_type) send_message( f"[Success] Приложение {application.app_name} | {str(application.bundle)} | {str(build_type).upper()} | {str(branch)} было успешно собрано" ) ch.basic_ack(delivery_tag=method.delivery_tag) except Exception as e: ch.basic_ack(delivery_tag=method.delivery_tag) if application: MobileApi.post_build_status(config.BASE_URL, application.id, Application.STATUS_ERROR, build_type) if isinstance(e, BaseError): error_trace = e.data else: error_trace = traceback.format_exc() send_message( f"[Error] При сборке приложения {application.app_name} | {str(application.bundle)} | {str(branch)} произошла ошибка\n{error_trace}" ) traceback.print_exc()
def generate_build(form: dict, app_id: int, theme_id: int, build_type: str, priority: int) -> Build: try: version_code = str(validate_version(form["version_code"])) version_name = str(validate_version(form["version_name"])) email = str(validate_email(form["email"])) is_build = str_to_bool(validate_field(form["build_market"])) is_create_app = str_to_bool(form["create_app"]) build = Build(app_id=app_id, is_build=is_build, is_create=is_create_app, version_code=version_code, version_name=version_name, is_clear=False, email=email, build_type=build_type, theme_id=theme_id, status=Build.STATUS_WAITING, priority=priority, default_bundle='com.gootax.client') return build except BaseError as error: raise error
def app_build_test(): if request.method == api.post: logging.info(request.form) try: form = request.form build_type = validate_field(form["build_type"]) index = validate_field(form["id"]) except BaseError as e: traceback.print_exc() error_response = e.generate_error() logging.error(error_response) return error_response # Variables for database app_db = ApplicationRepository(config.DATA_URL) theme_db = theme_rep.ThemeRepository(config.DATA_URL) application = app_db.get_app_by_id(index) # App DICT from DB theme = theme_db.get_theme_by_hash(application.theme) # Theme from DB res_man = ResourceManager(config.RESOURCE_PATH, config.TEMP_PATH) try: res_valid = res_man.validate_resources(application.bundle) except BaseError as e: traceback.print_exc() error_response = e.generate_error() logging.error(error_response) return error_response if res_valid: build_rep = BuildRepository(config.DATA_URL) active_builds_count = build_rep.get_active_builds_count() + 1 build = build_helper.generate_build(form=form, app_id=application.app_id, build_type=build_type, theme_id=theme.id, priority=active_builds_count) build_rep.create_build(build) application.status = Application.STATUS_WAITING app_db.update_app(application) return BuildAction.create_action_build(action=BaseAction.REDIRECT_ACTION, subcode=BuildAction.BUILD_CREATED, data=BuildAction.data_created_build( api.get_build_info))
def __init__(self, application, params, is_new: bool): # Entity if not is_new: self.application: DriverApplication = application else: self.application: DriverApplicationNew = application self.is_new = is_new # Build params self.need_build = validate_field( params[build_params_scheme.id_need_build]) self.need_clear = validate_field( params[build_params_scheme.id_need_clear]) self.create_app = validate_field( params[build_params_scheme.id_create_app]) self.version_name = validate_field( params[build_params_scheme.id_version_name]) self.version_code = validate_field( params[build_params_scheme.id_version_code]) self.bundle = validate_field(params[build_params_scheme.id_def_bundle]) self.email = validate_field(params[build_params_scheme.id_email]) # Build paths self.finish_path = self.get_final_path(application.bundle, is_new) self.params_path = self.get_android_params_path( self.finish_path, application.bundle, is_new) self.res_path = merge(config.RES_PATH, application.bundle) self.new_bundle = application.bundle
def __init__(self, application, theme, params): # Entity self.application: Application = application self.theme: Theme = theme # Build params self.need_build = validate_field( params[build_params_scheme.id_need_build]) self.need_clear = validate_field( params[build_params_scheme.id_need_clear]) self.create_app = validate_field( params[build_params_scheme.id_create_app]) self.version_name = validate_field( params[build_params_scheme.id_version_name]) self.version_code = validate_field( params[build_params_scheme.id_version_code]) self.bundle = validate_field(params[build_params_scheme.id_def_bundle]) self.email = validate_field(params[build_params_scheme.id_email]) # Build paths self.finish_path = self.get_final_path(application.bundle) self.params_path = self.get_android_params_path( self.finish_path, application.bundle) self.res_path = merge(config.RES_PATH, application.bundle) self.country = am.get_country(application.country) self.new_bundle = application.bundle
def driver_app_build(): if request.method == api.post: logging.info(request.form) try: form = request.form build_type = validate_field(form["build_type"]) index = validate_field(form["id"]) from backend.model.helper import build_helper build_params = build_helper.generate_driver_build( form, config.ROOT_BUNDLE_DRIVER) logging.info(build_params) except BaseError as e: traceback.print_exc() error_response = e.generate_error() logging.error(error_response) return error_response # Variables for database app_db = DriverApplicationRepository(config.DATA_URL) application = app_db.get_app_by_id(index) # App DICT from DB res_man = ResourceManager(config.RESOURCE_PATH, config.TEMP_PATH) res_saved = res_man.validate_resources(application.bundle) print(res_saved) producer = BuildProducer(config.QUEUE_NAME) producer.connect() message = BuildProducer.generate_driver_message(application, build_params, build_type=build_type) logging.info("For rabbit producer generated Message {%s}" % message) producer.send(message=message) producer.disconnect() app_db.update_app(application) return BuildAction.create_action_build( action=BaseAction.REDIRECT_ACTION, subcode=BuildAction.BUILD_CREATED, data=BuildAction.data_created_build(api_driver_app_list))
def app_build_test(): if request.method == api.post: logging.info(request.form) try: form = request.form build_id = validate_field(form["build_id"]) from_priority = validate_field(form["from_priority"]) to_priority = validate_field(form["to_priority"]) build_rep = BuildRepository(config.DATA_URL) builds = build_rep.get_active_desc_priority() except BaseError as e: traceback.print_exc() error_response = e.generate_error() logging.error(error_response) return error_response return ""
def get_project_exist(): try: bundle_ios = validate_field(request.args["bundle_ios"]) bundle_android = validate_field(request.args["bundle_android"]) path = AndroidLauncher.get_final_path(bundle_android) is_android_existing = os.path.exists(path) path = IosLauncher.get_final_path(bundle_ios) is_ios_existing = os.path.exists(path) return BaseAction.create_action( action=BaseAction.CHECK_ACTION, code=BaseAction.SUCCESS_CODE, subcode=BaseAction.CHECK_CREATED_SUBCODE, data={ "is_android_existing": is_android_existing, "is_ios_existing": is_ios_existing }) except BaseError as error: return error.generate_error()
def generate_build_params(params: dict) -> dict: try: app_id_valid = validate_field(params['i']) platform = validate_field(params['p']) version_code_valid = validate_version(validate_field(params['v'])) version_number_valid = validate_version(validate_field(params['n'])) email_valid = validate_email(parse_email(params.get('m'))) is_create_app_valid = True if platform == 'android': is_build_android_valid = True is_android_valid = True is_build_ios_valid = False is_ios_valid = False elif platform == 'ios': is_build_android_valid = False is_android_valid = False is_build_ios_valid = True is_ios_valid = True else: raise AttributeError build_params = { app_id: app_id_valid, is_ios: is_ios_valid, is_android: is_android_valid, version_code: version_code_valid, version_name: version_number_valid, email: email_valid, build_android: is_build_android_valid, build_ios: is_build_ios_valid, is_create_app: is_create_app_valid, } except BaseError as e: raise e return json.dumps(build_params)
def app_delete(): if request.method == api.post: form = request.form index = validate_field(form["id"]) app_db = DriverApplicationRepository(config.DATA_URL) res_man = ResourceManager(config.RES_PATH, config.TEMP_PATH) application = app_db.get_app_by_id(index) # App DICT from DB app_db.delete_app(application) res_man.delete_res(application.bundle) # Delete app res return redirect(api.get_app_list)
from builder.lib.model.entity.theme import Theme from std.std import validate_field, hashing VALIDATE_FIELDS = ['splash_bg', 'accent_bg', 'accent_text', 'menu_bg', 'menu_text', 'menu_stroke', 'content_bg', 'content_text', 'content_stroke', 'content_icon_bg', 'content_icon_stroke', 'map_marker_bg', 'map_marker_bg_stroke', 'map_marker_text', 'map_car_bg', 'accent_bg_tariff'` def parse_theme(json_theme: dict) -> Theme: validate_field(json_theme) splash_bg = validate_field(json_theme['splash_bg']) accent_bg = validate_field(json_theme['accent_bg']) accent_text = validate_field(json_theme['accent_text']) menu_bg = validate_field(json_theme['menu_bg']) menu_text = validate_field(json_theme['menu_text']) menu_stroke = validate_field(json_theme['menu_stroke']) content_bg = validate_field(json_theme['content_bg']) content_text = validate_field(json_theme['content_text']) content_stroke = validate_field(json_theme['content_stroke']) content_icon_bg = validate_field(json_theme['content_icon_bg']) content_icon_stroke = validate_field(json_theme['content_icon_stroke']) map_marker_bg = validate_field(json_theme['map_marker_bg']) map_marker_bg_stroke = validate_field(json_theme['map_marker_bg_stroke']) map_marker_text = validate_field(json_theme['map_marker_text']) map_car_bg = validate_field(json_theme['map_car_bg']) accent_bg_tariff = validate_field(json_theme['accent_bg_tariff']) color_text_button_inner = validate_field(json_theme['color_text_button_inner']) color_background_button_inner = validate_field(json_theme['color_background_button_inner']) # in last rabbit, when all field validated need calculate hash | SORT -> STR -> HASH
def parse_theme(json_theme: dict) -> Theme: validate_field(json_theme)
def parse_theme(json_theme: dict) -> Theme: validate_field(json_theme) splash_bg = validate_field(json_theme['splash_bg']) accent_bg = validate_field(json_theme['accent_bg']) accent_text = validate_field(json_theme['accent_text']) menu_bg = validate_field(json_theme['menu_bg']) menu_text = validate_field(json_theme['menu_text']) menu_stroke = validate_field(json_theme['menu_stroke']) content_bg = validate_field(json_theme['content_bg']) content_text = validate_field(json_theme['content_text']) content_stroke = validate_field(json_theme['content_stroke']) content_icon_bg = validate_field(json_theme['content_icon_bg']) content_icon_stroke = validate_field(json_theme['content_icon_stroke']) map_marker_bg = validate_field(json_theme['map_marker_bg']) map_marker_bg_stroke = validate_field(json_theme['map_marker_bg_stroke']) map_marker_text = validate_field(json_theme['map_marker_text']) map_car_bg = validate_field(json_theme['map_car_bg']) accent_bg_tariff = validate_field(json_theme['accent_bg_tariff']) color_text_button_inner = validate_field( json_theme['color_text_button_inner']) color_background_button_inner = validate_field( json_theme['color_background_button_inner']) # in last rabbit, when all field validated need calculate hash | SORT -> STR -> HASH theme_hash = get_theme_hash(json_theme) return Theme(splash_bg=splash_bg, accent_bg=accent_bg, accent_text=accent_text, menu_bg=menu_bg, menu_text=menu_text, menu_stroke=menu_stroke, content_bg=content_bg, content_text=content_text, content_stroke=content_stroke, content_icon_bg=content_icon_bg, content_icon_stroke=content_icon_stroke, map_marker_bg=map_marker_bg, map_marker_bg_stroke=map_marker_bg_stroke, map_marker_text=map_marker_text, map_car_bg=map_car_bg, accent_bg_tariff=accent_bg_tariff, hash=theme_hash, color_background_button_inner=color_background_button_inner, color_text_button_inner=color_text_button_inner)
def parse_app_by_json(parsed_json: dict) -> DriverApplicationNew: id = validate_field(parsed_json['id']) app_name = validate_field(parsed_json['app_name']) tenant_name = validate_field(parsed_json['tenant_name']) bundle = validate_field(parsed_json['bundle']) host = validate_field(parsed_json['host']) new_host = validate_field(parsed_json['new_host']) chat_host = validate_field(parsed_json['chat_host']) geocode_host = validate_field(parsed_json['geocode_host']) push_key = validate_field(parsed_json['push_key']) google_map_key = validate_field(parsed_json['google_map_key']) app_type = validate_field(parsed_json['app_type']) version_app = validate_field(parsed_json['version_app']) use_worker_reg = validate_field(parsed_json['use_worker_reg']) worker_reg_url = validate_field(parsed_json['worker_reg_url']) worker_reg_description = validate_field( parsed_json['worker_reg_description']) worker_reg_button = validate_field(parsed_json['worker_reg_button']) yandex_key = validate_field(parsed_json['yandex_key']) allow_root = validate_field(parsed_json['allow_root']) use_sms_auth = validate_field(parsed_json['use_sms_auth']) return DriverApplicationNew(id=id, app_name=app_name, tenant_name=tenant_name, bundle=bundle, host=host, new_host=new_host, chat_host=chat_host, geocode_host=geocode_host, push_key=push_key, google_map_key=google_map_key, app_type=app_type, version_app=version_app, use_worker_reg=use_worker_reg, worker_reg_url=worker_reg_url, worker_reg_description=worker_reg_description, worker_reg_button=worker_reg_button, yandex_key=yandex_key, allow_root=allow_root, use_sms_auth=use_sms_auth)
def parse_app_by_json(app: dict) -> Application: parsed_json = validate_field(app) id = validate_field(parsed_json['id']) app_name = validate_field(parsed_json['app_name']) app_id = validate_field(parsed_json['app_id']) app_sku = validate_field(parsed_json['app_sku']) bundle = validate_field(parsed_json['bundle']) bundle_ios = validate_field(parsed_json['bundle_ios']) api_key = validate_field(parsed_json['api_key']) push_key = validate_field(parsed_json['push_key']) google_map_ios = validate_field(parsed_json['google_map_ios']) metrica_key = validate_field(parsed_json['metrica_key']) google_map = validate_field(parsed_json['google_map']) client_url = validate_field(parsed_json['client_url']) geo_url = validate_field(parsed_json['geo_url']) tenant_id = validate_field(parsed_json['tenant_id']) theme = validate_field(parsed_json['theme']) country = validate_field(parsed_json['country']) autocomplete = validate_field(parsed_json['autocomplete']) reverse_radius = validate_field(parsed_json['reverse_radius']) use_photo = validate_field(parsed_json['use_photo']) photo_type = validate_field(parsed_json['photo_type']) use_calls = validate_field(parsed_json['use_calls']) use_calls_office = validate_field(parsed_json['use_calls_office']) use_calls_driver = validate_field(parsed_json['use_calls_driver']) use_flat = validate_field(parsed_json['use_flat']) use_porch = validate_field(parsed_json['use_porch']) use_street = validate_field(parsed_json['use_street']) use_comment = validate_field(parsed_json['use_comment']) use_pre_orders = validate_field(parsed_json['use_pre_orders']) use_wishes = validate_field(parsed_json['use_wishes']) use_detail = validate_field(parsed_json['use_detail']) use_one_address = validate_field(parsed_json['use_one_address']) use_search = validate_field(parsed_json['use_search']) lang = validate_field(parsed_json['lang']) use_calendars = validate_field(parsed_json['use_calendars']) default_calendar = validate_field(parsed_json['default_calendar']) use_cars = validate_field(parsed_json['use_cars']) use_country = validate_field(parsed_json['use_country']) use_referral = validate_field(parsed_json['use_referral']) is_demo = validate_field(parsed_json['is_demo']) is_full_splash = validate_field(parsed_json['is_full_splash']) use_review_block = validate_field(parsed_json['use_review_block']) max_one_address = validate_field(parsed_json['max_one_address']) with_edit_order = validate_field(parsed_json['with_edit_order']) shown_client_id = validate_field(parsed_json['shown_client_id']) use_review_detail = validate_field(parsed_json['use_review_detail']) use_review_for_rejected = validate_field( parsed_json['use_review_for_rejected']) use_profile_data = validate_field(parsed_json['use_profile_data']) default_language = validate_field(parsed_json['default_language']) with_show_cars = validate_field(parsed_json['with_show_cars']) car_radius = validate_field(parsed_json['car_radius']) use_public_transport = validate_field(parsed_json['use_public_transport']) web_application_url = validate_field(parsed_json['web_application_url']) web_application_title = validate_field( parsed_json['web_application_title']) use_web_application = validate_field(parsed_json['use_web_application']) use_multi_callcost = validate_field(parsed_json['use_multi_callcost']) is_let_reject_after_assigned = validate_field( parsed_json['is_let_reject_after_assigned']) use_courier_form = validate_field(parsed_json['use_courier_form']) use_google = validate_field(parsed_json['use_google']) use_google_hybrid = validate_field(parsed_json['use_google_hybrid']) use_yandex_map = validate_field(parsed_json['use_yandex_map']) use_osm_map = validate_field(parsed_json['use_osm_map']) use_gis_map = validate_field(parsed_json['use_gis_map']) default_map = validate_field(parsed_json['default_map']) use_payment_card = validate_field(parsed_json['use_payment_card']) use_payment_corp = validate_field(parsed_json['use_payment_corp']) use_payment_cash = validate_field(parsed_json['use_payment_cash']) use_payment_bonus = validate_field(parsed_json['use_payment_bonus']) use_payment_personal = validate_field(parsed_json['use_payment_personal']) show_company_balance = validate_field(parsed_json['show_company_balance']) return Application( id=id, app_name=app_name, app_id=app_id, app_sku=app_sku, bundle=bundle, api_key=api_key, push_key=push_key, metrica_key=metrica_key, client_url=client_url, theme=theme, geo_url=geo_url, reverse_radius=reverse_radius, bundle_ios=bundle_ios, google_map_ios=google_map_ios, tenant_id=tenant_id, country=country, google_map=google_map, autocomplete=autocomplete, use_photo=use_photo, photo_type=photo_type, use_calls=use_calls, use_calls_office=use_calls_office, use_calls_driver=use_calls_driver, use_flat=use_flat, use_porch=use_porch, use_street=use_street, use_comment=use_comment, use_pre_orders=use_pre_orders, use_wishes=use_wishes, use_detail=use_detail, use_one_address=use_one_address, use_search=use_search, default_language=default_language, lang=lang, use_calendars=use_calendars, default_calendar=default_calendar, use_cars=use_cars, use_country=use_country, is_demo=is_demo, use_referral=use_referral, use_review_block=use_review_block, is_full_splash=is_full_splash, max_one_address=max_one_address, shown_client_id=shown_client_id, use_review_detail=use_review_detail, use_review_for_rejected=use_review_for_rejected, with_edit_order=with_edit_order, use_public_transport=use_public_transport, web_application_url=web_application_url, web_application_title=web_application_title, use_web_application=use_web_application, use_profile_data=use_profile_data, use_multi_callcost=use_multi_callcost, is_let_reject_after_assigned=is_let_reject_after_assigned, use_google=use_google, use_google_hybrid=use_google_hybrid, use_yandex_map=use_yandex_map, use_osm_map=use_osm_map, use_gis_map=use_gis_map, default_map=default_map, with_show_cars=with_show_cars, car_radius=car_radius, use_courier_form=use_courier_form, use_payment_card=use_payment_card, use_payment_corp=use_payment_corp, use_payment_cash=use_payment_cash, use_payment_bonus=use_payment_bonus, show_company_balance=show_company_balance, use_payment_personal=use_payment_personal)
def parse_app_by_json(parsed_json: dict) -> DriverApplication: app_name = validate_field(parsed_json['app_name']) tenant_name = validate_field(parsed_json['tenant_name']) bundle = validate_field(parsed_json['bundle']) host = validate_field(parsed_json['host']) new_host = validate_field(parsed_json['new_host']) chat_host = validate_field(parsed_json['chat_host']) geocode_host = validate_field(parsed_json['geocode_host']) push_key = validate_field(parsed_json['push_key']) google_map_key = validate_field(parsed_json['google_map_key']) app_type = validate_field(parsed_json['app_type']) version_app = validate_field(parsed_json['version_app']) return DriverApplication(app_name=app_name, tenant_name=tenant_name, bundle=bundle, host=host, new_host=new_host, chat_host=chat_host, geocode_host=geocode_host, push_key=push_key, google_map_key=google_map_key, app_type=app_type, version_app=version_app)