Skip to content

Commit

Permalink
Merge e1dab3c into 56fb04a
Browse files Browse the repository at this point in the history
  • Loading branch information
exxamalte committed Dec 3, 2018
2 parents 56fb04a + e1dab3c commit 8ad9fb4
Show file tree
Hide file tree
Showing 19 changed files with 89 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[run]
source = flightradar24_client
source = flightradar_client
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
* Improved error handling for aggregators.

## 0.1 (08/11/2018)
* Feed and Feed Aggregator for local Flightradar24 feed.
* Feed and Feed Aggregator for local Flightradar feed.
* Feed and Feed Aggregator for local Dump1090 feed.
38 changes: 23 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# python-flightradar24-client
# python-flightradar-client

[![Build Status](https://travis-ci.org/exxamalte/python-flightradar24-client.svg)](https://travis-ci.org/exxamalte/python-flightradar24-client)
[![Coverage Status](https://coveralls.io/repos/github/exxamalte/python-flightradar24-client/badge.svg?branch=master)](https://coveralls.io/github/exxamalte/python-flightradar24-client?branch=master)
[![Build Status](https://travis-ci.org/exxamalte/python-flightradar-client.svg)](https://travis-ci.org/exxamalte/python-flightradar-client)
[![Coverage Status](https://coveralls.io/repos/github/exxamalte/python-flightradar-client/badge.svg?branch=master)](https://coveralls.io/github/exxamalte/python-flightradar-client?branch=master)

This library provides convenient access to a local [Flightradar24](https://www.flightradar24.com/) feed.


## Installation
`pip install flightradar24-client`
`pip install flightradar-client`

## Usage

Expand All @@ -22,12 +22,12 @@ objects. The `*FeedAggregator` class keeps a bit of history and with each
subsequent `update` call it tries to fill in any gaps (coordinates and callsign
at the moment) missing in the latest data set fetched.

### Flightradar24 Feed
### Flightradar Feed

The Flightradar24 Feed mode uses the JSON data made available by the `fr24feed`
The Flightradar Feed mode uses the JSON data made available by the `fr24feed`
service (normally under `http://localhost:8754/flights.json`).

`Flightradar24FlightsFeed` and `Flightradar24FlightsFeedAggregator` support
`FlightradarFlightsFeed` and `FlightradarFlightsFeedAggregator` support
the same parameters:

| Name | Type | Description |
Expand All @@ -42,9 +42,11 @@ the same parameters:

```python
import asyncio
from flightradar24_client.fr24_flights import Flightradar24FlightsFeed
import aiohttp
from flightradar_client.fr24feed_flights import FlightradarFlightsFeed
session = aiohttp.ClientSession()
# Home Coordinates: Latitude: -33.5, Longitude: 151.5
feed = Flightradar24FlightsFeed((-33.5, 151.5))
feed = FlightradarFlightsFeed((-33.5, 151.5), session)
LOOP = asyncio.get_event_loop()
status, entries = LOOP.run_until_complete(feed.update())
```
Expand All @@ -53,9 +55,11 @@ status, entries = LOOP.run_until_complete(feed.update())

```python
import asyncio
from flightradar24_client.fr24_flights import Flightradar24FlightsFeedAggregator
import aiohttp
from flightradar_client.fr24feed_flights import FlightradarFlightsFeedAggregator
session = aiohttp.ClientSession()
# Home Coordinates: Latitude: -33.5, Longitude: 151.5
feed_aggregator = Flightradar24FlightsFeedAggregator((-33.5, 151.5))
feed_aggregator = FlightradarFlightsFeedAggregator((-33.5, 151.5), session)
LOOP = asyncio.get_event_loop()
status, entries = LOOP.run_until_complete(feed_aggregator.update())
```
Expand All @@ -80,9 +84,11 @@ the same parameters:

```python
import asyncio
from flightradar24_client.dump1090_aircrafts import Dump1090AircraftsFeed
import aiohttp
from flightradar_client.dump1090_aircrafts import Dump1090AircraftsFeed
session = aiohttp.ClientSession()
# Home Coordinates: Latitude: -33.5, Longitude: 151.5
feed = Dump1090AircraftsFeed((-33.5, 151.5))
feed = Dump1090AircraftsFeed((-33.5, 151.5), session)
LOOP = asyncio.get_event_loop()
status, entries = LOOP.run_until_complete(feed.update())
```
Expand All @@ -91,9 +97,11 @@ status, entries = LOOP.run_until_complete(feed.update())

```python
import asyncio
from flightradar24_client.dump1090_aircrafts import Dump1090AircraftsFeedAggregator
import aiohttp
from flightradar_client.dump1090_aircrafts import Dump1090AircraftsFeedAggregator
session = aiohttp.ClientSession()
# Home Coordinates: Latitude: -33.5, Longitude: 151.5
feed_aggregator = Dump1090AircraftsFeedAggregator((-33.5, 151.5))
feed_aggregator = Dump1090AircraftsFeedAggregator((-33.5, 151.5), session)
LOOP = asyncio.get_event_loop()
status, entries = LOOP.run_until_complete(feed_aggregator.update())
```
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
import logging
from haversine import haversine

from flightradar24_client.consts import UPDATE_OK, UPDATE_ERROR, \
from flightradar_client.consts import UPDATE_OK, UPDATE_ERROR, \
ATTR_LATITUDE, ATTR_LONGITUDE, ATTR_MODE_S, ATTR_ALTITUDE, \
ATTR_CALLSIGN, ATTR_SPEED, ATTR_TRACK, ATTR_SQUAWK, ATTR_VERT_RATE, \
ATTR_UPDATED, INVALID_COORDINATES, NONE_COORDINATES
from flightradar24_client.exceptions import FlightradarException
from flightradar24_client.utils import FixedSizeDict
from flightradar_client.exceptions import FlightradarException
from flightradar_client.utils import FixedSizeDict

_LOGGER = logging.getLogger(__name__)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
"""
import logging

from flightradar24_client import Feed, FeedEntry, FeedAggregator
from flightradar24_client.consts import ATTR_ALTITUDE, ATTR_CALLSIGN, \
from flightradar_client import Feed, FeedEntry, FeedAggregator
from flightradar_client.consts import ATTR_ALTITUDE, ATTR_CALLSIGN, \
ATTR_FLIGHT, ATTR_HEX, ATTR_LAT, ATTR_LATITUDE, ATTR_LON, \
ATTR_LONGITUDE, ATTR_MODE_S, ATTR_SPEED, ATTR_SQUAWK, ATTR_TRACK, \
ATTR_UPDATED, ATTR_VERT_RATE
from flightradar24_client.feed_manager import FeedManagerBase
from flightradar_client.feed_manager import FeedManagerBase

_LOGGER = logging.getLogger(__name__)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""
import logging

from flightradar24_client import UPDATE_OK
from flightradar_client import UPDATE_OK

_LOGGER = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""
Local Flightradar24 Flights Feed.
Local Flightradar Flights Feed.
Fetches JSON feed from a local Flightradar24 flights feed.
Fetches JSON feed from a local Flightradar flights feed.
"""
import logging

from flightradar24_client import Feed, FeedEntry, FeedAggregator
from flightradar24_client.consts import ATTR_ALTITUDE, ATTR_CALLSIGN, \
from flightradar_client import Feed, FeedEntry, FeedAggregator
from flightradar_client.consts import ATTR_ALTITUDE, ATTR_CALLSIGN, \
ATTR_LATITUDE, ATTR_LONGITUDE, ATTR_MODE_S, ATTR_SPEED, ATTR_SQUAWK, \
ATTR_TRACK, ATTR_UPDATED, ATTR_VERT_RATE
from flightradar24_client.feed_manager import FeedManagerBase
from flightradar_client.feed_manager import FeedManagerBase

_LOGGER = logging.getLogger(__name__)

Expand All @@ -19,29 +19,29 @@
URL_TEMPLATE = "http://{}:{}/flights.json"


class Flightradar24FlightsFeedManager(FeedManagerBase):
"""Feed Manager for Flightradar24 Flights feed."""
class FlightradarFlightsFeedManager(FeedManagerBase):
"""Feed Manager for Flightradar Flights feed."""

def __init__(self, generate_callback, update_callback, remove_callback,
coordinates, session, loop=None, filter_radius=None, url=None,
hostname=DEFAULT_HOSTNAME, port=DEFAULT_PORT):
"""Initialize the NSW Rural Fire Services Feed Manager."""
feed = Flightradar24FlightsFeedAggregator(
feed = FlightradarFlightsFeedAggregator(
coordinates, session, loop=loop, filter_radius=filter_radius,
url=url, hostname=hostname, port=port)
super().__init__(feed, generate_callback, update_callback,
remove_callback)


class Flightradar24FlightsFeedAggregator(FeedAggregator):
class FlightradarFlightsFeedAggregator(FeedAggregator):
"""Aggregates date received from the feed over a period of time."""

def __init__(self, home_coordinates, session, loop=None,
filter_radius=None, url=None, hostname=DEFAULT_HOSTNAME,
port=DEFAULT_PORT):
"""Initialise feed aggregator."""
super().__init__(filter_radius)
self._feed = Flightradar24FlightsFeed(home_coordinates, session,
self._feed = FlightradarFlightsFeed(home_coordinates, session,
loop, False, filter_radius,
url, hostname, port)

Expand All @@ -51,8 +51,8 @@ def feed(self):
return self._feed


class Flightradar24FlightsFeed(Feed):
"""Flightradar24 Flights Feed."""
class FlightradarFlightsFeed(Feed):
"""Flightradar Flights Feed."""

def __init__(self, home_coordinates, session, loop=None,
apply_filters=True, filter_radius=None, url=None,
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
]

setup(
name="flightradar24_client",
version="0.4a5",
name="flightradar_client",
version="0.5",
author="Malte Franken",
author_email="coding@subspace.de",
description="Flightradar24 client library.",
description="Flightradar client library.",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/exxamalte/python-flightradar24-client",
url="https://github.com/exxamalte/python-flightradar-client",
packages=find_packages(),
classifiers=[
"Programming Language :: Python :: 3.5",
Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Tests for flightradar24-client library."""
"""Tests for flightradar-client library."""
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions tests/test_dump1090_aircrafts.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from aioresponses import aioresponses
import datetime

from flightradar24_client import FeedEntry
from flightradar24_client.consts import UPDATE_OK, UPDATE_ERROR
from flightradar24_client.dump1090_aircrafts import Dump1090AircraftsFeed, \
from flightradar_client import FeedEntry
from flightradar_client.consts import UPDATE_OK, UPDATE_ERROR
from flightradar_client.dump1090_aircrafts import Dump1090AircraftsFeed, \
Dump1090AircraftsFeedAggregator, Dump1090AircraftsFeedManager
from tests.utils import load_fixture

Expand Down
Loading

0 comments on commit 8ad9fb4

Please sign in to comment.