from typing import Protocol

class Api(Protocol):
    def get(self, endpoint: str) -> int: ...      
    def is_connected(self) -> bool: ...


def long_polling(api: Api) -> None:
    while api.is_connected():
        status = api.get('/data')
        print(f'got {status} from api')
        # TODO: process the data