olucurious / PyFCM

Python client for FCM - Firebase Cloud Messaging (Android, iOS and Web)
http://olucurious.github.io/PyFCM/
MIT License
804 stars 205 forks source link

Updated to 1.4.7, now getting errors #263

Closed jer-tx closed 2 years ago

jer-tx commented 4 years ago

Using Appengine Standard environment. I was previously on pyfcm 1.4.0 and was occasionally (seemingly randomly) getting "to" errors:

File "/base/data/home/apps/s~redacted/tasks:dev-jeremy.425435111337873061/tools/pyfcm/fcm.py", line 209, in notify_multiple_devices return self.parse_responses() File "/base/data/home/apps/s~redacted/tasks:dev-jeremy.425435111337873061/tools/pyfcm/baseapi.py", line 256, in parse_responses raise InternalPackageError(response.text) InternalPackageError: to

Couldn't figure out why, and wasn't happening too often so more or less ignored it. I just updated to 1.4.7 and have otherwise changed absolutely nothing, and now I can't get any push messages to work. All of them return this error:

File "/base/data/home/apps/s~redacted/tasks:dev-jeremy.425435809511742761/tools/libraries/pyfcm/baseapi.py", line 55, in __init__ self.requests_session.mount('http://', HTTPAdapter(max_retries=retries)) File "/base/data/home/apps/s~redacted/tasks:dev-jeremy.425435809511742761/tools/libraries/requests/adapters.py", line 123, in __init__ super(HTTPAdapter, self).__init__() TypeError: super(type, obj): obj must be an instance or subtype of type

My Requests library was a little out of date too so I thought maybe that was why. I'm on the latest now, 2.23.0 and still get the same error. Again, nothing about my implementation of PyFCM has changed between 1.4.0 and 1.4.7

jer-tx commented 4 years ago

If I spam it a little bit, a request does finally go through (?????) and appears to succesfully send the push (I receive it on my phone) but then I get another error:

File "/base/data/home/apps/s~redacted/tasks:dev-jeremy.425436217549488998/tools/libraries/pyfcm/fcm.py", line 312, in notify_multiple_devices self.send_request(payloads, timeout) File "/base/data/home/apps/s~redacted/tasks:dev-jeremy.425436217549488998/tools/libraries/pyfcm/baseapi.py", line 312, in send_request response = self.do_request(payload, timeout) File "/base/data/home/apps/s~redacted/tasks:dev-jeremy.425436217549488998/tools/libraries/pyfcm/baseapi.py", line 302, in do_request response = self.requests_session.post(self.FCM_END_POINT, data=payload, timeout=timeout) File "/base/data/home/apps/s~redacted/tasks:dev-jeremy.425436217549488998/tools/libraries/requests/sessions.py", line 578, in post return self.request('POST', url, data=data, json=json, **kwargs) File "/base/data/home/apps/s~redacted/tasks:dev-jeremy.425436217549488998/tools/libraries/requests/sessions.py", line 530, in request resp = self.send(prep, **send_kwargs) File "/base/data/home/apps/s~redacted/tasks:dev-jeremy.425436217549488998/tools/libraries/requests/sessions.py", line 683, in send r.content File "/base/data/home/apps/s~redacted/tasks:dev-jeremy.425436217549488998/tools/libraries/requests/models.py", line 829, in content self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b'' File "/base/data/home/apps/s~redacted/tasks:dev-jeremy.425436217549488998/tools/libraries/requests/models.py", line 754, in generate raise ChunkedEncodingError(e) ChunkedEncodingError: ('Connection broken: IncompleteRead(14 bytes read)', IncompleteRead(14 bytes read))

olucurious commented 4 years ago

Hi, are you passing the env variable here? : https://github.com/olucurious/PyFCM/blob/9d9eb782030852b003a75cb53b0b333964c14c0e/pyfcm/baseapi.py#L44

jer-tx commented 4 years ago

Yes

FCMNotification(api_key=api_key, env='app_engine')

jer-tx commented 4 years ago

Can I get an update on this?