britishairways


Namebritishairways JSON
Version 0.1.1 PyPI version JSON
download
home_pagehttps://github.com/alexechoi/british-airways-py
SummaryA Python package for fetching British Airways flight prices.
upload_time2024-11-29 11:30:22
maintainerNone
docs_urlNone
authorAlex Choi
requires_python>=3.7
licenseNone
keywords
VCS
bugtrack_url
requirements requests
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # British Airways API Python Package

This Python package provides an interface to fetch data from the British Airways Low-Price Finder API. It supports fetching **round-trip flight prices**, **one-way flight prices**, **monthly pricing graphs**, and **calendar pricing data**.

⚠️ **Disclaimer:** This package is in no way affiliated with British Airways.

---

## Features

- Fetch the **specific round-trip flight price** for given departure and return dates.
- Fetch the **specific one-way flight price** for a given date.
- Fetch the **cheapest round-trip flights** for a region and origin airport.
- Retrieve **monthly pricing data** for a specific route and trip length.
- Fetch **calendar-based pricing data** for specific months, showing daily flight prices.

---

## Installation

This package is available on [PyPI](https://pypi.org/project/britishairways/). Install it directly using pip:

```bash
pip install britishairways
```

Or, clone the repository and install it locally:

```bash
git clone https://github.com/alexechoi/british-airways-py.git
cd british-airways-py
pip install .
```

---

## Usage

### Initialize the Client

Before using the package, initialize the `BritishAirways` client:

```python
from britishairways.api import BritishAirways

# Initialize the client
ba = BritishAirways()
```

---

### Functions

#### 1. **`get_one_way_price`**

Fetch the price for a one-way flight on a specific date.

**Parameters**:
- `origin` (str): The origin airport code (e.g., "LHR").
- `destination` (str): The destination airport code (e.g., "JFK").
- `departure_date` (str): The departure date in `YYYY-MM-DD` format.

**Example**:
```python
one_way_flight = ba.get_one_way_price(
    origin="LON",
    destination="NYC",
    departure_date="2024-12-15"
)
print(one_way_flight)
```

---

#### 2. **`get_specific_round_trip`**

Fetch details for a specific round trip, given a departure and return date.

**Parameters**:
- `origin` (str): The origin airport code (e.g., "LHR").
- `destination` (str): The destination airport code (e.g., "JFK").
- `departure_date` (str): The departure date in `YYYY-MM-DD` format.
- `return_date` (str): The return date in `YYYY-MM-DD` format.

**Example**:
```python
flights = ba.get_specific_round_trip(
    origin="LON",
    destination="NYC",
    departure_date="2024-12-15",
    return_date="2024-12-22"
)
print(flights)
```

---

#### 3. **`get_cheapest_round_trips`**

Fetch the cheapest round-trip flights for a given region and origin.

**Parameters**:
- `region` (str): The region code (e.g., "FEA").
- `origin` (str): The origin airport code (e.g., "LON").

**Example**:
```python
cheapest_flights = ba.get_cheapest_round_trips(region="FEA", origin="LON")
print(cheapest_flights)
```

---

#### 4. **`get_monthly_graphs`**

Retrieve monthly pricing data for a specific origin and destination.

**Parameters**:
- `origin` (str): The origin airport code (e.g., "LHR").
- `destination` (str): The destination airport code (e.g., "ATL").
- `trip_length` (int): The length of the trip in days (e.g., 7).

**Example**:
```python
monthly_graphs = ba.get_monthly_graphs(origin="LHR", destination="ATL", trip_length=7)
print(monthly_graphs)
```

---

#### 5. **`get_calendar_prices`**

Retrieve calendar-based pricing data for specific months, displaying daily flight prices.

**Parameters**:
- `origin` (str): The origin airport code (e.g., "LHR").
- `destination` (str): The destination airport code (e.g., "NYC").
- `trip_length` (int): The number of nights for the trip (e.g., 7).
- `months` (list): A list of months in `YYYYMM` format (e.g., `["202412", "202501"]`).

**Example**:
```python
calendar_prices = ba.get_calendar_prices(
    origin="LHR",
    destination="NYC",
    trip_length=7,
    months=["202412", "202501", "202502"]
)
print(calendar_prices)
```

---

## Region Codes

The following region codes are supported:

| Code           | Region                                   |
|-----------------|-----------------------------------------|
| `NOA`          | North America                           |
| `SOA`          | Latin America and Caribbean             |
| `EUK`          | Europe, UK, and Ireland                 |
| `SAS`          | South and Central Asia                  |
| `MDE+OR+AFR`   | Middle East and Africa                  |
| `FEA`          | Far East and Australia                  |

---

## Contributing

Contributions are welcome! If you find a bug or have a feature suggestion, feel free to open an issue or submit a pull request.

---

## License

This project is licensed under the MIT License.

---

Happy Coding! 😊

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/alexechoi/british-airways-py",
    "name": "britishairways",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": "Alex Choi",
    "author_email": "alexchoidev@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fb/71/e1d2f918a18fd2e7f75022f5e5515903a5f57c2192c002e0f15f59ade7cf/britishairways-0.1.1.tar.gz",
    "platform": null,
    "description": "# British Airways API Python Package\n\nThis Python package provides an interface to fetch data from the British Airways Low-Price Finder API. It supports fetching **round-trip flight prices**, **one-way flight prices**, **monthly pricing graphs**, and **calendar pricing data**.\n\n\u26a0\ufe0f **Disclaimer:** This package is in no way affiliated with British Airways.\n\n---\n\n## Features\n\n- Fetch the **specific round-trip flight price** for given departure and return dates.\n- Fetch the **specific one-way flight price** for a given date.\n- Fetch the **cheapest round-trip flights** for a region and origin airport.\n- Retrieve **monthly pricing data** for a specific route and trip length.\n- Fetch **calendar-based pricing data** for specific months, showing daily flight prices.\n\n---\n\n## Installation\n\nThis package is available on [PyPI](https://pypi.org/project/britishairways/). Install it directly using pip:\n\n```bash\npip install britishairways\n```\n\nOr, clone the repository and install it locally:\n\n```bash\ngit clone https://github.com/alexechoi/british-airways-py.git\ncd british-airways-py\npip install .\n```\n\n---\n\n## Usage\n\n### Initialize the Client\n\nBefore using the package, initialize the `BritishAirways` client:\n\n```python\nfrom britishairways.api import BritishAirways\n\n# Initialize the client\nba = BritishAirways()\n```\n\n---\n\n### Functions\n\n#### 1. **`get_one_way_price`**\n\nFetch the price for a one-way flight on a specific date.\n\n**Parameters**:\n- `origin` (str): The origin airport code (e.g., \"LHR\").\n- `destination` (str): The destination airport code (e.g., \"JFK\").\n- `departure_date` (str): The departure date in `YYYY-MM-DD` format.\n\n**Example**:\n```python\none_way_flight = ba.get_one_way_price(\n    origin=\"LON\",\n    destination=\"NYC\",\n    departure_date=\"2024-12-15\"\n)\nprint(one_way_flight)\n```\n\n---\n\n#### 2. **`get_specific_round_trip`**\n\nFetch details for a specific round trip, given a departure and return date.\n\n**Parameters**:\n- `origin` (str): The origin airport code (e.g., \"LHR\").\n- `destination` (str): The destination airport code (e.g., \"JFK\").\n- `departure_date` (str): The departure date in `YYYY-MM-DD` format.\n- `return_date` (str): The return date in `YYYY-MM-DD` format.\n\n**Example**:\n```python\nflights = ba.get_specific_round_trip(\n    origin=\"LON\",\n    destination=\"NYC\",\n    departure_date=\"2024-12-15\",\n    return_date=\"2024-12-22\"\n)\nprint(flights)\n```\n\n---\n\n#### 3. **`get_cheapest_round_trips`**\n\nFetch the cheapest round-trip flights for a given region and origin.\n\n**Parameters**:\n- `region` (str): The region code (e.g., \"FEA\").\n- `origin` (str): The origin airport code (e.g., \"LON\").\n\n**Example**:\n```python\ncheapest_flights = ba.get_cheapest_round_trips(region=\"FEA\", origin=\"LON\")\nprint(cheapest_flights)\n```\n\n---\n\n#### 4. **`get_monthly_graphs`**\n\nRetrieve monthly pricing data for a specific origin and destination.\n\n**Parameters**:\n- `origin` (str): The origin airport code (e.g., \"LHR\").\n- `destination` (str): The destination airport code (e.g., \"ATL\").\n- `trip_length` (int): The length of the trip in days (e.g., 7).\n\n**Example**:\n```python\nmonthly_graphs = ba.get_monthly_graphs(origin=\"LHR\", destination=\"ATL\", trip_length=7)\nprint(monthly_graphs)\n```\n\n---\n\n#### 5. **`get_calendar_prices`**\n\nRetrieve calendar-based pricing data for specific months, displaying daily flight prices.\n\n**Parameters**:\n- `origin` (str): The origin airport code (e.g., \"LHR\").\n- `destination` (str): The destination airport code (e.g., \"NYC\").\n- `trip_length` (int): The number of nights for the trip (e.g., 7).\n- `months` (list): A list of months in `YYYYMM` format (e.g., `[\"202412\", \"202501\"]`).\n\n**Example**:\n```python\ncalendar_prices = ba.get_calendar_prices(\n    origin=\"LHR\",\n    destination=\"NYC\",\n    trip_length=7,\n    months=[\"202412\", \"202501\", \"202502\"]\n)\nprint(calendar_prices)\n```\n\n---\n\n## Region Codes\n\nThe following region codes are supported:\n\n| Code           | Region                                   |\n|-----------------|-----------------------------------------|\n| `NOA`          | North America                           |\n| `SOA`          | Latin America and Caribbean             |\n| `EUK`          | Europe, UK, and Ireland                 |\n| `SAS`          | South and Central Asia                  |\n| `MDE+OR+AFR`   | Middle East and Africa                  |\n| `FEA`          | Far East and Australia                  |\n\n---\n\n## Contributing\n\nContributions are welcome! If you find a bug or have a feature suggestion, feel free to open an issue or submit a pull request.\n\n---\n\n## License\n\nThis project is licensed under the MIT License.\n\n---\n\nHappy Coding! \ud83d\ude0a\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python package for fetching British Airways flight prices.",
    "version": "0.1.1",
    "project_urls": {
        "Homepage": "https://github.com/alexechoi/british-airways-py"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "68421175c30f8904064ece13ab337f8b7a9b6ba27763d73cb8b526a99dd3b608",
                "md5": "e0da957b12b82b8e8ff87689d11effc4",
                "sha256": "19bf99c2daaae6150097903f5e8eacc2d60bacff64327e1d6cf0f1eed91cd753"
            },
            "downloads": -1,
            "filename": "britishairways-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e0da957b12b82b8e8ff87689d11effc4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 12505,
            "upload_time": "2024-11-29T11:30:14",
            "upload_time_iso_8601": "2024-11-29T11:30:14.098312Z",
            "url": "https://files.pythonhosted.org/packages/68/42/1175c30f8904064ece13ab337f8b7a9b6ba27763d73cb8b526a99dd3b608/britishairways-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fb71e1d2f918a18fd2e7f75022f5e5515903a5f57c2192c002e0f15f59ade7cf",
                "md5": "baf3a646b36e7922d5dc57f420996abe",
                "sha256": "89a60c59e6bb22dcc13da913dda75eddcb127b0190a85f51c26622218ee1c5d2"
            },
            "downloads": -1,
            "filename": "britishairways-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "baf3a646b36e7922d5dc57f420996abe",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 9882,
            "upload_time": "2024-11-29T11:30:22",
            "upload_time_iso_8601": "2024-11-29T11:30:22.846138Z",
            "url": "https://files.pythonhosted.org/packages/fb/71/e1d2f918a18fd2e7f75022f5e5515903a5f57c2192c002e0f15f59ade7cf/britishairways-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-29 11:30:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "alexechoi",
    "github_project": "british-airways-py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.32.3"
                ]
            ]
        }
    ],
    "lcname": "britishairways"
}
        
Elapsed time: 0.64556s