Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

This notebook demonstrates how to authenticate with the Spire Weather API and make your first requests.

Prerequisites

You’ll need:

  • A valid Spire Weather API key

  • Python 3.8+

  • The requests library

Setting Up Your API Key

Never commit API keys to version control!

Store your API key in an environment variable or .env file:

export SPIRE_API_KEY="your-api-key-here"

Or create a .env file:

SPIRE_API_KEY=your-api-key-here

API Configuration

Helper Function

Let’s create a helper function to make API requests:

Test API Connection

Let’s verify the API connection by requesting a point forecast:

View Sample Data

Check Available Files

Error Handling Example

Next Steps

Now that you’re authenticated, continue with: