cohaolain / ryanair-py

This is an open source Python module which allows you to retrieve the cheapest flights, with or without return flights, within a given set of dates.
https://github.com/cohaolain/ryanair-py
MIT License
51 stars 15 forks source link

TypeError: 'staticmethod' object is not callable #13

Open liucscai opened 11 months ago

liucscai commented 11 months ago

I followed the instructions and installed ryanair-py on Python version 3.8.10 (Ubuntu Linux installation) I tried running the code in the documentation, but I get the following error:

>>> flights = api.get_cheapest_flights("DUB", tomorrow, tomorrow + timedelta(days=1))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/luca/.local/lib/python3.8/site-packages/ryanair/ryanair.py", line 76, in get_cheapest_flights
    response = self._retryable_query(query_url, params)["fares"]
  File "/home/luca/.local/lib/python3.8/site-packages/backoff/_sync.py", line 92, in retry
    wait = _init_wait_gen(wait_gen, wait_gen_kwargs)
  File "/home/luca/.local/lib/python3.8/site-packages/backoff/_common.py", line 29, in _init_wait_gen
    initialized = wait_gen(**kwargs)
TypeError: 'staticmethod' object is not callable

Thanks in advance

flintash commented 11 months ago

same error here, using debian and MX(debian based), $ python3 --version Python 3.9.2 getting:

 File "/home/xxx/.local/lib/python3.9/site-packages/ryanair/ryanair.py", line 133, in get_cheapest_return_flights
    response = self._retryable_query(query_url, params)["fares"]
  File "/home/xxx/.local/lib/python3.9/site-packages/backoff/_sync.py", line 92, in retry
    wait = _init_wait_gen(wait_gen, wait_gen_kwargs)
  File "/home/xxx/.local/lib/python3.9/site-packages/backoff/_common.py", line 29, in _init_wait_gen
    initialized = wait_gen(**kwargs)
TypeError: 'staticmethod' object is not callable
cohaolain commented 11 months ago

Thanks for the reports all, a bug may have been introduced in my last refactor, I'll take a look as soon as I get the time.

flintash commented 11 months ago

Acctually downgrading works, so its a way to have it working for time being. pip3 install ryanair-py==2.3.1

cohaolain commented 10 months ago

I suspect what's happening here is my most recent changes aren't compatible with python < 3.10.

Namely, from documentation https://docs.python.org/3/library/functions.html#staticmethod :

Changed in version 3.10: Static methods now inherit the method attributes (module, name, qualname, doc and annotations), have a new wrapped attribute, and are now callable as regular functions.

Python 3.9 isn't EOL until ~the end of 2025, so I will try to fix this at some point.

However, if easy for you, you can just switch to using python >= 3.10 for now :)

ivallesp commented 8 months ago

The issue is still happening

cohaolain commented 8 months ago

Yes, I still haven't gotten around to fixing this on python < 3.10.

To avoid this issue, please use python >= 3.10 for now if you can, or use the previous version of this library ryanair-py==2.3.1.

SorakaMafaka commented 7 months ago

Appreciate any feedback on the pull request @cohaolain :)