Skip to main content

Guide 01 · Python

Get a company’s revenue in Python

Read Apple’s latest annual revenue, see which filing it came from, then pull six years of history. You need Python 3 and the requests package. No account needed to start.

1Try it with the demo key

The key demo is shared by everyone and allows 500 calls a day in total. It is enough to follow this guide.

pip install requests

2Read one number and its filing

Ask for the latest annual figures. Each row carries its value and the filing it came from.

import requests

API = "https://api.netnestdesign.com"
HEADERS = {"Authorization": "Bearer demo"}

r = requests.get(
    f"{API}/v1/fundamentals/AAPL",
    params={"metrics": "revenue,net_income,eps_diluted", "period": "annual"},
    headers=HEADERS,
    timeout=30,
)
r.raise_for_status()
for row in r.json()["data"]:
    print(row["metric"], row["value"], row["form"], row["filed_date"])

Output

revenue 416161000000 10-K 2025-10-31
net_income 112010000000 10-K 2025-10-31
eps_diluted 7.46 10-K 2025-10-31

Every row also has accession_number and source_url, which open the exact filing on sec.gov. A missing value comes back as null with a reason, never a guess.

3Pull the history

One metric over time, newest first. Use period for annual, quarterly or trailing twelve months, and limit for up to 200 periods.

r = requests.get(
    f"{API}/v1/history/AAPL/revenue",
    params={"period": "annual", "limit": 6},
    headers=HEADERS,
    timeout=30,
)
r.raise_for_status()
for row in r.json()["data"]:
    billions = row["value"] / 1e9
    print(f"{row['fiscal_year']}  ${billions:,.1f}B  {row['form']} filed {row['filed_date']}")

Output

2025  $416.2B  10-K filed 2025-10-31
2024  $391.0B  10-K filed 2024-11-01
2023  $383.3B  10-K filed 2023-11-03
2022  $394.3B  10-K filed 2022-10-28
2021  $365.8B  10-K filed 2021-10-29
2020  $274.5B  10-K filed 2020-10-30

See the same numbers on the Apple company page.

4Use your own key

A free key needs no card. It allows 10 calls a day until you confirm your email, then 100. The key comes back in the response; the confirmation code comes by email.

curl -X POST https://api.netnestdesign.com/v1/signup \
  -H "Content-Type: application/json" \
  -d '{"email":"you@example.com","ref":"/data/learn/revenue-in-python"}'

Then replace demo in HEADERS with your key. Keep it in an environment variable, not in your code.

Data from SEC filings. Not investment advice.