Making requests

For executing HTTP requests in custom code, it is recommended to use the built-in Varwin.Requests class.

Unlike third-party HTTP clients (such as the requests library), the Varwin.Requests implementation is fully integrated with the game loop: each request is an awaitable object and can be used in asynchronous chains without blocking execution.

This allows natural integration of network operations into behavior scenarios:

async def FetchAndReact():
    response = await Varwin.Requests.Get("https://api.example.com/data")
    if response.status_code == 200:
        await cube.ScaleBehaviour.ScaleOverTime(Varwin.Vector3(2, 2, 2), 1)

Varwin.Async.Run(FetchAndReact())

Warning

Although using third-party libraries (including requests) might be technically possible in some runtime environments, it is not recommended: synchronous calls block the main thread, disrupt simulation smoothness, and are incompatible with Varwin’s asynchronous model. For stable and predictable operation, always use Varwin.Requests.