| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import json
- from client.ApolloClient import ApolloClient
- client = ApolloClient("http://apolloconfig-internal.piaoquantv.com")
- def main():
- config_str = client.get_value(
- app_id="crawler-scheduler",
- cluster="default",
- namespace="application",
- key="hot.video.keywords.provide.task.config"
- )
- new_config_json = {}
- config_json = json.loads(config_str)
- account_filters = config_json['accountFilterMap']
- content_filters = config_json['contentFilterMap']
- pre_filter_threshold = config_json['preFilterThreshold']
- prompt_id = config_json['promptId']
- model_value_config = config_json['modelValueConfig']
- pre_filter_search_accounts = config_json['preFilterSearchAccountIds']
- for merge_cate2 in config_json['mergeCate2PatternPlanIdMap']:
- type_json = config_json['mergeCate2PatternPlanIdMap'][merge_cate2]
- if merge_cate2 not in new_config_json:
- new_config_json[merge_cate2] = {}
- new_config_json[merge_cate2] = {
- "accountFilters": account_filters,
- "contentFilters": content_filters,
- "preFilterThreshold": pre_filter_threshold,
- "promptId": prompt_id,
- "modelValueConfig": model_value_config,
- "patternProducePlanIdsMap": type_json,
- "preFilterSearchAccountIds": pre_filter_search_accounts
- }
- print(json.dumps(new_config_json, indent=4, ensure_ascii=False))
- if __name__ == '__main__':
- main()
|