# main.py import time import os import json import logging # 导入必要模块 from vs_types import VSPlgConfig, AppointmentType from plugins.vfs_plugin2 import VfsPlugin2 from vs_log_macros import VSC_INFO, VSC_ERROR def vfs_test(): # 1. 准备 VFS 业务配置 (free_config) # 这部分 JSON 对应 VfsPlugin 中读取的配置 cfg_dict = { "debug": False, "account": { "username": "ie_is_cwwyxz@gmail-app.com", "password": "Or1duEJc5@" }, "proxy": { "scheme": "http", "ip": "127.0.0.1", "port": 7890 }, "free_config": { "mission_code": "isl", "mission_name": "Iceland", "country_code": "irl", "country_name": "Ireland", "culture_code": "en-US", "language": "en", "apt_configs": { "slot.dub.is.tourist": { "center_name": "Iceland Visa Application Center- Dublin", "address": "Cunningham House, 130 Francis Street, Dublin, Ireland- DO8 H48R", "vac_code": "DUB", "category_name": "C-Visa", "category_code": "CVI", "subcategory_name": "Tourism", "subcategory_code": "OTT" } } }, "session_max_life": 30 } apt_type_dict = { "weight": 10, "routing_key": "slot.dub.is.tourist", "city": "Dublin", "visa_type": "Tourist", "country": "Iceland" } user_inputs = { "email": "hujiarui8@gmail.com", "phone": "07843900464", "gender": "female", "birthday": "1995-12-15", "last_name": "Hu", "first_name": "Jiarui", "nationality": "China", "passport_no": "EP9863641", "_admin_bypass": { "at": "2026-02-08T14:52:59.454636", "by": "usr-db8f814c", "reason": "admin manual order", "enabled": True }, "expected_end_date": "2023-03-15", "phone_country_code": "44", "expected_start_date": "2023-02-25", "passport_expiry_date": "2035-09-17", "social_media_account": "淘宝-yayale95778240" } apt_type = AppointmentType(**apt_type_dict) config = VSPlgConfig(**cfg_dict) # 7. 启动 try: VSC_INFO("main", "========================================") VSC_INFO("main", " VFS Python Plugin Tester ") VSC_INFO("main", "========================================") vfs_plg = VfsPlugin2("test") vfs_plg.set_config(config) vfs_plg.create_session() slot_info = vfs_plg.query(apt_type) slot_info.apt_type = apt_type vfs_plg.book(slot_info, user_inputs) time.sleep(3600) except KeyboardInterrupt: VSC_INFO("main", "Ctrl+C detected. Stopping...") except Exception as e: VSC_ERROR("main", "Unexpected Error: %s", str(e)) finally: # 8. 停止 VSC_INFO("main", "Program finished.") if __name__ == "__main__": vfs_test()