Open source unofficial API wrappper to get flight data from RyanAir.
Project description
Flyan SDK
An open-source unofficial API wrapper to get flight data from Ryanair.
Installation
pip install Flyan
Or using uv:
uv add Flyan
Quick Start
from datetime import datetime
from flyan import RyanAir, FlightSearchParams
# Initialize the client
client = RyanAir(currency="EUR")
# Set up search parameters
search_params = FlightSearchParams(
from_airport="DUB", # Dublin
to_airport="BCN", # Barcelona
from_date=datetime(2025, 8, 15),
to_date=datetime(2025, 8, 20),
max_price=200
)
# Search for one-way flights
flights = client.get_oneways(search_params)
# Display results
for flight in flights:
print(f"Flight {flight.flight_number}: {flight.departure_airport.name} → {flight.arrival_airport.name}")
print(f"Departure: {flight.departure_date}")
print(f"Price: {flight.price} {flight.currency}")
print("---")
API Reference
RyanAir Class
Constructor
RyanAir(currency: str = "EUR")
Creates a new RyanAir client instance.
Parameters:
currency(str, optional): Preferred currency for pricing. Defaults to "EUR". Must be a valid currency code from the supported currencies list.
Example:
# Default EUR currency
client = RyanAir()
# Specific currency
client = RyanAir(currency="USD")
Methods
get_oneways(params: FlightSearchParams) -> list[Flight]
Search for one-way flights.
Parameters:
params(FlightSearchParams): Search parameters
Returns:
list[Flight]: List of available flights
FlightSearchParams Class
Parameters for searching flights.
FlightSearchParams(
from_airport: str,
from_date: datetime,
to_date: datetime,
destination_country: Optional[str] = None,
max_price: Optional[int] = None,
to_airport: Optional[str] = None,
departure_time_from: Optional[str] = "00:00",
departure_time_to: Optional[str] = "23:59"
)
Parameters:
from_airport(str): IATA code of departure airport (e.g., "DUB")from_date(datetime): Earliest departure dateto_date(datetime): Latest departure datedestination_country(str, optional): Country code for destinationmax_price(int, optional): Maximum price filterto_airport(str, optional): IATA code of arrival airportdeparture_time_from(str, optional): Earliest departure time (HH:MM format)departure_time_to(str, optional): Latest departure time (HH:MM format)
Example:
from datetime import datetime
params = FlightSearchParams(
from_airport="DUB",
from_date=datetime(2025, 8, 15),
to_date=datetime(2025, 8, 20),
to_airport="BCN",
max_price=150,
departure_time_from="08:00",
departure_time_to="18:00"
)
ReturnFlightSearchParams Class
Extended parameters for return flight searches.
ReturnFlightSearchParams(
# All FlightSearchParams fields plus:
return_date_from: datetime,
return_date_to: datetime,
inbound_departure_time_from: Optional[str] = "00:00",
inbound_departure_time_to: Optional[str] = "23:59"
)
Data Models
Flight
Represents a single flight.
Attributes:
departure_airport(Airport): Departure airport informationarrival_airport(Airport): Arrival airport informationdeparture_date(datetime): Departure date and timearrival_date(datetime): Arrival date and timeprice(float): Flight pricecurrency(str): Price currencyflight_key(str): Unique flight identifierflight_number(str): Flight numberprevious_price(Optional[str | float]): Previous price if available
Airport
Represents airport information.
Attributes:
country_name(str): Country nameiata_code(str): IATA airport codename(str): Airport nameseo_name(str): SEO-friendly namecity_name(str): City namecity_code(str): City codecity_country_code(str): Country code
ReturnFlight
Represents a return flight booking.
Attributes:
outbound(Flight): Outbound flightinbound(Flight): Return flightsummary_price(float): Total price for both flightssummary_currency(str): Currency for total priceprevious_price(str | float): Previous total price if available
Examples
Search by Country
# Search flights to any airport in Spain
params = FlightSearchParams(
from_airport="DUB",
destination_country="ES",
from_date=datetime(2025, 9, 1),
to_date=datetime(2025, 9, 7)
)
flights = client.get_oneways(params)
Filter by Time and Price
# Morning flights under €100
params = FlightSearchParams(
from_airport="STN", # London Stansted
to_airport="DUB", # Dublin
from_date=datetime(2025, 8, 1),
to_date=datetime(2025, 8, 5),
max_price=100,
departure_time_from="06:00",
departure_time_to="12:00"
)
flights = client.get_oneways(params)
Error Handling
from flyan import RyanairException
try:
flights = client.get_oneways(params)
if not flights:
print("No flights found for the given criteria")
except RyanairException as e:
print(f"Ryanair API error: {e}")
except Exception as e:
print(f"Unexpected error: {e}")
Supported Airports
The SDK supports all airports in Ryanair's network. Airport codes must be valid 3-letter IATA codes. You can find the complete list of supported airports in the stations.json file.
Popular airports include:
- DUB - Dublin
- STN - London Stansted
- BCN - Barcelona
- MAD - Madrid
- FCO - Rome Fiumicino
- BRU - Brussels
- AMS - Amsterdam
Supported Currencies
The SDK supports multiple currencies. Some popular ones include:
- EUR - Euro
- USD - US Dollar
- GBP - British Pound
- CHF - Swiss Franc
See currencies.json for the complete list.
Rate Limiting
The SDK includes automatic retry logic with exponential backoff to handle rate limiting and temporary API issues. It will retry failed requests up to 5 times before giving up.
Contributing
This is an open-source project. Contributions are welcome!
Disclaimer
This is an unofficial API wrapper and is not affiliated with Ryanair. Use at your own risk and ensure you comply with Ryanair's terms of service.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flyan-0.1.3.tar.gz.
File metadata
- Download URL: flyan-0.1.3.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efe33e73130f0c0de329b7bec1995c553ffea94e0be834401aef41d345a44b42
|
|
| MD5 |
9562fdeb3d8a1f7d75e1c1c61c8ad551
|
|
| BLAKE2b-256 |
2c71a9ca0e21b654085b4abc069681af281ec21965dd62b17d34500864115e2f
|
Provenance
The following attestation bundles were made for flyan-0.1.3.tar.gz:
Publisher:
release.yml on victorlane/Flyan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flyan-0.1.3.tar.gz -
Subject digest:
efe33e73130f0c0de329b7bec1995c553ffea94e0be834401aef41d345a44b42 - Sigstore transparency entry: 301899429
- Sigstore integration time:
-
Permalink:
victorlane/Flyan@ae59b59067b0ff6d2e94b900e548e59b750cf66c -
Branch / Tag:
refs/heads/master - Owner: https://github.com/victorlane
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ae59b59067b0ff6d2e94b900e548e59b750cf66c -
Trigger Event:
push
-
Statement type:
File details
Details for the file flyan-0.1.3-py3-none-any.whl.
File metadata
- Download URL: flyan-0.1.3-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef59e8f566ccc3180ab1930820d440bde1476fd861aff2c6bfff2a1fd89960ad
|
|
| MD5 |
1461c259f7589d9495b3454b510474c9
|
|
| BLAKE2b-256 |
648809467bbc382551a8a64d569001211ee1d5c446be635e234914bf71f57fcb
|
Provenance
The following attestation bundles were made for flyan-0.1.3-py3-none-any.whl:
Publisher:
release.yml on victorlane/Flyan
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flyan-0.1.3-py3-none-any.whl -
Subject digest:
ef59e8f566ccc3180ab1930820d440bde1476fd861aff2c6bfff2a1fd89960ad - Sigstore transparency entry: 301899436
- Sigstore integration time:
-
Permalink:
victorlane/Flyan@ae59b59067b0ff6d2e94b900e548e59b750cf66c -
Branch / Tag:
refs/heads/master - Owner: https://github.com/victorlane
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ae59b59067b0ff6d2e94b900e548e59b750cf66c -
Trigger Event:
push
-
Statement type: