pyhtb 0.1.0__py3-none-any.whl

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 (550) hide show
  1. pyhtb/__init__.py +139 -0
  2. pyhtb/experience/__init__.py +0 -0
  3. pyhtb/experience/v1/__init__.py +8 -0
  4. pyhtb/experience/v1/api/__init__.py +1 -0
  5. pyhtb/experience/v1/api/account/__init__.py +1 -0
  6. pyhtb/experience/v1/api/account/get_account_account_id.py +168 -0
  7. pyhtb/experience/v1/client.py +282 -0
  8. pyhtb/experience/v1/errors.py +16 -0
  9. pyhtb/experience/v1/models/__init__.py +11 -0
  10. pyhtb/experience/v1/models/account_response.py +148 -0
  11. pyhtb/experience/v1/models/generic_error_response.py +70 -0
  12. pyhtb/experience/v1/models/streak_data.py +126 -0
  13. pyhtb/experience/v1/types.py +54 -0
  14. pyhtb/v4/__init__.py +8 -0
  15. pyhtb/v4/api/__init__.py +1 -0
  16. pyhtb/v4/api/badges/__init__.py +1 -0
  17. pyhtb/v4/api/badges/get_badges.py +141 -0
  18. pyhtb/v4/api/challenges/__init__.py +1 -0
  19. pyhtb/v4/api/challenges/get_challenge_activity.py +168 -0
  20. pyhtb/v4/api/challenges/get_challenge_categories_list.py +141 -0
  21. pyhtb/v4/api/challenges/get_challenge_changelog.py +168 -0
  22. pyhtb/v4/api/challenges/get_challenge_download.py +168 -0
  23. pyhtb/v4/api/challenges/get_challenge_info.py +168 -0
  24. pyhtb/v4/api/challenges/get_challenge_recommended.py +141 -0
  25. pyhtb/v4/api/challenges/get_challenge_suggested.py +141 -0
  26. pyhtb/v4/api/challenges/get_challenge_writeup.py +168 -0
  27. pyhtb/v4/api/challenges/get_challenge_writeup_official.py +168 -0
  28. pyhtb/v4/api/challenges/get_challenges.py +348 -0
  29. pyhtb/v4/api/challenges/post_challenge_own.py +182 -0
  30. pyhtb/v4/api/connection/__init__.py +1 -0
  31. pyhtb/v4/api/connection/get_access_ovpnfile_vpn_id_tcp.py +172 -0
  32. pyhtb/v4/api/connection/get_access_ovpnfile_vpn_id_udp.py +172 -0
  33. pyhtb/v4/api/connection/get_connection_status.py +150 -0
  34. pyhtb/v4/api/connection/get_connections_servers.py +175 -0
  35. pyhtb/v4/api/connection/get_connections_servers_prolab.py +170 -0
  36. pyhtb/v4/api/connection/post_connections_servers_switch.py +162 -0
  37. pyhtb/v4/api/containers/__init__.py +1 -0
  38. pyhtb/v4/api/containers/post_container_start.py +183 -0
  39. pyhtb/v4/api/containers/post_container_stop.py +177 -0
  40. pyhtb/v4/api/fortresses/__init__.py +1 -0
  41. pyhtb/v4/api/fortresses/get_fortress.py +168 -0
  42. pyhtb/v4/api/fortresses/get_fortress_flags.py +168 -0
  43. pyhtb/v4/api/fortresses/get_fortresses.py +141 -0
  44. pyhtb/v4/api/fortresses/post_fortress_flag.py +198 -0
  45. pyhtb/v4/api/fortresses/post_fortress_reset.py +168 -0
  46. pyhtb/v4/api/home/__init__.py +1 -0
  47. pyhtb/v4/api/home/get_home_banner.py +141 -0
  48. pyhtb/v4/api/machines/__init__.py +1 -0
  49. pyhtb/v4/api/machines/get_machine_active.py +141 -0
  50. pyhtb/v4/api/machines/get_machine_activity.py +168 -0
  51. pyhtb/v4/api/machines/get_machine_adventure.py +168 -0
  52. pyhtb/v4/api/machines/get_machine_changelog.py +168 -0
  53. pyhtb/v4/api/machines/get_machine_graph_matrix.py +168 -0
  54. pyhtb/v4/api/machines/get_machine_profile.py +168 -0
  55. pyhtb/v4/api/machines/get_machine_recommended.py +135 -0
  56. pyhtb/v4/api/machines/get_machine_tags.py +168 -0
  57. pyhtb/v4/api/machines/get_machine_tasks.py +168 -0
  58. pyhtb/v4/api/machines/get_machine_walkthrough_random.py +143 -0
  59. pyhtb/v4/api/machines/get_machine_walkthroughs.py +168 -0
  60. pyhtb/v4/api/machines/get_machine_walkthroughs_language_list.py +145 -0
  61. pyhtb/v4/api/machines/get_machine_writeup.py +168 -0
  62. pyhtb/v4/api/machines/post_todo_update.py +183 -0
  63. pyhtb/v4/api/platform/__init__.py +1 -0
  64. pyhtb/v4/api/platform/get_navigation_main.py +141 -0
  65. pyhtb/v4/api/platform/get_notices.py +141 -0
  66. pyhtb/v4/api/platform/get_search_fetch.py +196 -0
  67. pyhtb/v4/api/prolabs/__init__.py +1 -0
  68. pyhtb/v4/api/prolabs/get_prolab_changelogs.py +168 -0
  69. pyhtb/v4/api/prolabs/get_prolab_faq.py +168 -0
  70. pyhtb/v4/api/prolabs/get_prolab_flags.py +168 -0
  71. pyhtb/v4/api/prolabs/get_prolab_info.py +168 -0
  72. pyhtb/v4/api/prolabs/get_prolab_machines.py +168 -0
  73. pyhtb/v4/api/prolabs/get_prolab_overview.py +168 -0
  74. pyhtb/v4/api/prolabs/get_prolab_progress.py +168 -0
  75. pyhtb/v4/api/prolabs/get_prolabs.py +141 -0
  76. pyhtb/v4/api/prolabs/post_prolab_flag.py +198 -0
  77. pyhtb/v4/api/pwn_box/__init__.py +1 -0
  78. pyhtb/v4/api/pwn_box/get_pwnbox_status.py +160 -0
  79. pyhtb/v4/api/pwn_box/get_pwnbox_usage.py +141 -0
  80. pyhtb/v4/api/pwn_box/post_pwnbox_start.py +184 -0
  81. pyhtb/v4/api/pwn_box/post_pwnbox_terminate.py +139 -0
  82. pyhtb/v4/api/ranking/__init__.py +1 -0
  83. pyhtb/v4/api/ranking/get_rankings.py +141 -0
  84. pyhtb/v4/api/ranking/get_rankings_countries.py +141 -0
  85. pyhtb/v4/api/ranking/get_rankings_country_us_members.py +168 -0
  86. pyhtb/v4/api/ranking/get_rankings_teams.py +141 -0
  87. pyhtb/v4/api/ranking/get_rankings_universities.py +141 -0
  88. pyhtb/v4/api/ranking/get_rankings_users.py +141 -0
  89. pyhtb/v4/api/review/__init__.py +1 -0
  90. pyhtb/v4/api/review/get_review_paginated.py +183 -0
  91. pyhtb/v4/api/season/__init__.py +1 -0
  92. pyhtb/v4/api/season/get_season_leaderboard.py +192 -0
  93. pyhtb/v4/api/season/get_season_leaderboard_top.py +210 -0
  94. pyhtb/v4/api/season/get_season_list.py +141 -0
  95. pyhtb/v4/api/season/get_season_machine_active.py +135 -0
  96. pyhtb/v4/api/season/get_season_machines.py +168 -0
  97. pyhtb/v4/api/season/get_season_rewards.py +168 -0
  98. pyhtb/v4/api/season/get_season_user_rank.py +168 -0
  99. pyhtb/v4/api/season/get_season_user_user_id_rank.py +162 -0
  100. pyhtb/v4/api/sherlocks/__init__.py +1 -0
  101. pyhtb/v4/api/sherlocks/get_sherlock.py +166 -0
  102. pyhtb/v4/api/sherlocks/get_sherlock_downloadlink.py +166 -0
  103. pyhtb/v4/api/sherlocks/get_sherlock_info.py +166 -0
  104. pyhtb/v4/api/sherlocks/get_sherlock_play.py +166 -0
  105. pyhtb/v4/api/sherlocks/get_sherlock_progress.py +166 -0
  106. pyhtb/v4/api/sherlocks/get_sherlock_tasks.py +166 -0
  107. pyhtb/v4/api/sherlocks/get_sherlock_writeup.py +166 -0
  108. pyhtb/v4/api/sherlocks/get_sherlock_writeup_official.py +166 -0
  109. pyhtb/v4/api/sherlocks/get_sherlocks.py +328 -0
  110. pyhtb/v4/api/sherlocks/get_sherlocks_categories_list.py +141 -0
  111. pyhtb/v4/api/sherlocks/post_sherlock_tasks_flag.py +217 -0
  112. pyhtb/v4/api/starting_point/__init__.py +1 -0
  113. pyhtb/v4/api/starting_point/get_sp_tiers_progress.py +141 -0
  114. pyhtb/v4/api/tags/__init__.py +1 -0
  115. pyhtb/v4/api/tags/get_tags_list.py +141 -0
  116. pyhtb/v4/api/team/__init__.py +1 -0
  117. pyhtb/v4/api/team/delete_team_invite_reject.py +162 -0
  118. pyhtb/v4/api/team/get_team_activity.py +198 -0
  119. pyhtb/v4/api/team/get_team_info.py +162 -0
  120. pyhtb/v4/api/team/get_team_invitations.py +172 -0
  121. pyhtb/v4/api/team/get_team_members.py +175 -0
  122. pyhtb/v4/api/team/post_team_invite_accept.py +162 -0
  123. pyhtb/v4/api/team/post_team_kick_user.py +162 -0
  124. pyhtb/v4/api/tracks/__init__.py +1 -0
  125. pyhtb/v4/api/tracks/get_tracks.py +148 -0
  126. pyhtb/v4/api/tracks/get_tracks_id.py +189 -0
  127. pyhtb/v4/api/tracks/post_tracks_enroll.py +168 -0
  128. pyhtb/v4/api/tracks/post_tracks_like.py +168 -0
  129. pyhtb/v4/api/universities/__init__.py +1 -0
  130. pyhtb/v4/api/universities/get_university_members.py +175 -0
  131. pyhtb/v4/api/universities/get_university_profile.py +168 -0
  132. pyhtb/v4/api/user/__init__.py +1 -0
  133. pyhtb/v4/api/user/get_user_achievement.py +200 -0
  134. pyhtb/v4/api/user/get_user_anonymized_id.py +141 -0
  135. pyhtb/v4/api/user/get_user_apptoken_list.py +141 -0
  136. pyhtb/v4/api/user/get_user_connection_status.py +141 -0
  137. pyhtb/v4/api/user/get_user_followers.py +141 -0
  138. pyhtb/v4/api/user/get_user_info.py +141 -0
  139. pyhtb/v4/api/user/get_user_profile_badges.py +189 -0
  140. pyhtb/v4/api/user/get_user_profile_basic.py +168 -0
  141. pyhtb/v4/api/user/get_user_profile_progress_challenges.py +170 -0
  142. pyhtb/v4/api/user/get_user_profile_progress_fortress.py +170 -0
  143. pyhtb/v4/api/user/get_user_profile_progress_prolab.py +168 -0
  144. pyhtb/v4/api/user/get_user_profile_progress_sherlocks.py +170 -0
  145. pyhtb/v4/api/user/get_user_profile_summary.py +141 -0
  146. pyhtb/v4/api/user/get_user_settings.py +141 -0
  147. pyhtb/v4/api/user/get_user_tracks.py +148 -0
  148. pyhtb/v4/api/user/post_user_apptoken_create.py +175 -0
  149. pyhtb/v4/api/user/post_user_apptoken_delete.py +169 -0
  150. pyhtb/v4/api/user/post_user_disrespect.py +162 -0
  151. pyhtb/v4/api/user/post_user_follow.py +162 -0
  152. pyhtb/v4/api/user/post_user_respect.py +162 -0
  153. pyhtb/v4/api/user/post_user_unfollow.py +162 -0
  154. pyhtb/v4/api/vm/__init__.py +1 -0
  155. pyhtb/v4/api/vm/post_vm_extend.py +176 -0
  156. pyhtb/v4/api/vm/post_vm_reset.py +117 -0
  157. pyhtb/v4/api/vm/post_vm_spawn.py +181 -0
  158. pyhtb/v4/api/vm/post_vm_terminate.py +181 -0
  159. pyhtb/v4/client.py +282 -0
  160. pyhtb/v4/errors.py +16 -0
  161. pyhtb/v4/models/__init__.py +613 -0
  162. pyhtb/v4/models/academy_difficulty.py +97 -0
  163. pyhtb/v4/models/academy_module.py +138 -0
  164. pyhtb/v4/models/academy_tiers.py +88 -0
  165. pyhtb/v4/models/active_machine_info.py +248 -0
  166. pyhtb/v4/models/active_machine_response.py +91 -0
  167. pyhtb/v4/models/assigned_server.py +107 -0
  168. pyhtb/v4/models/bad_request_error.py +62 -0
  169. pyhtb/v4/models/badge.py +136 -0
  170. pyhtb/v4/models/badge_category.py +110 -0
  171. pyhtb/v4/models/badges_response.py +84 -0
  172. pyhtb/v4/models/base_task.py +202 -0
  173. pyhtb/v4/models/blood_info.py +109 -0
  174. pyhtb/v4/models/categories_item.py +92 -0
  175. pyhtb/v4/models/categories_list_response.py +84 -0
  176. pyhtb/v4/models/challenge.py +816 -0
  177. pyhtb/v4/models/challenge_activity.py +135 -0
  178. pyhtb/v4/models/challenge_activity_info.py +87 -0
  179. pyhtb/v4/models/challenge_activity_response.py +75 -0
  180. pyhtb/v4/models/challenge_categories.py +97 -0
  181. pyhtb/v4/models/challenge_categories_items.py +97 -0
  182. pyhtb/v4/models/challenge_change_log_id_response.py +121 -0
  183. pyhtb/v4/models/challenge_difficulties.py +88 -0
  184. pyhtb/v4/models/challenge_id_response.py +75 -0
  185. pyhtb/v4/models/challenge_list.py +382 -0
  186. pyhtb/v4/models/challenge_list_response.py +120 -0
  187. pyhtb/v4/models/challenge_recommended_response.py +149 -0
  188. pyhtb/v4/models/challenge_retires_type_0.py +70 -0
  189. pyhtb/v4/models/challenge_suggested_data.py +97 -0
  190. pyhtb/v4/models/challenge_suggested_response.py +93 -0
  191. pyhtb/v4/models/challenge_writeups.py +75 -0
  192. pyhtb/v4/models/company.py +98 -0
  193. pyhtb/v4/models/connection.py +106 -0
  194. pyhtb/v4/models/connection_data_machine_type_0.py +79 -0
  195. pyhtb/v4/models/connection_server.py +88 -0
  196. pyhtb/v4/models/connection_status_item.py +119 -0
  197. pyhtb/v4/models/connections_server_data.py +120 -0
  198. pyhtb/v4/models/connections_server_response.py +84 -0
  199. pyhtb/v4/models/connections_servers_prolab_data.py +111 -0
  200. pyhtb/v4/models/connections_servers_prolab_response.py +85 -0
  201. pyhtb/v4/models/container_start_response.py +71 -0
  202. pyhtb/v4/models/designated_level.py +91 -0
  203. pyhtb/v4/models/difficulty_chart_type_1.py +142 -0
  204. pyhtb/v4/models/faq_item.py +82 -0
  205. pyhtb/v4/models/flag.py +89 -0
  206. pyhtb/v4/models/flag_rating_task.py +213 -0
  207. pyhtb/v4/models/flag_rating_task_extension.py +61 -0
  208. pyhtb/v4/models/flags_to_next_rank_type_0.py +70 -0
  209. pyhtb/v4/models/fortress.py +127 -0
  210. pyhtb/v4/models/fortress_data.py +244 -0
  211. pyhtb/v4/models/fortress_id_response.py +84 -0
  212. pyhtb/v4/models/fortresses_response.py +89 -0
  213. pyhtb/v4/models/game_reset_response.py +71 -0
  214. pyhtb/v4/models/generic_400_message.py +70 -0
  215. pyhtb/v4/models/get_challenges_difficulty_item.py +12 -0
  216. pyhtb/v4/models/get_challenges_sort_by.py +13 -0
  217. pyhtb/v4/models/get_challenges_sort_type.py +9 -0
  218. pyhtb/v4/models/get_challenges_state_item.py +10 -0
  219. pyhtb/v4/models/get_challenges_status.py +9 -0
  220. pyhtb/v4/models/get_challenges_todo.py +8 -0
  221. pyhtb/v4/models/get_connections_servers_product.py +11 -0
  222. pyhtb/v4/models/get_prolab_changelogs_response_200.py +94 -0
  223. pyhtb/v4/models/get_prolab_changelogs_response_200_data_item.py +46 -0
  224. pyhtb/v4/models/get_review_paginated_product.py +10 -0
  225. pyhtb/v4/models/get_search_fetch_tags_item.py +11 -0
  226. pyhtb/v4/models/get_season_leaderboard_leaderboard.py +9 -0
  227. pyhtb/v4/models/get_season_leaderboard_top_leaderboard.py +9 -0
  228. pyhtb/v4/models/get_season_leaderboard_top_period.py +12 -0
  229. pyhtb/v4/models/get_sherlocks_difficulty_item.py +12 -0
  230. pyhtb/v4/models/get_sherlocks_sort_by.py +11 -0
  231. pyhtb/v4/models/get_sherlocks_sort_type.py +9 -0
  232. pyhtb/v4/models/get_sherlocks_state_item.py +10 -0
  233. pyhtb/v4/models/get_sherlocks_status.py +9 -0
  234. pyhtb/v4/models/growths.py +123 -0
  235. pyhtb/v4/models/helpful_reviews.py +79 -0
  236. pyhtb/v4/models/home_banner_item.py +79 -0
  237. pyhtb/v4/models/home_banner_response.py +84 -0
  238. pyhtb/v4/models/item.py +61 -0
  239. pyhtb/v4/models/keyed_pro_lab_mile_stone.py +106 -0
  240. pyhtb/v4/models/lab_master.py +101 -0
  241. pyhtb/v4/models/label.py +71 -0
  242. pyhtb/v4/models/latest_season.py +89 -0
  243. pyhtb/v4/models/links.py +111 -0
  244. pyhtb/v4/models/machine.py +90 -0
  245. pyhtb/v4/models/machine_acitivty_item.py +147 -0
  246. pyhtb/v4/models/machine_activity_id_response.py +75 -0
  247. pyhtb/v4/models/machine_activity_info.py +94 -0
  248. pyhtb/v4/models/machine_card.py +240 -0
  249. pyhtb/v4/models/machine_change_log_item.py +133 -0
  250. pyhtb/v4/models/machine_changelog_id_response.py +86 -0
  251. pyhtb/v4/models/machine_graph_matrix_id_response.py +75 -0
  252. pyhtb/v4/models/machine_graph_matrix_info.py +106 -0
  253. pyhtb/v4/models/machine_profile_info.py +790 -0
  254. pyhtb/v4/models/machine_profile_response.py +75 -0
  255. pyhtb/v4/models/machine_tag_id_response.py +84 -0
  256. pyhtb/v4/models/machine_tag_items.py +79 -0
  257. pyhtb/v4/models/machine_tag_list_response.py +84 -0
  258. pyhtb/v4/models/machine_tasks_response.py +118 -0
  259. pyhtb/v4/models/machine_walkthrough_id_response.py +75 -0
  260. pyhtb/v4/models/machine_walkthrough_message.py +153 -0
  261. pyhtb/v4/models/machine_walkthrough_message_official.py +138 -0
  262. pyhtb/v4/models/machine_walkthrough_message_writeups_item.py +204 -0
  263. pyhtb/v4/models/machine_walkthrough_random_response.py +91 -0
  264. pyhtb/v4/models/machine_walkthrough_video.py +88 -0
  265. pyhtb/v4/models/machine_walkthroughs_language_list_item.py +79 -0
  266. pyhtb/v4/models/machine_walkthroughs_language_list_response.py +94 -0
  267. pyhtb/v4/models/machines_adventure_item.py +181 -0
  268. pyhtb/v4/models/machines_adventure_response.py +85 -0
  269. pyhtb/v4/models/maker.py +143 -0
  270. pyhtb/v4/models/matrix_info.py +97 -0
  271. pyhtb/v4/models/message.py +62 -0
  272. pyhtb/v4/models/meta.py +147 -0
  273. pyhtb/v4/models/navigation_main_data.py +103 -0
  274. pyhtb/v4/models/navigation_main_ranking.py +88 -0
  275. pyhtb/v4/models/navigation_main_response.py +75 -0
  276. pyhtb/v4/models/navigation_nmain_season_ranking.py +119 -0
  277. pyhtb/v4/models/new_rank.py +81 -0
  278. pyhtb/v4/models/next_rank.py +113 -0
  279. pyhtb/v4/models/notices_item.py +106 -0
  280. pyhtb/v4/models/notices_response.py +84 -0
  281. pyhtb/v4/models/object_array_item.py +46 -0
  282. pyhtb/v4/models/official_writeup.py +110 -0
  283. pyhtb/v4/models/options.py +61 -0
  284. pyhtb/v4/models/options_additional_property.py +61 -0
  285. pyhtb/v4/models/own_machine_error_response.py +71 -0
  286. pyhtb/v4/models/own_request.py +70 -0
  287. pyhtb/v4/models/own_response.py +84 -0
  288. pyhtb/v4/models/pagination_link.py +111 -0
  289. pyhtb/v4/models/pesentation_detail.py +277 -0
  290. pyhtb/v4/models/play_info.py +173 -0
  291. pyhtb/v4/models/play_info_alt.py +156 -0
  292. pyhtb/v4/models/post_container_start_data_body.py +61 -0
  293. pyhtb/v4/models/post_container_start_json_body.py +61 -0
  294. pyhtb/v4/models/post_container_stop_data_body.py +61 -0
  295. pyhtb/v4/models/post_container_stop_json_body.py +61 -0
  296. pyhtb/v4/models/post_fortress_flag_data_body.py +61 -0
  297. pyhtb/v4/models/post_fortress_flag_json_body.py +61 -0
  298. pyhtb/v4/models/post_prolab_flag_data_body.py +61 -0
  299. pyhtb/v4/models/post_prolab_flag_json_body.py +61 -0
  300. pyhtb/v4/models/post_sherlock_tasks_flag_data_body.py +61 -0
  301. pyhtb/v4/models/post_sherlock_tasks_flag_json_body.py +61 -0
  302. pyhtb/v4/models/post_todo_update_product.py +10 -0
  303. pyhtb/v4/models/post_user_apptoken_create_body.py +70 -0
  304. pyhtb/v4/models/post_user_apptoken_delete_body.py +61 -0
  305. pyhtb/v4/models/product_flags_response.py +93 -0
  306. pyhtb/v4/models/profile_badges_id_repsonse.py +86 -0
  307. pyhtb/v4/models/profile_badges_item.py +110 -0
  308. pyhtb/v4/models/profile_badges_item_pivot.py +61 -0
  309. pyhtb/v4/models/profile_id_repsonse.py +75 -0
  310. pyhtb/v4/models/profile_progress_challenge_owns.py +79 -0
  311. pyhtb/v4/models/profile_progress_challenges_id_repsonse.py +75 -0
  312. pyhtb/v4/models/profile_progress_fortress_id_repsonse.py +79 -0
  313. pyhtb/v4/models/profile_progress_fortress_profile.py +95 -0
  314. pyhtb/v4/models/profile_progress_fortress_profile_item.py +106 -0
  315. pyhtb/v4/models/profile_progress_pro_lab_profile.py +87 -0
  316. pyhtb/v4/models/profile_progress_pro_lab_response.py +77 -0
  317. pyhtb/v4/models/profile_progress_profile.py +166 -0
  318. pyhtb/v4/models/profile_progress_prolab_item.py +154 -0
  319. pyhtb/v4/models/profile_user_stats.py +301 -0
  320. pyhtb/v4/models/profile_user_team_info.py +79 -0
  321. pyhtb/v4/models/prolab.py +289 -0
  322. pyhtb/v4/models/prolab_data.py +382 -0
  323. pyhtb/v4/models/prolab_id_faq_response.py +93 -0
  324. pyhtb/v4/models/prolab_id_info_response.py +84 -0
  325. pyhtb/v4/models/prolab_id_machine_response.py +93 -0
  326. pyhtb/v4/models/prolab_id_overview_response.py +84 -0
  327. pyhtb/v4/models/prolab_overview_data.py +279 -0
  328. pyhtb/v4/models/prolab_progress_data.py +124 -0
  329. pyhtb/v4/models/prolab_progress_response.py +83 -0
  330. pyhtb/v4/models/prolabs_data.py +93 -0
  331. pyhtb/v4/models/prolabs_response.py +84 -0
  332. pyhtb/v4/models/pwnbox_request.py +64 -0
  333. pyhtb/v4/models/pwnbox_request_location.py +14 -0
  334. pyhtb/v4/models/pwnbox_start_data.py +247 -0
  335. pyhtb/v4/models/pwnbox_start_response.py +75 -0
  336. pyhtb/v4/models/pwnbox_status_not_running_response.py +62 -0
  337. pyhtb/v4/models/pwnbox_status_r_unning_data.py +209 -0
  338. pyhtb/v4/models/pwnbox_status_running_response.py +68 -0
  339. pyhtb/v4/models/pwnbox_usage_response.py +116 -0
  340. pyhtb/v4/models/ranking_country_member_data.py +96 -0
  341. pyhtb/v4/models/ranking_data_team_properties.py +97 -0
  342. pyhtb/v4/models/ranking_data_user_properties.py +97 -0
  343. pyhtb/v4/models/ranking_graph_stats.py +111 -0
  344. pyhtb/v4/models/rankings_countries.py +94 -0
  345. pyhtb/v4/models/rankings_countries_item.py +160 -0
  346. pyhtb/v4/models/rankings_country_members_response.py +83 -0
  347. pyhtb/v4/models/rankings_data.py +92 -0
  348. pyhtb/v4/models/rankings_item.py +210 -0
  349. pyhtb/v4/models/rankings_response.py +83 -0
  350. pyhtb/v4/models/rankings_team_item.py +200 -0
  351. pyhtb/v4/models/rankings_team_response.py +103 -0
  352. pyhtb/v4/models/rankings_universities_item.py +189 -0
  353. pyhtb/v4/models/rankings_universities_response.py +94 -0
  354. pyhtb/v4/models/rankings_user_data.py +221 -0
  355. pyhtb/v4/models/rankings_users_response.py +95 -0
  356. pyhtb/v4/models/recommended_card.py +152 -0
  357. pyhtb/v4/models/review_message_item.py +288 -0
  358. pyhtb/v4/models/review_user.py +133 -0
  359. pyhtb/v4/models/reviews.py +138 -0
  360. pyhtb/v4/models/search_challenge_item.py +97 -0
  361. pyhtb/v4/models/search_fetch_machines_item.py +108 -0
  362. pyhtb/v4/models/search_fetch_response.py +198 -0
  363. pyhtb/v4/models/search_sherlock_item.py +119 -0
  364. pyhtb/v4/models/search_team_item.py +99 -0
  365. pyhtb/v4/models/search_user_item.py +91 -0
  366. pyhtb/v4/models/season_list_data_item.py +257 -0
  367. pyhtb/v4/models/season_list_response.py +84 -0
  368. pyhtb/v4/models/season_machines.py +86 -0
  369. pyhtb/v4/models/season_machines_data_item.py +240 -0
  370. pyhtb/v4/models/season_platers_leaderboard_top_data_item.py +223 -0
  371. pyhtb/v4/models/season_players_leaderboard_data_item.py +229 -0
  372. pyhtb/v4/models/season_players_leaderboard_response.py +129 -0
  373. pyhtb/v4/models/season_players_leaderboard_top_response.py +91 -0
  374. pyhtb/v4/models/season_reward_group_item.py +200 -0
  375. pyhtb/v4/models/season_reward_item.py +97 -0
  376. pyhtb/v4/models/season_reward_types.py +119 -0
  377. pyhtb/v4/models/season_rewards_data_item.py +74 -0
  378. pyhtb/v4/models/season_rewards_resposne.py +85 -0
  379. pyhtb/v4/models/season_user_rank.py +75 -0
  380. pyhtb/v4/models/season_user_rank_data.py +240 -0
  381. pyhtb/v4/models/season_user_rank_data_total_season_flags.py +70 -0
  382. pyhtb/v4/models/server.py +98 -0
  383. pyhtb/v4/models/server_group.py +93 -0
  384. pyhtb/v4/models/server_group_servers.py +59 -0
  385. pyhtb/v4/models/sherlock_blood.py +99 -0
  386. pyhtb/v4/models/sherlock_detail.py +139 -0
  387. pyhtb/v4/models/sherlock_download_link.py +71 -0
  388. pyhtb/v4/models/sherlock_info.py +75 -0
  389. pyhtb/v4/models/sherlock_item.py +332 -0
  390. pyhtb/v4/models/sherlock_item_list.py +120 -0
  391. pyhtb/v4/models/sherlock_named_item.py +75 -0
  392. pyhtb/v4/models/sherlock_named_item_data.py +312 -0
  393. pyhtb/v4/models/sherlock_play.py +185 -0
  394. pyhtb/v4/models/sherlock_play_response.py +75 -0
  395. pyhtb/v4/models/sherlock_progress.py +75 -0
  396. pyhtb/v4/models/sherlock_progress_data.py +97 -0
  397. pyhtb/v4/models/sherlock_retires_type_0.py +79 -0
  398. pyhtb/v4/models/sherlock_task.py +212 -0
  399. pyhtb/v4/models/sherlock_tasks_list.py +84 -0
  400. pyhtb/v4/models/sherlock_writeup.py +75 -0
  401. pyhtb/v4/models/social_links.py +71 -0
  402. pyhtb/v4/models/sp_tiers_progress_item.py +101 -0
  403. pyhtb/v4/models/sp_tiers_progress_response.py +86 -0
  404. pyhtb/v4/models/spawn_request.py +62 -0
  405. pyhtb/v4/models/tag.py +80 -0
  406. pyhtb/v4/models/tag_category.py +102 -0
  407. pyhtb/v4/models/task_flag_response.py +84 -0
  408. pyhtb/v4/models/task_type.py +70 -0
  409. pyhtb/v4/models/team_activity_item.py +170 -0
  410. pyhtb/v4/models/team_activity_user.py +99 -0
  411. pyhtb/v4/models/team_information_profile_data.py +293 -0
  412. pyhtb/v4/models/team_information_profile_response.py +84 -0
  413. pyhtb/v4/models/team_invitations_id_response.py +123 -0
  414. pyhtb/v4/models/team_invitations_id_response_headers.py +46 -0
  415. pyhtb/v4/models/team_member.py +233 -0
  416. pyhtb/v4/models/team_member_team.py +70 -0
  417. pyhtb/v4/models/track_error_response.py +71 -0
  418. pyhtb/v4/models/track_error_response_status.py +8 -0
  419. pyhtb/v4/models/track_success_items_item.py +203 -0
  420. pyhtb/v4/models/tracks_creator.py +85 -0
  421. pyhtb/v4/models/tracks_enroll_response.py +61 -0
  422. pyhtb/v4/models/tracks_id_response.py +285 -0
  423. pyhtb/v4/models/tracks_items.py +123 -0
  424. pyhtb/v4/models/tracks_like_response.py +61 -0
  425. pyhtb/v4/models/university_members_response.py +233 -0
  426. pyhtb/v4/models/upcoming_season.py +133 -0
  427. pyhtb/v4/models/update_response.py +84 -0
  428. pyhtb/v4/models/url_response.py +74 -0
  429. pyhtb/v4/models/user.py +180 -0
  430. pyhtb/v4/models/user_achievement_machine_type_user.py +106 -0
  431. pyhtb/v4/models/user_achievement_tar_type_user_own.py +105 -0
  432. pyhtb/v4/models/user_achievement_target_type_user_id_target_id_response.py +135 -0
  433. pyhtb/v4/models/user_anonymized_id_response.py +80 -0
  434. pyhtb/v4/models/user_apptoken_create_response.py +88 -0
  435. pyhtb/v4/models/user_apptoken_list_item.py +99 -0
  436. pyhtb/v4/models/user_apptoken_list_response.py +85 -0
  437. pyhtb/v4/models/user_availability.py +91 -0
  438. pyhtb/v4/models/user_basic_info_with_respect.py +100 -0
  439. pyhtb/v4/models/user_connection_status_response.py +109 -0
  440. pyhtb/v4/models/user_connection_status_response_connection_type_0.py +106 -0
  441. pyhtb/v4/models/user_entry.py +110 -0
  442. pyhtb/v4/models/user_info.py +383 -0
  443. pyhtb/v4/models/user_info_response.py +75 -0
  444. pyhtb/v4/models/user_profile.py +629 -0
  445. pyhtb/v4/models/user_profile_basic_id_response.py +75 -0
  446. pyhtb/v4/models/user_profile_progress_sherlock_profile.py +156 -0
  447. pyhtb/v4/models/user_profile_progress_sherlock_profile_challenge_owns.py +79 -0
  448. pyhtb/v4/models/user_profile_progress_sherlocks_response.py +78 -0
  449. pyhtb/v4/models/user_profile_team.py +106 -0
  450. pyhtb/v4/models/user_profile_university_team_type_0.py +88 -0
  451. pyhtb/v4/models/user_rank.py +83 -0
  452. pyhtb/v4/models/user_ranking.py +256 -0
  453. pyhtb/v4/models/user_ranking_type_1.py +8 -0
  454. pyhtb/v4/models/user_settings_response.py +100 -0
  455. pyhtb/v4/models/user_task.py +79 -0
  456. pyhtb/v4/models/user_track_item.py +70 -0
  457. pyhtb/v4/models/writeup_data.py +74 -0
  458. pyhtb/v4/types.py +54 -0
  459. pyhtb/v5/__init__.py +8 -0
  460. pyhtb/v5/api/__init__.py +1 -0
  461. pyhtb/v5/api/connections/__init__.py +1 -0
  462. pyhtb/v5/api/connections/get_connections.py +141 -0
  463. pyhtb/v5/api/machines/__init__.py +1 -0
  464. pyhtb/v5/api/machines/get_machines.py +392 -0
  465. pyhtb/v5/api/machines/post_machine_own.py +182 -0
  466. pyhtb/v5/api/university/__init__.py +1 -0
  467. pyhtb/v5/api/university/get_universities.py +188 -0
  468. pyhtb/v5/api/university/get_university_stats.py +168 -0
  469. pyhtb/v5/api/user/__init__.py +1 -0
  470. pyhtb/v5/api/user/get_user_dashboard_favorites.py +141 -0
  471. pyhtb/v5/api/user/get_user_dashboard_in_progress.py +141 -0
  472. pyhtb/v5/api/user/get_user_dashboard_recommended.py +141 -0
  473. pyhtb/v5/api/user/get_user_profile_activity.py +204 -0
  474. pyhtb/v5/api/user/get_user_profile_content.py +221 -0
  475. pyhtb/v5/api/user/get_user_profile_content_counts.py +170 -0
  476. pyhtb/v5/api/vm/__init__.py +1 -0
  477. pyhtb/v5/api/vm/get_virtual_machine_active.py +141 -0
  478. pyhtb/v5/client.py +282 -0
  479. pyhtb/v5/errors.py +16 -0
  480. pyhtb/v5/models/__init__.py +135 -0
  481. pyhtb/v5/models/connection_assigned_server_type_0.py +88 -0
  482. pyhtb/v5/models/connection_base.py +131 -0
  483. pyhtb/v5/models/connection_competitive_entry.py +158 -0
  484. pyhtb/v5/models/connection_competitive_entry_type.py +8 -0
  485. pyhtb/v5/models/connection_lab_entry.py +132 -0
  486. pyhtb/v5/models/connection_lab_entry_type.py +10 -0
  487. pyhtb/v5/models/connection_machine.py +79 -0
  488. pyhtb/v5/models/connection_pro_lab_entry.py +142 -0
  489. pyhtb/v5/models/connection_pro_lab_entry_type.py +8 -0
  490. pyhtb/v5/models/connection_prolab.py +79 -0
  491. pyhtb/v5/models/connections_response.py +152 -0
  492. pyhtb/v5/models/feedback_for_chart.py +142 -0
  493. pyhtb/v5/models/generic_error_response.py +70 -0
  494. pyhtb/v5/models/get_machines_difficulty_item.py +11 -0
  495. pyhtb/v5/models/get_machines_free.py +9 -0
  496. pyhtb/v5/models/get_machines_os_item.py +12 -0
  497. pyhtb/v5/models/get_machines_show_completed.py +9 -0
  498. pyhtb/v5/models/get_machines_sort_by.py +13 -0
  499. pyhtb/v5/models/get_machines_sort_type.py +9 -0
  500. pyhtb/v5/models/get_machines_sp_tier.py +10 -0
  501. pyhtb/v5/models/get_machines_state_item.py +10 -0
  502. pyhtb/v5/models/get_machines_todo.py +8 -0
  503. pyhtb/v5/models/get_user_profile_content_type.py +10 -0
  504. pyhtb/v5/models/links.py +111 -0
  505. pyhtb/v5/models/machine_creator.py +119 -0
  506. pyhtb/v5/models/machine_label.py +70 -0
  507. pyhtb/v5/models/machine_play_info.py +186 -0
  508. pyhtb/v5/models/machine_retiring_type_0.py +97 -0
  509. pyhtb/v5/models/machines_item.py +445 -0
  510. pyhtb/v5/models/machines_response.py +100 -0
  511. pyhtb/v5/models/meta.py +169 -0
  512. pyhtb/v5/models/meta_alt.py +77 -0
  513. pyhtb/v5/models/new_rank.py +81 -0
  514. pyhtb/v5/models/own_error_response.py +70 -0
  515. pyhtb/v5/models/own_request.py +81 -0
  516. pyhtb/v5/models/own_response.py +191 -0
  517. pyhtb/v5/models/own_response_own_type.py +9 -0
  518. pyhtb/v5/models/pagination_link.py +91 -0
  519. pyhtb/v5/models/rank_update.py +83 -0
  520. pyhtb/v5/models/universities_item.py +125 -0
  521. pyhtb/v5/models/universities_response.py +100 -0
  522. pyhtb/v5/models/university_stats_response.py +118 -0
  523. pyhtb/v5/models/user_dashboard_challenge.py +206 -0
  524. pyhtb/v5/models/user_dashboard_collections.py +186 -0
  525. pyhtb/v5/models/user_dashboard_fortress.py +126 -0
  526. pyhtb/v5/models/user_dashboard_machine.py +224 -0
  527. pyhtb/v5/models/user_dashboard_prolab.py +192 -0
  528. pyhtb/v5/models/user_dashboard_sherlock.py +194 -0
  529. pyhtb/v5/models/user_dashboard_starting_point.py +142 -0
  530. pyhtb/v5/models/user_dashboard_track.py +142 -0
  531. pyhtb/v5/models/user_profile_activity_base.py +125 -0
  532. pyhtb/v5/models/user_profile_activity_fortress.py +142 -0
  533. pyhtb/v5/models/user_profile_activity_fortress_type.py +8 -0
  534. pyhtb/v5/models/user_profile_activity_prolab.py +150 -0
  535. pyhtb/v5/models/user_profile_activity_prolab_type.py +8 -0
  536. pyhtb/v5/models/user_profile_activity_response.py +209 -0
  537. pyhtb/v5/models/user_profile_activity_sherlock.py +126 -0
  538. pyhtb/v5/models/user_profile_activity_sherlock_type.py +8 -0
  539. pyhtb/v5/models/user_profile_content_counts_response.py +86 -0
  540. pyhtb/v5/models/user_profile_content_item_challenge.py +119 -0
  541. pyhtb/v5/models/user_profile_content_item_machine.py +135 -0
  542. pyhtb/v5/models/user_profile_content_item_sherlock.py +127 -0
  543. pyhtb/v5/models/user_profile_content_response.py +171 -0
  544. pyhtb/v5/models/virtual_machine_active_info.py +148 -0
  545. pyhtb/v5/models/virtual_machine_active_response.py +88 -0
  546. pyhtb/v5/types.py +54 -0
  547. pyhtb-0.1.0.dist-info/METADATA +139 -0
  548. pyhtb-0.1.0.dist-info/RECORD +550 -0
  549. pyhtb-0.1.0.dist-info/WHEEL +5 -0
  550. pyhtb-0.1.0.dist-info/top_level.txt +1 -0
pyhtb/__init__.py ADDED
@@ -0,0 +1,139 @@
1
+ import pkgutil
2
+ import importlib
3
+ import functools
4
+ from typing import Optional
5
+ import httpx
6
+
7
+ from .v4.client import AuthenticatedClient as AuthenticatedClientV4Gen, Client as ClientV4Gen
8
+ from .v5.client import AuthenticatedClient as AuthenticatedClientV5Gen, Client as ClientV5Gen
9
+ from .experience.v1.client import AuthenticatedClient as AuthenticatedClientV1Gen, Client as ClientV1Gen
10
+
11
+ # Import the API modules for binding
12
+ from .v4 import api as api_v4
13
+ from .v5 import api as api_v5
14
+ from .experience.v1 import api as api_exp_v1
15
+
16
+ # Subclass the generated clients so they support dynamic attribute/method binding
17
+ # (since attrs classes with slots=True don't have a __dict__ by default)
18
+ class ClientV4(ClientV4Gen):
19
+ pass
20
+
21
+ class AuthenticatedClientV4(AuthenticatedClientV4Gen):
22
+ pass
23
+
24
+ class ClientV5(ClientV5Gen):
25
+ pass
26
+
27
+ class AuthenticatedClientV5(AuthenticatedClientV5Gen):
28
+ pass
29
+
30
+ class ClientV1(ClientV1Gen):
31
+ pass
32
+
33
+ class AuthenticatedClientV1(AuthenticatedClientV1Gen):
34
+ pass
35
+
36
+ def _bind_api_methods(client_instance, api_package):
37
+ """
38
+ Dynamically scans an API subpackage and attaches its endpoints as methods
39
+ directly on the client instance, automatically injecting the client parameter.
40
+ """
41
+ for _, module_name, is_pkg in pkgutil.walk_packages(api_package.__path__, api_package.__name__ + "."):
42
+ if is_pkg:
43
+ continue
44
+ try:
45
+ mod = importlib.import_module(module_name)
46
+ except Exception:
47
+ continue
48
+
49
+ endpoint_name = module_name.split(".")[-1]
50
+
51
+ # We bind the following:
52
+ # - sync -> client.endpoint_name()
53
+ # - sync_detailed -> client.endpoint_name_detailed()
54
+ # - asyncio -> client.endpoint_name_async()
55
+ # - asyncio_detailed -> client.endpoint_name_async_detailed()
56
+ for attr_name, bound_name in [
57
+ ("sync", endpoint_name),
58
+ ("asyncio", f"{endpoint_name}_async"),
59
+ ("sync_detailed", f"{endpoint_name}_detailed"),
60
+ ("asyncio_detailed", f"{endpoint_name}_async_detailed"),
61
+ ]:
62
+ func = getattr(mod, attr_name, None)
63
+ if func and callable(func):
64
+ def make_wrapper(f):
65
+ @functools.wraps(f)
66
+ def wrapper(*args, **kwargs):
67
+ kwargs["client"] = client_instance
68
+ return f(*args, **kwargs)
69
+ return wrapper
70
+
71
+ setattr(client_instance, bound_name, make_wrapper(func))
72
+
73
+ class PyHTB:
74
+ """
75
+ Main entrypoint wrapper for the Hack The Box Python SDK.
76
+ Manages API clients for:
77
+ - v4 (via client.v4)
78
+ - v5 (via client.v5)
79
+ - experience/v1 (via client.experience_v1)
80
+
81
+ All generated endpoints are bound directly as methods on the client instances
82
+ so you don't need to import them manually or pass the client parameter.
83
+ For example:
84
+ client = PyHTB(token="my_token")
85
+ machines = client.v5.get_machines()
86
+ """
87
+ def __init__(
88
+ self,
89
+ token: Optional[str] = None,
90
+ base_url_v4: str = "https://labs.hackthebox.com/api/v4",
91
+ base_url_v5: str = "https://labs.hackthebox.com/api/v5",
92
+ base_url_experience_v1: str = "https://labs.hackthebox.com/api/experience/v1",
93
+ timeout: Optional[float] = None,
94
+ verify_ssl: bool = True,
95
+ ):
96
+ httpx_timeout = httpx.Timeout(timeout) if timeout is not None else None
97
+
98
+ if token:
99
+ self.v4 = AuthenticatedClientV4(
100
+ base_url=base_url_v4,
101
+ token=token,
102
+ timeout=httpx_timeout,
103
+ verify_ssl=verify_ssl,
104
+ )
105
+ self.v5 = AuthenticatedClientV5(
106
+ base_url=base_url_v5,
107
+ token=token,
108
+ timeout=httpx_timeout,
109
+ verify_ssl=verify_ssl,
110
+ )
111
+ self.experience_v1 = AuthenticatedClientV1(
112
+ base_url=base_url_experience_v1,
113
+ token=token,
114
+ timeout=httpx_timeout,
115
+ verify_ssl=verify_ssl,
116
+ )
117
+ else:
118
+ self.v4 = ClientV4(
119
+ base_url=base_url_v4,
120
+ timeout=httpx_timeout,
121
+ verify_ssl=verify_ssl,
122
+ )
123
+ self.v5 = ClientV5(
124
+ base_url=base_url_v5,
125
+ timeout=httpx_timeout,
126
+ verify_ssl=verify_ssl,
127
+ )
128
+ self.experience_v1 = ClientV1(
129
+ base_url=base_url_experience_v1,
130
+ timeout=httpx_timeout,
131
+ verify_ssl=verify_ssl,
132
+ )
133
+
134
+ # Bind API methods directly to client instances for ultimate developer simplicity
135
+ _bind_api_methods(self.v4, api_v4)
136
+ _bind_api_methods(self.v5, api_v5)
137
+ _bind_api_methods(self.experience_v1, api_exp_v1)
138
+
139
+ __all__ = ["PyHTB"]
File without changes
@@ -0,0 +1,8 @@
1
+ """A client library for accessing HTB Unofficial API experience/v1"""
2
+
3
+ from .client import AuthenticatedClient, Client
4
+
5
+ __all__ = (
6
+ "AuthenticatedClient",
7
+ "Client",
8
+ )
@@ -0,0 +1 @@
1
+ """Contains methods for accessing the API"""
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,168 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+ from urllib.parse import quote
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import AuthenticatedClient, Client
9
+ from ...models.account_response import AccountResponse
10
+ from ...models.generic_error_response import GenericErrorResponse
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ account_id: str,
16
+ ) -> dict[str, Any]:
17
+ _kwargs: dict[str, Any] = {
18
+ "method": "get",
19
+ "url": "/account/{account_id}".format(
20
+ account_id=quote(str(account_id), safe=""),
21
+ ),
22
+ }
23
+
24
+ return _kwargs
25
+
26
+
27
+ def _parse_response(
28
+ *, client: AuthenticatedClient | Client, response: httpx.Response
29
+ ) -> AccountResponse | GenericErrorResponse | None:
30
+ if response.status_code == 200:
31
+ response_200 = AccountResponse.from_dict(response.json())
32
+
33
+ return response_200
34
+
35
+ if response.status_code == 400:
36
+ response_400 = GenericErrorResponse.from_dict(response.json())
37
+
38
+ return response_400
39
+
40
+ if client.raise_on_unexpected_status:
41
+ raise errors.UnexpectedStatus(response.status_code, response.content)
42
+ else:
43
+ return None
44
+
45
+
46
+ def _build_response(
47
+ *, client: AuthenticatedClient | Client, response: httpx.Response
48
+ ) -> Response[AccountResponse | GenericErrorResponse]:
49
+ return Response(
50
+ status_code=HTTPStatus(response.status_code),
51
+ content=response.content,
52
+ headers=response.headers,
53
+ parsed=_parse_response(client=client, response=response),
54
+ )
55
+
56
+
57
+ def sync_detailed(
58
+ account_id: str,
59
+ *,
60
+ client: AuthenticatedClient | Client,
61
+ ) -> Response[AccountResponse | GenericErrorResponse]:
62
+ """Get Account
63
+
64
+ Account
65
+
66
+ Args:
67
+ account_id (str):
68
+
69
+ Raises:
70
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
71
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
72
+
73
+ Returns:
74
+ Response[AccountResponse | GenericErrorResponse]
75
+ """
76
+
77
+ kwargs = _get_kwargs(
78
+ account_id=account_id,
79
+ )
80
+
81
+ response = client.get_httpx_client().request(
82
+ **kwargs,
83
+ )
84
+
85
+ return _build_response(client=client, response=response)
86
+
87
+
88
+ def sync(
89
+ account_id: str,
90
+ *,
91
+ client: AuthenticatedClient | Client,
92
+ ) -> AccountResponse | GenericErrorResponse | None:
93
+ """Get Account
94
+
95
+ Account
96
+
97
+ Args:
98
+ account_id (str):
99
+
100
+ Raises:
101
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
102
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
103
+
104
+ Returns:
105
+ AccountResponse | GenericErrorResponse
106
+ """
107
+
108
+ return sync_detailed(
109
+ account_id=account_id,
110
+ client=client,
111
+ ).parsed
112
+
113
+
114
+ async def asyncio_detailed(
115
+ account_id: str,
116
+ *,
117
+ client: AuthenticatedClient | Client,
118
+ ) -> Response[AccountResponse | GenericErrorResponse]:
119
+ """Get Account
120
+
121
+ Account
122
+
123
+ Args:
124
+ account_id (str):
125
+
126
+ Raises:
127
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
128
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
129
+
130
+ Returns:
131
+ Response[AccountResponse | GenericErrorResponse]
132
+ """
133
+
134
+ kwargs = _get_kwargs(
135
+ account_id=account_id,
136
+ )
137
+
138
+ response = await client.get_async_httpx_client().request(**kwargs)
139
+
140
+ return _build_response(client=client, response=response)
141
+
142
+
143
+ async def asyncio(
144
+ account_id: str,
145
+ *,
146
+ client: AuthenticatedClient | Client,
147
+ ) -> AccountResponse | GenericErrorResponse | None:
148
+ """Get Account
149
+
150
+ Account
151
+
152
+ Args:
153
+ account_id (str):
154
+
155
+ Raises:
156
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
157
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
158
+
159
+ Returns:
160
+ AccountResponse | GenericErrorResponse
161
+ """
162
+
163
+ return (
164
+ await asyncio_detailed(
165
+ account_id=account_id,
166
+ client=client,
167
+ )
168
+ ).parsed
@@ -0,0 +1,282 @@
1
+ import ssl
2
+ from typing import Any
3
+
4
+ import httpx
5
+ from attrs import define, evolve, field
6
+
7
+
8
+ @define
9
+ class Client:
10
+ """A class for keeping track of data related to the API
11
+
12
+ The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
13
+
14
+ ``base_url``: The base URL for the API, all requests are made to a relative path to this URL
15
+
16
+ ``cookies``: A dictionary of cookies to be sent with every request
17
+
18
+ ``headers``: A dictionary of headers to be sent with every request
19
+
20
+ ``timeout``: The maximum amount of a time a request can take. API functions will raise
21
+ httpx.TimeoutException if this is exceeded.
22
+
23
+ ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
24
+ but can be set to False for testing purposes.
25
+
26
+ ``follow_redirects``: Whether or not to follow redirects. Default value is False.
27
+
28
+ ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
29
+
30
+
31
+ Attributes:
32
+ raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
33
+ status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
34
+ argument to the constructor.
35
+ """
36
+
37
+ raise_on_unexpected_status: bool = field(default=False, kw_only=True)
38
+ _base_url: str = field(alias="base_url")
39
+ _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
40
+ _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
41
+ _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
42
+ _verify_ssl: str | bool | ssl.SSLContext = field(
43
+ default=True, kw_only=True, alias="verify_ssl"
44
+ )
45
+ _follow_redirects: bool = field(
46
+ default=False, kw_only=True, alias="follow_redirects"
47
+ )
48
+ _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
49
+ _client: httpx.Client | None = field(default=None, init=False)
50
+ _async_client: httpx.AsyncClient | None = field(default=None, init=False)
51
+
52
+ def with_headers(self, headers: dict[str, str]) -> "Client":
53
+ """Get a new client matching this one with additional headers"""
54
+ if self._client is not None:
55
+ self._client.headers.update(headers)
56
+ if self._async_client is not None:
57
+ self._async_client.headers.update(headers)
58
+ return evolve(self, headers={**self._headers, **headers})
59
+
60
+ def with_cookies(self, cookies: dict[str, str]) -> "Client":
61
+ """Get a new client matching this one with additional cookies"""
62
+ if self._client is not None:
63
+ self._client.cookies.update(cookies)
64
+ if self._async_client is not None:
65
+ self._async_client.cookies.update(cookies)
66
+ return evolve(self, cookies={**self._cookies, **cookies})
67
+
68
+ def with_timeout(self, timeout: httpx.Timeout) -> "Client":
69
+ """Get a new client matching this one with a new timeout configuration"""
70
+ if self._client is not None:
71
+ self._client.timeout = timeout
72
+ if self._async_client is not None:
73
+ self._async_client.timeout = timeout
74
+ return evolve(self, timeout=timeout)
75
+
76
+ def set_httpx_client(self, client: httpx.Client) -> "Client":
77
+ """Manually set the underlying httpx.Client
78
+
79
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
80
+ """
81
+ self._client = client
82
+ return self
83
+
84
+ def get_httpx_client(self) -> httpx.Client:
85
+ """Get the underlying httpx.Client, constructing a new one if not previously set"""
86
+ if self._client is None:
87
+ self._client = httpx.Client(
88
+ base_url=self._base_url,
89
+ cookies=self._cookies,
90
+ headers=self._headers,
91
+ timeout=self._timeout,
92
+ verify=self._verify_ssl,
93
+ follow_redirects=self._follow_redirects,
94
+ **self._httpx_args,
95
+ )
96
+ return self._client
97
+
98
+ def __enter__(self) -> "Client":
99
+ """Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
100
+ self.get_httpx_client().__enter__()
101
+ return self
102
+
103
+ def __exit__(self, *args: Any, **kwargs: Any) -> None:
104
+ """Exit a context manager for internal httpx.Client (see httpx docs)"""
105
+ self.get_httpx_client().__exit__(*args, **kwargs)
106
+
107
+ def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
108
+ """Manually set the underlying httpx.AsyncClient
109
+
110
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
111
+ """
112
+ self._async_client = async_client
113
+ return self
114
+
115
+ def get_async_httpx_client(self) -> httpx.AsyncClient:
116
+ """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
117
+ if self._async_client is None:
118
+ self._async_client = httpx.AsyncClient(
119
+ base_url=self._base_url,
120
+ cookies=self._cookies,
121
+ headers=self._headers,
122
+ timeout=self._timeout,
123
+ verify=self._verify_ssl,
124
+ follow_redirects=self._follow_redirects,
125
+ **self._httpx_args,
126
+ )
127
+ return self._async_client
128
+
129
+ async def __aenter__(self) -> "Client":
130
+ """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
131
+ await self.get_async_httpx_client().__aenter__()
132
+ return self
133
+
134
+ async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
135
+ """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
136
+ await self.get_async_httpx_client().__aexit__(*args, **kwargs)
137
+
138
+
139
+ @define
140
+ class AuthenticatedClient:
141
+ """A Client which has been authenticated for use on secured endpoints
142
+
143
+ The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
144
+
145
+ ``base_url``: The base URL for the API, all requests are made to a relative path to this URL
146
+
147
+ ``cookies``: A dictionary of cookies to be sent with every request
148
+
149
+ ``headers``: A dictionary of headers to be sent with every request
150
+
151
+ ``timeout``: The maximum amount of a time a request can take. API functions will raise
152
+ httpx.TimeoutException if this is exceeded.
153
+
154
+ ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
155
+ but can be set to False for testing purposes.
156
+
157
+ ``follow_redirects``: Whether or not to follow redirects. Default value is False.
158
+
159
+ ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
160
+
161
+
162
+ Attributes:
163
+ raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
164
+ status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
165
+ argument to the constructor.
166
+ token: The token to use for authentication
167
+ prefix: The prefix to use for the Authorization header
168
+ auth_header_name: The name of the Authorization header
169
+ """
170
+
171
+ raise_on_unexpected_status: bool = field(default=False, kw_only=True)
172
+ _base_url: str = field(alias="base_url")
173
+ _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
174
+ _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
175
+ _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
176
+ _verify_ssl: str | bool | ssl.SSLContext = field(
177
+ default=True, kw_only=True, alias="verify_ssl"
178
+ )
179
+ _follow_redirects: bool = field(
180
+ default=False, kw_only=True, alias="follow_redirects"
181
+ )
182
+ _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
183
+ _client: httpx.Client | None = field(default=None, init=False)
184
+ _async_client: httpx.AsyncClient | None = field(default=None, init=False)
185
+
186
+ token: str
187
+ prefix: str = "Bearer"
188
+ auth_header_name: str = "Authorization"
189
+
190
+ def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
191
+ """Get a new client matching this one with additional headers"""
192
+ if self._client is not None:
193
+ self._client.headers.update(headers)
194
+ if self._async_client is not None:
195
+ self._async_client.headers.update(headers)
196
+ return evolve(self, headers={**self._headers, **headers})
197
+
198
+ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
199
+ """Get a new client matching this one with additional cookies"""
200
+ if self._client is not None:
201
+ self._client.cookies.update(cookies)
202
+ if self._async_client is not None:
203
+ self._async_client.cookies.update(cookies)
204
+ return evolve(self, cookies={**self._cookies, **cookies})
205
+
206
+ def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
207
+ """Get a new client matching this one with a new timeout configuration"""
208
+ if self._client is not None:
209
+ self._client.timeout = timeout
210
+ if self._async_client is not None:
211
+ self._async_client.timeout = timeout
212
+ return evolve(self, timeout=timeout)
213
+
214
+ def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
215
+ """Manually set the underlying httpx.Client
216
+
217
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
218
+ """
219
+ self._client = client
220
+ return self
221
+
222
+ def get_httpx_client(self) -> httpx.Client:
223
+ """Get the underlying httpx.Client, constructing a new one if not previously set"""
224
+ if self._client is None:
225
+ self._headers[self.auth_header_name] = (
226
+ f"{self.prefix} {self.token}" if self.prefix else self.token
227
+ )
228
+ self._client = httpx.Client(
229
+ base_url=self._base_url,
230
+ cookies=self._cookies,
231
+ headers=self._headers,
232
+ timeout=self._timeout,
233
+ verify=self._verify_ssl,
234
+ follow_redirects=self._follow_redirects,
235
+ **self._httpx_args,
236
+ )
237
+ return self._client
238
+
239
+ def __enter__(self) -> "AuthenticatedClient":
240
+ """Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
241
+ self.get_httpx_client().__enter__()
242
+ return self
243
+
244
+ def __exit__(self, *args: Any, **kwargs: Any) -> None:
245
+ """Exit a context manager for internal httpx.Client (see httpx docs)"""
246
+ self.get_httpx_client().__exit__(*args, **kwargs)
247
+
248
+ def set_async_httpx_client(
249
+ self, async_client: httpx.AsyncClient
250
+ ) -> "AuthenticatedClient":
251
+ """Manually set the underlying httpx.AsyncClient
252
+
253
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
254
+ """
255
+ self._async_client = async_client
256
+ return self
257
+
258
+ def get_async_httpx_client(self) -> httpx.AsyncClient:
259
+ """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
260
+ if self._async_client is None:
261
+ self._headers[self.auth_header_name] = (
262
+ f"{self.prefix} {self.token}" if self.prefix else self.token
263
+ )
264
+ self._async_client = httpx.AsyncClient(
265
+ base_url=self._base_url,
266
+ cookies=self._cookies,
267
+ headers=self._headers,
268
+ timeout=self._timeout,
269
+ verify=self._verify_ssl,
270
+ follow_redirects=self._follow_redirects,
271
+ **self._httpx_args,
272
+ )
273
+ return self._async_client
274
+
275
+ async def __aenter__(self) -> "AuthenticatedClient":
276
+ """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
277
+ await self.get_async_httpx_client().__aenter__()
278
+ return self
279
+
280
+ async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
281
+ """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
282
+ await self.get_async_httpx_client().__aexit__(*args, **kwargs)
@@ -0,0 +1,16 @@
1
+ """Contains shared errors types that can be raised from API functions"""
2
+
3
+
4
+ class UnexpectedStatus(Exception):
5
+ """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
6
+
7
+ def __init__(self, status_code: int, content: bytes):
8
+ self.status_code = status_code
9
+ self.content = content
10
+
11
+ super().__init__(
12
+ f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
13
+ )
14
+
15
+
16
+ __all__ = ["UnexpectedStatus"]
@@ -0,0 +1,11 @@
1
+ """Contains all the data models used in inputs/outputs"""
2
+
3
+ from .account_response import AccountResponse
4
+ from .generic_error_response import GenericErrorResponse
5
+ from .streak_data import StreakData
6
+
7
+ __all__ = (
8
+ "AccountResponse",
9
+ "GenericErrorResponse",
10
+ "StreakData",
11
+ )