Refactor public network handling in GPU rental system

- Updated terminology from "public-net" to "public-network" for consistency across the codebase.
- Enhanced error handling and logging for public network API interactions.
- Introduced a new function to determine the public network pool based on the compute region.
- Adjusted API request functions to use the new public network terminology and improved error messages.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Leonid Pershin
2026-08-23 18:25:41 +03:00
co-authored by Cursor
parent 8074426c43
commit eb459dcccf
3 changed files with 93 additions and 32 deletions
+21
View File
@@ -0,0 +1,21 @@
"""public-network API pool mapping and base URL."""
from gpu_rent.public_net import public_net_base, public_network_pool
def test_public_network_pool_ru6_maps_to_ru7():
assert public_network_pool("ru-6") == "ru-7"
def test_public_network_pool_passthrough():
assert public_network_pool("ru-7") == "ru-7"
assert public_network_pool("ru-3") == "ru-3"
def test_public_net_base_uses_public_network_path():
assert public_net_base("ru-7") == (
"https://ru-7.cloud.api.selcloud.ru/public-network"
)
assert public_net_base("ru-6") == (
"https://ru-7.cloud.api.selcloud.ru/public-network"
)