main.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. # main.py
  2. import time
  3. import os
  4. import json
  5. import logging
  6. # 导入必要模块
  7. from vs_types import VSPlgConfig, AppointmentType
  8. from plugins.vfs_plugin2 import VfsPlugin2
  9. from vs_log_macros import VSC_INFO, VSC_ERROR
  10. def vfs_test():
  11. # 1. 准备 VFS 业务配置 (free_config)
  12. # 这部分 JSON 对应 VfsPlugin 中读取的配置
  13. cfg_dict = {
  14. "debug": False,
  15. "account": {
  16. "username": "ie_is_cwwyxz@gmail-app.com",
  17. "password": "Or1duEJc5@"
  18. },
  19. "proxy": {
  20. "scheme": "http",
  21. "ip": "127.0.0.1",
  22. "port": 7890
  23. },
  24. "free_config": {
  25. "mission_code": "isl",
  26. "mission_name": "Iceland",
  27. "country_code": "irl",
  28. "country_name": "Ireland",
  29. "culture_code": "en-US",
  30. "language": "en",
  31. "apt_configs": {
  32. "slot.dub.is.tourist": {
  33. "center_name": "Iceland Visa Application Center- Dublin",
  34. "address": "Cunningham House, 130 Francis Street, Dublin, Ireland- DO8 H48R",
  35. "vac_code": "DUB",
  36. "category_name": "C-Visa",
  37. "category_code": "CVI",
  38. "subcategory_name": "Tourism",
  39. "subcategory_code": "OTT"
  40. }
  41. }
  42. },
  43. "session_max_life": 30
  44. }
  45. apt_type_dict = {
  46. "weight": 10,
  47. "routing_key": "slot.dub.is.tourist",
  48. "city": "Dublin",
  49. "visa_type": "Tourist",
  50. "country": "Iceland"
  51. }
  52. user_inputs = {
  53. "email": "hujiarui8@gmail.com",
  54. "phone": "07843900464",
  55. "gender": "female",
  56. "birthday": "1995-12-15",
  57. "last_name": "Hu",
  58. "first_name": "Jiarui",
  59. "nationality": "China",
  60. "passport_no": "EP9863641",
  61. "_admin_bypass": {
  62. "at": "2026-02-08T14:52:59.454636",
  63. "by": "usr-db8f814c",
  64. "reason": "admin manual order",
  65. "enabled": True
  66. },
  67. "expected_end_date": "2023-03-15",
  68. "phone_country_code": "44",
  69. "expected_start_date": "2023-02-25",
  70. "passport_expiry_date": "2035-09-17",
  71. "social_media_account": "淘宝-yayale95778240"
  72. }
  73. apt_type = AppointmentType(**apt_type_dict)
  74. config = VSPlgConfig(**cfg_dict)
  75. # 7. 启动
  76. try:
  77. VSC_INFO("main", "========================================")
  78. VSC_INFO("main", " VFS Python Plugin Tester ")
  79. VSC_INFO("main", "========================================")
  80. vfs_plg = VfsPlugin2("test")
  81. vfs_plg.set_config(config)
  82. vfs_plg.create_session()
  83. slot_info = vfs_plg.query(apt_type)
  84. slot_info.apt_type = apt_type
  85. vfs_plg.book(slot_info, user_inputs)
  86. time.sleep(3600)
  87. except KeyboardInterrupt:
  88. VSC_INFO("main", "Ctrl+C detected. Stopping...")
  89. except Exception as e:
  90. VSC_ERROR("main", "Unexpected Error: %s", str(e))
  91. finally:
  92. # 8. 停止
  93. VSC_INFO("main", "Program finished.")
  94. if __name__ == "__main__":
  95. vfs_test()