speedhive-tools 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. speedhive_tools-0.1.0/MANIFEST.in +5 -0
  2. speedhive_tools-0.1.0/PKG-INFO +168 -0
  3. speedhive_tools-0.1.0/README.md +149 -0
  4. speedhive_tools-0.1.0/examples/__init__.py +3 -0
  5. speedhive_tools-0.1.0/examples/__pycache__/__init__.cpython-312.pyc +0 -0
  6. speedhive_tools-0.1.0/examples/__pycache__/export_full_dump.cpython-312.pyc +0 -0
  7. speedhive_tools-0.1.0/examples/__pycache__/extract_laps_to_csv.cpython-312.pyc +0 -0
  8. speedhive_tools-0.1.0/examples/__pycache__/get_event_sessions.cpython-312.pyc +0 -0
  9. speedhive_tools-0.1.0/examples/__pycache__/get_session_laps.cpython-312.pyc +0 -0
  10. speedhive_tools-0.1.0/examples/__pycache__/ndjson_to_sqlite.cpython-312.pyc +0 -0
  11. speedhive_tools-0.1.0/examples/export_announcements_by_org.py +185 -0
  12. speedhive_tools-0.1.0/examples/export_full_dump.py +409 -0
  13. speedhive_tools-0.1.0/examples/get_event_sessions.py +86 -0
  14. speedhive_tools-0.1.0/examples/get_session_laps.py +73 -0
  15. speedhive_tools-0.1.0/examples/get_session_results.py +119 -0
  16. speedhive_tools-0.1.0/examples/list_events_by_org.py +205 -0
  17. speedhive_tools-0.1.0/examples/processing/README_PROCESSING.md +80 -0
  18. speedhive_tools-0.1.0/examples/processing/__init__.py +3 -0
  19. speedhive_tools-0.1.0/examples/processing/__pycache__/__init__.cpython-312.pyc +0 -0
  20. speedhive_tools-0.1.0/examples/processing/__pycache__/extract_announcements_to_csv.cpython-312.pyc +0 -0
  21. speedhive_tools-0.1.0/examples/processing/__pycache__/extract_laps_to_csv.cpython-312.pyc +0 -0
  22. speedhive_tools-0.1.0/examples/processing/__pycache__/extract_sessions_to_csv.cpython-312.pyc +0 -0
  23. speedhive_tools-0.1.0/examples/processing/__pycache__/ndjson_to_sqlite.cpython-312.pyc +0 -0
  24. speedhive_tools-0.1.0/examples/processing/__pycache__/processor_cli.cpython-312.pyc +0 -0
  25. speedhive_tools-0.1.0/examples/processing/extract_announcements_to_csv.py +85 -0
  26. speedhive_tools-0.1.0/examples/processing/extract_laps_to_csv.py +78 -0
  27. speedhive_tools-0.1.0/examples/processing/extract_sessions_to_csv.py +92 -0
  28. speedhive_tools-0.1.0/examples/processing/ndjson_to_sqlite.py +68 -0
  29. speedhive_tools-0.1.0/examples/processing/processor_cli.py +125 -0
  30. speedhive_tools-0.1.0/mylaps_client/.gitignore +23 -0
  31. speedhive_tools-0.1.0/mylaps_client/.ruff_cache/.gitignore +2 -0
  32. speedhive_tools-0.1.0/mylaps_client/.ruff_cache/0.14.8/1221433885022394569 +0 -0
  33. speedhive_tools-0.1.0/mylaps_client/.ruff_cache/CACHEDIR.TAG +1 -0
  34. speedhive_tools-0.1.0/mylaps_client/README.md +124 -0
  35. speedhive_tools-0.1.0/mylaps_client/event_results_client/__init__.py +8 -0
  36. speedhive_tools-0.1.0/mylaps_client/event_results_client/__pycache__/__init__.cpython-312.pyc +0 -0
  37. speedhive_tools-0.1.0/mylaps_client/event_results_client/__pycache__/client.cpython-312.pyc +0 -0
  38. speedhive_tools-0.1.0/mylaps_client/event_results_client/__pycache__/errors.cpython-312.pyc +0 -0
  39. speedhive_tools-0.1.0/mylaps_client/event_results_client/__pycache__/types.cpython-312.pyc +0 -0
  40. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/__init__.py +1 -0
  41. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/__pycache__/__init__.cpython-312.pyc +0 -0
  42. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/account_controller/__init__.py +1 -0
  43. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/account_controller/get_event_list_2.py +125 -0
  44. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/account_controller/get_event_list_5.py +125 -0
  45. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/account_controller/get_session_list_1.py +125 -0
  46. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/account_controller/get_session_list_3.py +116 -0
  47. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/account_controller/get_session_list_by_event_id.py +124 -0
  48. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/championship_controller/__init__.py +1 -0
  49. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/championship_controller/get_championship.py +92 -0
  50. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/championship_controller/get_championship_1.py +92 -0
  51. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/championship_controller/get_championship_csv.py +92 -0
  52. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/championship_upload_controller/__init__.py +1 -0
  53. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/championship_upload_controller/process_upload_request.py +97 -0
  54. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/championship_upload_controller/process_upload_request_1.py +97 -0
  55. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/chip_migration_controller/__init__.py +1 -0
  56. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/chip_migration_controller/add.py +98 -0
  57. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/chip_migration_controller/add_for_member.py +103 -0
  58. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/chip_migration_controller/disconnect.py +97 -0
  59. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/chip_migration_controller/get_chip.py +92 -0
  60. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/chip_migration_controller/get_chip_used.py +92 -0
  61. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/event_controller/__init__.py +1 -0
  62. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/event_controller/__pycache__/__init__.cpython-312.pyc +0 -0
  63. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/event_controller/__pycache__/get_event_list_1.cpython-312.pyc +0 -0
  64. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/event_controller/__pycache__/get_session_list.cpython-312.pyc +0 -0
  65. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/event_controller/delete_event.py +110 -0
  66. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/event_controller/get_event.py +116 -0
  67. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/event_controller/get_event_1.py +92 -0
  68. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/event_controller/get_event_list_1.py +151 -0
  69. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/event_controller/get_event_list_4.py +142 -0
  70. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/event_controller/get_events_updated_after.py +116 -0
  71. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/event_controller/get_session_list.py +107 -0
  72. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/event_controller/get_session_list_2.py +92 -0
  73. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/member_controller/__init__.py +1 -0
  74. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/member_controller/add_member.py +100 -0
  75. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/member_controller/find_member.py +106 -0
  76. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/organization_controller/__init__.py +1 -0
  77. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/organization_controller/__pycache__/__init__.cpython-312.pyc +0 -0
  78. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/organization_controller/__pycache__/get_event_list.cpython-312.pyc +0 -0
  79. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/organization_controller/__pycache__/get_event_list_3.cpython-312.pyc +0 -0
  80. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/organization_controller/__pycache__/get_organization.cpython-312.pyc +0 -0
  81. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/organization_controller/__pycache__/get_organization_1.cpython-312.pyc +0 -0
  82. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/organization_controller/get_championship_list.py +116 -0
  83. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/organization_controller/get_championship_list_1.py +116 -0
  84. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/organization_controller/get_event_list.py +116 -0
  85. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/organization_controller/get_event_list_3.py +116 -0
  86. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/organization_controller/get_organization.py +92 -0
  87. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/organization_controller/get_organization_1.py +92 -0
  88. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/progress_controller/__init__.py +1 -0
  89. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/progress_controller/off_line_upload_progress.py +117 -0
  90. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/progress_controller/off_line_upload_progress_1.py +117 -0
  91. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/progress_controller/upload_login.py +99 -0
  92. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/progress_controller/upload_login_1.py +99 -0
  93. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/progress_controller/upload_progress_2.py +97 -0
  94. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/progress_controller/upload_progress_2_1.py +97 -0
  95. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/__init__.py +1 -0
  96. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/__pycache__/__init__.cpython-312.pyc +0 -0
  97. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/__pycache__/get_all_lap_times.cpython-312.pyc +0 -0
  98. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/__pycache__/get_announcements.cpython-312.pyc +0 -0
  99. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/__pycache__/get_classification.cpython-312.pyc +0 -0
  100. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/__pycache__/get_classification_1.cpython-312.pyc +0 -0
  101. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/get_all_lap_times.py +92 -0
  102. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/get_announcements.py +92 -0
  103. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/get_announcements_1.py +92 -0
  104. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/get_classification.py +92 -0
  105. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/get_classification_1.py +92 -0
  106. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/get_lap_chart.py +92 -0
  107. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/get_lap_chart_1.py +92 -0
  108. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/get_lap_csv.py +100 -0
  109. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/get_lap_data_response.py +100 -0
  110. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/get_lap_times.py +107 -0
  111. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/get_session.py +92 -0
  112. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/get_session_1.py +92 -0
  113. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/session_controller/get_session_csv.py +92 -0
  114. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/system_time_controller/__init__.py +1 -0
  115. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/system_time_controller/get_time.py +119 -0
  116. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/__init__.py +1 -0
  117. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_login.py +124 -0
  118. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_login_1.py +124 -0
  119. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_login_10.py +124 -0
  120. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_login_11.py +124 -0
  121. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_login_12.py +124 -0
  122. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_login_13.py +124 -0
  123. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_login_2.py +124 -0
  124. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_login_3.py +124 -0
  125. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_login_4.py +124 -0
  126. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_login_5.py +124 -0
  127. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_login_6.py +124 -0
  128. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_login_7.py +124 -0
  129. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_login_8.py +124 -0
  130. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_login_9.py +124 -0
  131. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_upload.py +97 -0
  132. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_upload_1.py +97 -0
  133. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_upload_10.py +97 -0
  134. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_upload_11.py +97 -0
  135. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_upload_12.py +97 -0
  136. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_upload_13.py +97 -0
  137. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_upload_2.py +97 -0
  138. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_upload_3.py +97 -0
  139. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_upload_4.py +97 -0
  140. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_upload_5.py +97 -0
  141. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_upload_6.py +97 -0
  142. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_upload_7.py +97 -0
  143. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_upload_8.py +97 -0
  144. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/third_party_upload_controller/third_party_upload_9.py +97 -0
  145. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/time_resource/__init__.py +1 -0
  146. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/time_resource/get_system_time.py +119 -0
  147. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/upload_controller/__init__.py +1 -0
  148. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/upload_controller/process_and_persist_request_with_validation.py +106 -0
  149. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/upload_controller/process_and_persist_request_with_validation_1.py +106 -0
  150. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/upload_controller/process_and_persist_request_without_validation.py +106 -0
  151. speedhive_tools-0.1.0/mylaps_client/event_results_client/api/upload_controller/process_and_persist_request_without_validation_1.py +106 -0
  152. speedhive_tools-0.1.0/mylaps_client/event_results_client/client.py +268 -0
  153. speedhive_tools-0.1.0/mylaps_client/event_results_client/errors.py +16 -0
  154. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__init__.py +99 -0
  155. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/__init__.cpython-312.pyc +0 -0
  156. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/announcement_row.cpython-312.pyc +0 -0
  157. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/championship.cpython-312.pyc +0 -0
  158. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/championship_competitor_dto.cpython-312.pyc +0 -0
  159. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/championship_competitor_event_dto.cpython-312.pyc +0 -0
  160. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/championship_competitor_event_round_dto.cpython-312.pyc +0 -0
  161. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/championship_data_dto.cpython-312.pyc +0 -0
  162. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/championship_event_dto.cpython-312.pyc +0 -0
  163. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/championship_event_round_dto.cpython-312.pyc +0 -0
  164. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/championship_model.cpython-312.pyc +0 -0
  165. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/championships.cpython-312.pyc +0 -0
  166. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/chip.cpython-312.pyc +0 -0
  167. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/chip_used.cpython-312.pyc +0 -0
  168. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/country.cpython-312.pyc +0 -0
  169. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/duration.cpython-312.pyc +0 -0
  170. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/event.cpython-312.pyc +0 -0
  171. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/event_sessions_and_groups.cpython-312.pyc +0 -0
  172. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/event_sport.cpython-312.pyc +0 -0
  173. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/group.cpython-312.pyc +0 -0
  174. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/lap_chart.cpython-312.pyc +0 -0
  175. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/lap_comparison.cpython-312.pyc +0 -0
  176. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/lap_data_result.cpython-312.pyc +0 -0
  177. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/lap_difference.cpython-312.pyc +0 -0
  178. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/lap_info.cpython-312.pyc +0 -0
  179. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/lap_info_classification_type_string.cpython-312.pyc +0 -0
  180. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/lap_position.cpython-312.pyc +0 -0
  181. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/lap_position_status_item.cpython-312.pyc +0 -0
  182. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/lap_times.cpython-312.pyc +0 -0
  183. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/lap_times_info.cpython-312.pyc +0 -0
  184. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/lap_times_info_status_item.cpython-312.pyc +0 -0
  185. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/lap_times_lap.cpython-312.pyc +0 -0
  186. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/lap_times_lap_status_item.cpython-312.pyc +0 -0
  187. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/location.cpython-312.pyc +0 -0
  188. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/member.cpython-312.pyc +0 -0
  189. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/orbit_upload_result.cpython-312.pyc +0 -0
  190. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/orbit_validation_error.cpython-312.pyc +0 -0
  191. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/organization.cpython-312.pyc +0 -0
  192. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/organization_sport.cpython-312.pyc +0 -0
  193. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/participant_info.cpython-312.pyc +0 -0
  194. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/results_competitor.cpython-312.pyc +0 -0
  195. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/run_announcements.cpython-312.pyc +0 -0
  196. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/run_classification_object.cpython-312.pyc +0 -0
  197. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/run_classification_object_type.cpython-312.pyc +0 -0
  198. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/session.cpython-312.pyc +0 -0
  199. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/time.cpython-312.pyc +0 -0
  200. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/upload_login_1_data_body.cpython-312.pyc +0 -0
  201. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/upload_login_data_body.cpython-312.pyc +0 -0
  202. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/__pycache__/upload_software.cpython-312.pyc +0 -0
  203. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/announcement_row.py +79 -0
  204. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/championship.py +124 -0
  205. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/championship_competitor_dto.py +160 -0
  206. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/championship_competitor_event_dto.py +115 -0
  207. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/championship_competitor_event_round_dto.py +88 -0
  208. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/championship_data_dto.py +147 -0
  209. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/championship_event_dto.py +106 -0
  210. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/championship_event_round_dto.py +79 -0
  211. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/championship_model.py +97 -0
  212. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/championships.py +79 -0
  213. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/chip.py +84 -0
  214. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/chip_used.py +70 -0
  215. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/country.py +79 -0
  216. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/duration.py +97 -0
  217. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/event.py +197 -0
  218. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/event_sessions_and_groups.py +102 -0
  219. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/event_sport.py +22 -0
  220. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/group.py +136 -0
  221. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/lap_chart.py +147 -0
  222. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/lap_comparison.py +124 -0
  223. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/lap_data_result.py +97 -0
  224. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/lap_difference.py +70 -0
  225. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/lap_info.py +145 -0
  226. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/lap_info_classification_type_string.py +14 -0
  227. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/lap_position.py +110 -0
  228. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/lap_position_status_item.py +10 -0
  229. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/lap_times.py +106 -0
  230. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/lap_times_info.py +179 -0
  231. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/lap_times_info_status_item.py +10 -0
  232. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/lap_times_lap.py +201 -0
  233. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/lap_times_lap_status_item.py +10 -0
  234. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/location.py +119 -0
  235. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/member.py +161 -0
  236. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/orbit_upload_result.py +97 -0
  237. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/orbit_validation_error.py +79 -0
  238. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/organization.py +145 -0
  239. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/organization_sport.py +22 -0
  240. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/participant_info.py +124 -0
  241. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/results_competitor.py +70 -0
  242. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/run_announcements.py +79 -0
  243. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/run_classification_object.py +91 -0
  244. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/run_classification_object_type.py +14 -0
  245. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/session.py +160 -0
  246. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/time.py +70 -0
  247. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/upload_login_1_data_body.py +69 -0
  248. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/upload_login_data_body.py +69 -0
  249. speedhive_tools-0.1.0/mylaps_client/event_results_client/models/upload_software.py +70 -0
  250. speedhive_tools-0.1.0/mylaps_client/event_results_client/py.typed +1 -0
  251. speedhive_tools-0.1.0/mylaps_client/event_results_client/types.py +54 -0
  252. speedhive_tools-0.1.0/mylaps_client/pyproject.toml +26 -0
  253. speedhive_tools-0.1.0/pyproject.toml +3 -0
  254. speedhive_tools-0.1.0/requirements.txt +3 -0
  255. speedhive_tools-0.1.0/setup.cfg +35 -0
  256. speedhive_tools-0.1.0/speedhive_tools.egg-info/PKG-INFO +168 -0
  257. speedhive_tools-0.1.0/speedhive_tools.egg-info/SOURCES.txt +263 -0
  258. speedhive_tools-0.1.0/speedhive_tools.egg-info/dependency_links.txt +1 -0
  259. speedhive_tools-0.1.0/speedhive_tools.egg-info/entry_points.txt +2 -0
  260. speedhive_tools-0.1.0/speedhive_tools.egg-info/requires.txt +3 -0
  261. speedhive_tools-0.1.0/speedhive_tools.egg-info/top_level.txt +1 -0
  262. speedhive_tools-0.1.0/tests/test_examples_imports.py +29 -0
  263. speedhive_tools-0.1.0/tests/test_import.py +5 -0
  264. speedhive_tools-0.1.0/tests/test_processing_extractors.py +92 -0
@@ -0,0 +1,5 @@
1
+ include README.md
2
+ include requirements.txt
3
+ recursive-include examples *
4
+ recursive-include examples/processing *
5
+ recursive-include mylaps_client *
@@ -0,0 +1,168 @@
1
+ Metadata-Version: 2.4
2
+ Name: speedhive-tools
3
+ Version: 0.1.0
4
+ Summary: Utilities for the MyLaps Event Results API
5
+ Home-page: https://github.com/ncrosty58/speedhive-tools
6
+ Author: Nathan Crosty
7
+ Author-email: ncrosty58@example.com
8
+ License: MIT
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3 :: Only
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Requires-Python: >=3.10
15
+ Description-Content-Type: text/markdown
16
+ Requires-Dist: httpx<0.29.0,>=0.23.0
17
+ Requires-Dist: attrs>=22.2.0
18
+ Requires-Dist: python-dateutil>=2.8.0
19
+
20
+ # speedhive-tools
21
+
22
+ Utilities and examples for interacting with the MyLaps / Event Results API using a locally-generated OpenAPI Python client.
23
+
24
+ This repository contains a generated client under `mylaps_client/` and example scripts that demonstrate how to list events and export session announcements for an organization.
25
+
26
+ Table of contents
27
+
28
+ - Quick start
29
+ - Examples
30
+ - Exporter details
31
+ - Troubleshooting
32
+ - Regenerating the client
33
+ - Contributing
34
+
35
+ Quick start
36
+
37
+ Requirements
38
+ - Python 3.10+
39
+ - `pip install -r requirements.txt`
40
+
41
+ Create and activate a virtualenv, then install:
42
+
43
+ ```bash
44
+ python -m venv .venv
45
+ # speedhive-tools
46
+
47
+ Small, practical tools for the MyLaps / Event Results API using a locally-generated OpenAPI Python client.
48
+
49
+ Quick overview
50
+ - Generated client: `mylaps_client/` (importable as `event_results_client` when running examples from the repo root).
51
+ - Examples live in `examples/` and are runnable without installing the client.
52
+ # 🚀 speedhive-tools
53
+
54
+ Small, playful utilities for the MyLaps Event Results API — examples included ✨
55
+
56
+ Why this repo
57
+ ---------------------------------
58
+ - A locally-generated OpenAPI client lives in `mylaps_client/`.
59
+ - Example scripts show common tasks (list events, export announcements, fetch laps/results).
60
+
61
+ Quick start — get running ⚡
62
+ ---------------------------------
63
+ Requirements: Python 3.10+
64
+
65
+ ```bash
66
+ python -m venv .venv
67
+ source .venv/bin/activate
68
+ pip install -r requirements.txt
69
+ ```
70
+
71
+ Client usage (one-line) 🧩
72
+ ---------------------------------
73
+ Import and construct a client:
74
+
75
+ ```python
76
+ from event_results_client import AuthenticatedClient
77
+ client = AuthenticatedClient(base_url="https://api2.mylaps.com", token="YOUR_TOKEN")
78
+
79
+ Regenerating the client
80
+
81
+ If the OpenAPI spec changes you can regenerate the client and drop it into `mylaps_client/`.
82
+
83
+ <!-- Lightweight README for speedhive-tools -->
84
+ # speedhive-tools
85
+
86
+ Small utilities to interact with the MyLaps Event Results API using a locally-generated OpenAPI client.
87
+
88
+ **Quick Start**
89
+ - Requirements: Python 3.10+ and a virtualenv.
90
+ - Install:
91
+
92
+ ```bash
93
+ python -m venv .venv
94
+ source .venv/bin/activate
95
+ pip install -r requirements.txt
96
+ ```
97
+
98
+ **What’s in this repo**
99
+ - `mylaps_client/` — generated OpenAPI Python client (importable as `event_results_client` when running examples from the repo root).
100
+ - `examples/` — short, runnable examples that demonstrate common API tasks.
101
+ - `examples/processing/` — small data-processing helpers (convert NDJSON -> CSV/SQLite).
102
+ - `output/` — suggested place for example outputs (this directory is in `.gitignore`).
103
+
104
+ **Common commands**
105
+ - List events for an org:
106
+ ```bash
107
+ python examples/list_events_by_org.py 30476 --verbose
108
+ ```
109
+ - Export announcements for an org (per-event JSON files):
110
+ ```bash
111
+ python examples/export_announcements_by_org.py 30476 --output ./output/announcements --verbose
112
+ ```
113
+ - Full dump (stream NDJSON, gzipped by default):
114
+ ```bash
115
+ python examples/export_full_dump.py --org 30476 --output ./output/full_dump --verbose
116
+ ```
117
+
118
+ **Process exported data**
119
+ - Extract laps to CSV:
120
+ ```bash
121
+ python examples/processing/extract_laps_to_csv.py --input output/full_dump/30476 --out output/full_dump/30476/laps_flat.csv
122
+ ```
123
+ - Import laps to SQLite:
124
+ ```bash
125
+ python examples/processing/ndjson_to_sqlite.py --input output/full_dump/30476/laps.ndjson.gz --out output/full_dump/30476/dump.db
126
+ sqlite3 output/full_dump/30476/dump.db "SELECT COUNT(*) FROM laps;"
127
+ ```
128
+
129
+ **Notes & tips**
130
+ - Run examples from the repository root so the local `mylaps_client` package is on `sys.path`.
131
+ - Use `--token` on example CLIs when endpoints require authentication.
132
+ - The exporter supports `--max-events`, `--max-sessions-per-event`, and `--dry-run` for low-memory testing.
133
+ - Long runs write a checkpoint file (`outdir/.checkpoint.json`) so you can resume after interruptions.
134
+
135
+ **Regenerating the client**
136
+ If the API OpenAPI spec changes, regenerate the client and place it under `mylaps_client/`.
137
+
138
+ Example using `openapi-python-client`:
139
+ ```bash
140
+ python -m openapi_python_client generate --url https://api2.mylaps.com/v3/api-docs --output-path ./mylaps_client
141
+ ```
142
+
143
+ **Need help or next steps?**
144
+ - I can add CI tests with recorded fixtures, retries and backoff for the exporter, or more processing utilities (aggregation, progress summaries). Tell me which and I’ll implement it.
145
+
146
+ High-level steps (example using `openapi-python-client`):
147
+
148
+ ```bash
149
+ python -m openapi_python_client generate --url https://api2.mylaps.com/v3/api-docs --output-path ./mylaps_client
150
+ ```
151
+
152
+ After regenerating, run the examples to validate and adjust any sanitization logic if payload shapes changed.
153
+
154
+ Testing and CI
155
+
156
+ - There is a minimal import test under `tests/` to ensure the generated package imports correctly. Add unit tests or mocks if you want to run the exporter in CI.
157
+
158
+ Contributing and next steps
159
+
160
+ If you'd like I can implement any of the following (pick one or more):
161
+
162
+ - Add a `--concurrency` CLI flag to control parallelism.
163
+ - Add an `--aggregate` flag to emit a single combined file for all events instead of per-event files.
164
+ - Add a unit test that verifies exporter output using recorded fixtures (recommended for CI).
165
+
166
+
167
+
168
+
@@ -0,0 +1,149 @@
1
+ # speedhive-tools
2
+
3
+ Utilities and examples for interacting with the MyLaps / Event Results API using a locally-generated OpenAPI Python client.
4
+
5
+ This repository contains a generated client under `mylaps_client/` and example scripts that demonstrate how to list events and export session announcements for an organization.
6
+
7
+ Table of contents
8
+
9
+ - Quick start
10
+ - Examples
11
+ - Exporter details
12
+ - Troubleshooting
13
+ - Regenerating the client
14
+ - Contributing
15
+
16
+ Quick start
17
+
18
+ Requirements
19
+ - Python 3.10+
20
+ - `pip install -r requirements.txt`
21
+
22
+ Create and activate a virtualenv, then install:
23
+
24
+ ```bash
25
+ python -m venv .venv
26
+ # speedhive-tools
27
+
28
+ Small, practical tools for the MyLaps / Event Results API using a locally-generated OpenAPI Python client.
29
+
30
+ Quick overview
31
+ - Generated client: `mylaps_client/` (importable as `event_results_client` when running examples from the repo root).
32
+ - Examples live in `examples/` and are runnable without installing the client.
33
+ # 🚀 speedhive-tools
34
+
35
+ Small, playful utilities for the MyLaps Event Results API — examples included ✨
36
+
37
+ Why this repo
38
+ ---------------------------------
39
+ - A locally-generated OpenAPI client lives in `mylaps_client/`.
40
+ - Example scripts show common tasks (list events, export announcements, fetch laps/results).
41
+
42
+ Quick start — get running ⚡
43
+ ---------------------------------
44
+ Requirements: Python 3.10+
45
+
46
+ ```bash
47
+ python -m venv .venv
48
+ source .venv/bin/activate
49
+ pip install -r requirements.txt
50
+ ```
51
+
52
+ Client usage (one-line) 🧩
53
+ ---------------------------------
54
+ Import and construct a client:
55
+
56
+ ```python
57
+ from event_results_client import AuthenticatedClient
58
+ client = AuthenticatedClient(base_url="https://api2.mylaps.com", token="YOUR_TOKEN")
59
+
60
+ Regenerating the client
61
+
62
+ If the OpenAPI spec changes you can regenerate the client and drop it into `mylaps_client/`.
63
+
64
+ <!-- Lightweight README for speedhive-tools -->
65
+ # speedhive-tools
66
+
67
+ Small utilities to interact with the MyLaps Event Results API using a locally-generated OpenAPI client.
68
+
69
+ **Quick Start**
70
+ - Requirements: Python 3.10+ and a virtualenv.
71
+ - Install:
72
+
73
+ ```bash
74
+ python -m venv .venv
75
+ source .venv/bin/activate
76
+ pip install -r requirements.txt
77
+ ```
78
+
79
+ **What’s in this repo**
80
+ - `mylaps_client/` — generated OpenAPI Python client (importable as `event_results_client` when running examples from the repo root).
81
+ - `examples/` — short, runnable examples that demonstrate common API tasks.
82
+ - `examples/processing/` — small data-processing helpers (convert NDJSON -> CSV/SQLite).
83
+ - `output/` — suggested place for example outputs (this directory is in `.gitignore`).
84
+
85
+ **Common commands**
86
+ - List events for an org:
87
+ ```bash
88
+ python examples/list_events_by_org.py 30476 --verbose
89
+ ```
90
+ - Export announcements for an org (per-event JSON files):
91
+ ```bash
92
+ python examples/export_announcements_by_org.py 30476 --output ./output/announcements --verbose
93
+ ```
94
+ - Full dump (stream NDJSON, gzipped by default):
95
+ ```bash
96
+ python examples/export_full_dump.py --org 30476 --output ./output/full_dump --verbose
97
+ ```
98
+
99
+ **Process exported data**
100
+ - Extract laps to CSV:
101
+ ```bash
102
+ python examples/processing/extract_laps_to_csv.py --input output/full_dump/30476 --out output/full_dump/30476/laps_flat.csv
103
+ ```
104
+ - Import laps to SQLite:
105
+ ```bash
106
+ python examples/processing/ndjson_to_sqlite.py --input output/full_dump/30476/laps.ndjson.gz --out output/full_dump/30476/dump.db
107
+ sqlite3 output/full_dump/30476/dump.db "SELECT COUNT(*) FROM laps;"
108
+ ```
109
+
110
+ **Notes & tips**
111
+ - Run examples from the repository root so the local `mylaps_client` package is on `sys.path`.
112
+ - Use `--token` on example CLIs when endpoints require authentication.
113
+ - The exporter supports `--max-events`, `--max-sessions-per-event`, and `--dry-run` for low-memory testing.
114
+ - Long runs write a checkpoint file (`outdir/.checkpoint.json`) so you can resume after interruptions.
115
+
116
+ **Regenerating the client**
117
+ If the API OpenAPI spec changes, regenerate the client and place it under `mylaps_client/`.
118
+
119
+ Example using `openapi-python-client`:
120
+ ```bash
121
+ python -m openapi_python_client generate --url https://api2.mylaps.com/v3/api-docs --output-path ./mylaps_client
122
+ ```
123
+
124
+ **Need help or next steps?**
125
+ - I can add CI tests with recorded fixtures, retries and backoff for the exporter, or more processing utilities (aggregation, progress summaries). Tell me which and I’ll implement it.
126
+
127
+ High-level steps (example using `openapi-python-client`):
128
+
129
+ ```bash
130
+ python -m openapi_python_client generate --url https://api2.mylaps.com/v3/api-docs --output-path ./mylaps_client
131
+ ```
132
+
133
+ After regenerating, run the examples to validate and adjust any sanitization logic if payload shapes changed.
134
+
135
+ Testing and CI
136
+
137
+ - There is a minimal import test under `tests/` to ensure the generated package imports correctly. Add unit tests or mocks if you want to run the exporter in CI.
138
+
139
+ Contributing and next steps
140
+
141
+ If you'd like I can implement any of the following (pick one or more):
142
+
143
+ - Add a `--concurrency` CLI flag to control parallelism.
144
+ - Add an `--aggregate` flag to emit a single combined file for all events instead of per-event files.
145
+ - Add a unit test that verifies exporter output using recorded fixtures (recommended for CI).
146
+
147
+
148
+
149
+
@@ -0,0 +1,3 @@
1
+ """Package marker for examples to allow importing example modules in tests."""
2
+
3
+ __all__ = []
@@ -0,0 +1,185 @@
1
+ """Export track announcements for all sessions in all events for an organization.
2
+
3
+ Writes one combined JSON file per event containing only sessions that have announcements.
4
+
5
+ Usage:
6
+ python examples/export_announcements_by_org.py 30476 --output ./announcements --verbose
7
+ """
8
+ from __future__ import annotations
9
+
10
+ import argparse
11
+ import json
12
+ import sys
13
+ import asyncio
14
+ from pathlib import Path
15
+ from typing import Any, Iterable, List, Optional
16
+
17
+ # Make generated client importable when running from any cwd
18
+ REPO_ROOT = Path(__file__).resolve().parent.parent
19
+ sys.path.insert(0, str(REPO_ROOT / "mylaps_client"))
20
+
21
+ from event_results_client import Client, AuthenticatedClient
22
+ from event_results_client.api.organization_controller.get_event_list import asyncio_detailed as get_events_for_org_async
23
+ from event_results_client.api.event_controller.get_session_list import asyncio_detailed as get_sessions_for_event_async
24
+ from event_results_client.api.session_controller.get_announcements import asyncio_detailed as get_announcements_for_session_async
25
+ from event_results_client.models.session import Session
26
+ from event_results_client.models.run_announcements import RunAnnouncements
27
+
28
+
29
+ def build_client(token: Optional[str] = None) -> Client:
30
+ if token:
31
+ return AuthenticatedClient(base_url="https://api2.mylaps.com", token=token)
32
+ return Client(base_url="https://api2.mylaps.com")
33
+
34
+
35
+ def safe_load_json(raw: bytes) -> Any:
36
+ try:
37
+ return json.loads(raw)
38
+ except Exception:
39
+ return None
40
+
41
+
42
+ def sanitize_for_model(d: dict) -> dict:
43
+ # Fix a few known API quirks: nested `sessions` or similar fields set to null
44
+ if d.get("sessions") is None:
45
+ d = dict(d)
46
+ d["sessions"] = {}
47
+ return d
48
+
49
+
50
+ def _has_announcements(payload: Any) -> bool:
51
+ if payload is None:
52
+ return False
53
+ if isinstance(payload, list):
54
+ return len(payload) > 0
55
+ if isinstance(payload, dict):
56
+ rows = payload.get("rows")
57
+ if rows is None:
58
+ # dict payload but no rows; treat empty dict as no announcements
59
+ return bool(payload)
60
+ return bool(rows)
61
+ return False
62
+
63
+
64
+ async def export_announcements_for_org_async(org_id: int, out_dir: Path, client: Client, verbose: bool = False, concurrency: int = 20) -> None:
65
+ out_dir.mkdir(parents=True, exist_ok=True)
66
+
67
+ # Get events for the organization (async)
68
+ resp = await get_events_for_org_async(org_id, client=client)
69
+ if verbose:
70
+ print(f"[DEBUG] events request status={getattr(resp,'status_code',None)} size={len(resp.content) if resp.content else 0}")
71
+
72
+ if not getattr(resp, "content", None):
73
+ print("No events returned for org id", org_id)
74
+ return
75
+
76
+ events_payload = safe_load_json(resp.content)
77
+ if not isinstance(events_payload, Iterable):
78
+ print("Unexpected events payload format")
79
+ return
80
+
81
+ events = list(events_payload)
82
+
83
+ sem = asyncio.Semaphore(concurrency)
84
+
85
+ async def fetch_announcements_for_session(session_dict: dict) -> Optional[dict]:
86
+ sid = session_dict.get("id")
87
+ sname = session_dict.get("name")
88
+ if sid is None:
89
+ return None
90
+ async with sem:
91
+ aresp = await get_announcements_for_session_async(sid, client=client)
92
+ if not getattr(aresp, "content", None):
93
+ return None
94
+ payload = safe_load_json(aresp.content)
95
+ if not _has_announcements(payload):
96
+ return None
97
+ # Normalize payload using generated model when possible
98
+ if isinstance(payload, dict) and "rows" in payload:
99
+ try:
100
+ run_ann = RunAnnouncements.from_dict(payload)
101
+ result = run_ann.to_dict()
102
+ except Exception:
103
+ result = payload
104
+ else:
105
+ result = payload
106
+ return {"id": sid, "name": sname, "announcements": result}
107
+
108
+ for ev in events:
109
+ ev_id = ev.get("id")
110
+ ev_name = ev.get("name") or f"event_{ev_id}"
111
+ if verbose:
112
+ print(f"Processing event {ev_id}: {ev_name}")
113
+
114
+ # Get sessions for event (async)
115
+ sresp = await get_sessions_for_event_async(ev_id, client=client)
116
+ if verbose:
117
+ print(f"[DEBUG] sessions request status={getattr(sresp,'status_code',None)} size={len(sresp.content) if sresp.content else 0}")
118
+ if not getattr(sresp, "content", None):
119
+ if verbose:
120
+ print(f" No sessions for event {ev_id}")
121
+ continue
122
+
123
+ sess_payload = safe_load_json(sresp.content)
124
+ if not isinstance(sess_payload, (dict, list)):
125
+ if verbose:
126
+ print(f" Unexpected sessions payload for event {ev_id}")
127
+ continue
128
+
129
+ raw_sessions: List[dict] = []
130
+ if isinstance(sess_payload, list):
131
+ raw_sessions = list(sess_payload)
132
+ elif isinstance(sess_payload, dict):
133
+ if isinstance(sess_payload.get("sessions"), list):
134
+ raw_sessions.extend(sess_payload.get("sessions", []))
135
+ for g in sess_payload.get("groups", []):
136
+ for s_item in g.get("sessions", []) if isinstance(g.get("sessions"), list) else []:
137
+ raw_sessions.append(s_item)
138
+
139
+ # Launch concurrent fetches for announcements
140
+ tasks = [asyncio.create_task(fetch_announcements_for_session(s)) for s in raw_sessions if isinstance(s, dict) and s.get("id")]
141
+ results = await asyncio.gather(*tasks)
142
+ # Filter out sessions with no announcements
143
+ sessions_with_ann = [r for r in results if r]
144
+
145
+ if not sessions_with_ann:
146
+ if verbose:
147
+ print(f" No announcements found for any sessions in event {ev_id}")
148
+ continue
149
+
150
+ ev_out = {"id": ev_id, "name": ev_name, "sessions": sessions_with_ann}
151
+ out_file = out_dir / f"event_{ev_id}_announcements.json"
152
+ with out_file.open("w", encoding="utf-8") as f:
153
+ json.dump(ev_out, f, ensure_ascii=False, indent=2)
154
+ if verbose:
155
+ print(f" Wrote event announcements to {out_file}")
156
+
157
+
158
+ def main(argv: Optional[List[str]] = None) -> int:
159
+ parser = argparse.ArgumentParser(description="Export announcements for all sessions in events for an org")
160
+ parser.add_argument("org_id", type=int, help="Organization id")
161
+ parser.add_argument("--output", "-o", default="./output/announcements", help="Output directory")
162
+ parser.add_argument("--token", help="API token for authenticated endpoints", default=None)
163
+ parser.add_argument("--verbose", action="store_true", help="Verbose debug output")
164
+ parser.add_argument("--concurrency", "-c", type=int, default=20, help="Maximum concurrent requests")
165
+ args = parser.parse_args(argv)
166
+
167
+ client = build_client(token=args.token)
168
+ out_dir = Path(args.output)
169
+
170
+ async def _run():
171
+ async with client:
172
+ await export_announcements_for_org_async(
173
+ args.org_id,
174
+ out_dir,
175
+ client=client,
176
+ verbose=args.verbose,
177
+ concurrency=args.concurrency,
178
+ )
179
+
180
+ asyncio.run(_run())
181
+ return 0
182
+
183
+
184
+ if __name__ == "__main__":
185
+ raise SystemExit(main())