supercoderz / pyflightdata

A simple library to get flight data from various websites from within Python code
MIT License
78 stars 28 forks source link

get_flights/get_airlines not working anymore #9

Closed bartkramer closed 6 years ago

bartkramer commented 6 years ago

Error from get_flights

>>> f.get_flights('kl-klm')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\pyflightdata\flightdata.py", line 190, in get_flights
    return self._fr24.get_airline_flight_data(url)
  File "C:\Python27\lib\site-packages\pyflightdata\common_fr24.py", line 284, in get_airline_flight_data
    data = self.get_raw_airline_flight_data(url)
  File "C:\Python27\lib\site-packages\pyflightdata\common_fr24.py", line 264, in get_raw_airline_flight_data
    return self.get_raw_data(url, 'tbl-datatable', 'tbody', 'tr') or []
  File "C:\Python27\lib\site-packages\pyflightdata\common.py", line 90, in get_raw_data
    return self.traverse(soup, elemid, elements)
  File "C:\Python27\lib\site-packages\pyflightdata\common.py", line 81, in traverse
    res = res.find(element)
AttributeError: 'NoneType' object has no attribute 'find'

Error from get_airlines.

f.get_airlines()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\pyflightdata\flightdata.py", line 148, in get_airlines
    return self._fr24.get_airlines_data(url)
  File "C:\Python27\lib\site-packages\pyflightdata\common_fr24.py", line 211, in get_airlines_data
    data = self.get_raw_airlines_data(url)
  File "C:\Python27\lib\site-packages\pyflightdata\common_fr24.py", line 171, in get_raw_airlines_data
    return self.get_raw_data(url, 'tbl-datatable', 'tbody', 'tr') or []
  File "C:\Python27\lib\site-packages\pyflightdata\common.py", line 90, in get_raw_data
    return self.traverse(soup, elemid, elements)
  File "C:\Python27\lib\site-packages\pyflightdata\common.py", line 81, in traverse
    res = res.find(element)
AttributeError: 'NoneType' object has no attribute 'find'

On v0.3. Rest of the functions is working well.

E3V3A commented 6 years ago

@bartkramer Can you post the JSON result for that query?

PS. Also check if it need capital letters.

hari-allamraju commented 6 years ago

Are you using the latest version ?

Thanks, Hari

On 20 Feb 2018, 06:50 +0800, E:V:A notifications@github.com, wrote:

@bartkramer Can you post the JSON result for that query? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

bartkramer commented 6 years ago

Yes I am on the latest version available from pip.

@E3V3A I can't get any results, it just goes straight to the error.

hari-allamraju commented 6 years ago

Can you show us a snipped of your full code? Get flights has been having some issues as fr24 page comes up blank

Get airlines should work fine

Thanks, Hari

On 20 Feb 2018, 16:01 +0800, Bart Kramer notifications@github.com, wrote:

Yes I am on the latest version available from pip. @E3V3A I can't get any results, it just goes straight to the error. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

bartkramer commented 6 years ago
from pyflightdata import FlightData
api=FlightData(email,password)
api.login(email,password)
api.get_flights('kl-klm') //or  api.get_airlines()

My account is a gold account, I've also tried not signing in and I get the same error in the end. I don't try both get_flight and get_airlines in one line, but that's the only difference between the two.

hari-allamraju commented 6 years ago

I am able to re-produce this - seems to be something in beautifulsoup and it cannot read the table on the page

Will have a fix soon

Thanks, Hari

On 21 Feb 2018, 15:16 +0530, Bart Kramer notifications@github.com, wrote:

from pyflightdata import FlightData api=FlightData(email,password) api.login(email,password) api.get_flights('kl-klm') OR api.get_airlines() My account is a gold account, I've also tried not signing in and I get the same error in the end. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

hari-allamraju commented 6 years ago

Fix is ready; expect a new release in the next 24 hours or so - am trying to try and get in another known issue with get_flights fixed

bartkramer commented 6 years ago

Super, thanks!

hari-allamraju commented 6 years ago

Fixed and released version 0.5.8 @E3V3A this release also fixes the issue with get flights which was failing earlier

In addition the project is now MIT licenced