FlightRadarAPI icon indicating copy to clipboard operation
FlightRadarAPI copied to clipboard

AttributeError: 'bytes' object has no attribute 'items'

Open caro-acdm opened this issue 1 year ago • 2 comments

Describe the bug The python script unexpectedly stops with this error. I have been using the api for a month, but this error is as recent as 23/04/2024.

Portion of error:

File "D:\Pxxx_Dxxx\Lib\site-packages\FlightRadar24\api.py", line 314, in get_flights for flight_id, flight_info in response.items(): ^^^^^^^^^^^^^^ AttributeError: 'bytes' object has no attribute 'items'


System (please complete the following information):

  • OS: Windows
  • Python Version 12.2

caro-acdm avatar Apr 23 '24 12:04 caro-acdm

Could you please try to reproduce this error again, executing the same steps you have done and inserting a print(response) to the code, before that line?

JeanExtreme002 avatar Apr 25 '24 05:04 JeanExtreme002

I tried printing the response, but haven't been able to reproduce the attribute error yet. I will post as soon as I am able to catch it. I am currently using try-except to catch the attribute error.

caro-acdm avatar Apr 29 '24 09:04 caro-acdm

I'm closing this issue for now.

I analyzed the problem and the reason is an unexpected content-encoding in the header. I would need to know what response was received by the server.

If you get this error again or have more information about the problem, please reopen the issue and send it here.

JeanExtreme002 avatar Jul 28 '24 05:07 JeanExtreme002