healthjoy / async-firebase

The lightweight asynchronous client that makes interaction with Firebase Cloud Messaging oversimplified.
MIT License
37 stars 14 forks source link

httpx.ConnectTimeout problem #49

Closed mapolyanin closed 1 year ago

mapolyanin commented 1 year ago

Приветствую! Я пишу приложение на FastApi, и хочу использовать в нем Вашу библиотеку. К сожалению, я получаю ошибку соединения.

OS Linux async-firebase | 2.6.1 |  

Код класса, работающего с FCM, следующий:

class AIOFireBaseReposytory():
    def __init__(self):

        self.account_file = r"./etd-service-firebase-adminsdk-60lxs-fb9fec3fd9.json"
        self.client = AsyncFirebaseClient()
        self.client.creds_from_service_account_file(self.account_file)

    async def send_message(self, push_message: MessageEntity,
                           devices: list[DeviceEntity]):
        message = Notification(title=push_message.title, body=push_message.body)

        android_config = self.client.build_android_config(
            priority="high",
            ttl=2419200,
            collapse_key="push",
            title=push_message.title,
            body=push_message.body,
        )

        response = await self.client.push_multicast(device_tokens=devices,
                                                    android=android_config
                                                    )

Traceback основной ошибки:


  File "/home/mike_pol/PycharmProjects/fcmnew/venv/bin/lib/python3.10/site-packages/anyio/_core/_sockets.py", line 186, in connect_tcp
    addr_obj = ip_address(remote_host)
  File "/usr/lib/python3.10/ipaddress.py", line 54, in ip_address
    raise ValueError(f'{address!r} does not appear to be an IPv4 or IPv6 address')
ValueError: 'oauth2.googleapis.com' does not appear to be an IPv4 or IPv6 address
akalex commented 1 year ago

Hello @mapolyanin, Thanks for posting this issue. I would like to pay attention to the fact that the problem is not related to the library but rather to a connectivity issue. Perhaps DNS is outdated, or there is something wrong with your local env. It would be nice if you could provide steps to reproduce.