Scrapping Flight Data

Hello,

I am new to this community but not new to aviation and plane spotting. (Favorite aircraft consist of; L-1011, A-6 Intruder, J-3 Cub)

I am currently a data engineer for a 3PL company and trying to build out a SQLite db regarding aircraft activity over my house as a personal project. Ive searched through previous community post but cannot find a related issue similar to mine at this time.

I currently have the SQlite with a simple table resembled to the code below:

cursor.execute('''
    CREATE TABLE IF NOT EXISTS flights (
        id INTEGER PRIMARY KEY AUTOINCREMENT,
        flight_id TEXT,
        aircraft_type TEXT,
        registration TEXT,
        latitude REAL,
        longitude REAL,
        altitude REAL,
        timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
    )
''')

Where my my issue arises is within an SSLError upon pinging the flightaware API, my code below:

# Fetch flight data from the API
response = requests.get('https://aeroapi.flightaware.com/aeroapi', params={'API_KEY': 'api-karl'})

# Process the response JSON
data = response.json()



>>SSLError: HTTPSConnectionPool(host='aeroapi.flightaware.com', port=443): Max retries exceeded with url: /aeroapi?API_KEY=api-karl (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))<<

I do not have a receiver as some people have in this community so looking for ways to work around that.

I Would greatly appreciate some shared wisdom with scrapping live data and what is recommended + dos/donts. Granted i can use data provided by the DOT but that while accurate is often months or so behind and does not offer filtered data specific to my area.

I do apologize if this is a “green” question or if it has been asked previously in a different way.

Thank you all and safe travels

-K

This looks like there’s a problem with your local CA chain. This is the CA chain currently used by AeroAPI; your local system needs to know / trust at least the root CA (the last certificate in the output below):

---
Certificate chain
 0 s:CN = aeroapi.flightaware.com
   i:C = US, ST = Texas, L = Houston, O = SSL Corporation, CN = SSL.com RSA SSL subCA
 1 s:C = US, ST = Texas, L = Houston, O = SSL Corporation, CN = SSL.com RSA SSL subCA
   i:C = US, ST = Texas, L = Houston, O = SSL Corporation, CN = SSL.com Root Certification Authority RSA
 2 s:C = US, ST = Texas, L = Houston, O = SSL Corporation, CN = SSL.com Root Certification Authority RSA
   i:C = PL, O = Unizeto Technologies S.A., OU = Certum Certification Authority, CN = Certum Trusted Network CA
---

You didn’t mention what OS you’re running the Python code on, but on Debian-alikes you’ll need to make sure you have the ca-certificates package installed.

You can try this to verify that SSL/TLS is working OK:

$ openssl s_client -connect aeroapi.flightaware.com:443

Once you get past the SSL problems, you’ll also need to include a real API key in your requests (and note that AeroAPI v4 doesn’t pass API keys as parameters; see AeroAPI Developer Portal - FlightAware)

Thank you for this information,

I am currently running Python 3 on a windows 10 Virtual Environment.

I am new to working with open APIs similar to this here on Flightaware, all the APIs in my experience have all been from my job + position thus connection strings are rather seamless.

Thank you.

-K