Skip to main content

Python SDK for Nirmi Events API - No API keys needed, connects to your Nirmi backend

Project description

Nirmi Events SDK

A Python SDK for accessing Nirmi's event, place, and weather data services. This SDK connects to your Nirmi backend API, which manages all API keys - you don't need any API keys to use this SDK.

Installation

pip install nirmi-events-sdk

Or install from source:

git clone https://github.com/nirmi/nirmi-events-sdk.git
cd nirmi-events-sdk
pip install -e .

Quick Start

from nirmi_events_sdk import Client
from datetime import datetime, timedelta

# Initialize the client with your Nirmi backend URL
# The backend has all API keys - you don't need any!
client = Client(
    api_base_url="https://api.nirmi.ai"  # Your Nirmi backend URL
)

# Get events near a location
events = client.get_events(
    latitude=41.3851,  # Barcelona
    longitude=2.1734,
    radius_km=5,
    start_time=datetime.now(),
    end_time=datetime.now() + timedelta(days=7)
)

# Chat with AI concierge
response = client.chat(
    message="What's happening tonight?",
    latitude=41.3851,
    longitude=2.1734
)

print(response["response"])

No API Keys Needed!

This SDK connects to your Nirmi backend API, which manages all API keys:

  • ✅ Google Places API (managed by Nirmi)
  • ✅ Ticketmaster API (managed by Nirmi)
  • ✅ Eventbrite API (managed by Nirmi)
  • ✅ OpenWeather API (managed by Nirmi)
  • ✅ OpenAI API (managed by Nirmi)

You just need the URL of your Nirmi backend API.

Features

Events

  • Eventbrite Integration: Fetch events from Eventbrite
  • Ticketmaster Integration: Fetch events from Ticketmaster
  • Location-based Search: Search events by coordinates and radius
  • Date Filtering: Filter events by start/end time
  • Automatic Deduplication: Events from multiple sources are automatically deduplicated

AI Concierge

  • Natural Language Chat: Ask questions in natural language
  • Context-aware: Understands location and conversation history
  • Multi-source Integration: Combines events, places, and weather data

Usage Examples

Get Events

from nirmi_events_sdk import Client
from datetime import datetime, timedelta

client = Client(api_base_url="https://api.nirmi.ai")

# Get events in the next week
events = client.get_events(
    latitude=41.3851,
    longitude=2.1734,
    start_time=datetime.now(),
    end_time=datetime.now() + timedelta(days=7),
    radius_km=10
)

for event in events:
    print(f"{event['name']} at {event['venue_name']} - {event['start_time']}")

Chat with AI Concierge

# Simple query
response = client.chat(
    message="What's happening tonight?",
    latitude=41.3851,
    longitude=2.1734
)
print(response["response"])

# With conversation history
conversation = [
    {"user": "What restaurants are nearby?", "assistant": "Here are some great restaurants..."}
]

response = client.chat(
    message="What about Italian restaurants?",
    latitude=41.3851,
    longitude=2.1734,
    conversation_history=conversation
)
print(response["response"])

Configuration

Backend URL

Set your Nirmi backend URL:

client = Client(api_base_url="https://api.nirmi.ai")

For local development:

client = Client(api_base_url="http://localhost:8000")

Authentication (Optional)

If your backend requires authentication:

client = Client(
    api_base_url="https://api.nirmi.ai",
    api_key="your-api-key"
)

Response Formats

Events

Each event contains:

  • id: Event ID
  • name: Event name
  • description: Event description
  • start_time: Formatted start time
  • end_time: Formatted end time (if available)
  • url: Event URL
  • venue_name: Venue name
  • venue_address: Venue address
  • venue_latitude: Venue latitude
  • venue_longitude: Venue longitude
  • source: Source ("eventbrite" or "ticketmaster")

Chat Response

{
    "response": "AI-generated response text",
    "context_used": {
        "weather": {...},
        "places_found": 5,
        "events_found": 10
    }
}

Error Handling

The SDK gracefully handles errors:

  • If the backend is unavailable, returns empty results or error messages
  • All errors are logged for debugging
  • Network timeouts are handled with 30-second default timeout

Requirements

  • Python 3.8+
  • requests >= 2.28.0
  • pydantic >= 2.6.0

Backend Setup

Your Nirmi backend should be running and accessible. The backend:

  • Manages all API keys (Google, Ticketmaster, Eventbrite, OpenWeather, OpenAI)
  • Provides /events and /chat endpoints
  • Handles all third-party API calls

See the nirmi-concierge-demo for the backend implementation.

License

MIT License

Support

For issues and questions, please contact support@nirmi.ai

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nirmi_events_sdk-1.3.2.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nirmi_events_sdk-1.3.2-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file nirmi_events_sdk-1.3.2.tar.gz.

File metadata

  • Download URL: nirmi_events_sdk-1.3.2.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nirmi_events_sdk-1.3.2.tar.gz
Algorithm Hash digest
SHA256 bfa2822e5cf7e2bc1b1673cbb86c8e239b661ec57598abd1a9fa2cec61b12d4b
MD5 66afc9ac5d96166f23e8fef7fae45dac
BLAKE2b-256 8e2e8095902ec4213d367d2a0e75fbb2dc4d04aa8efa32d259dc504307ef1fb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for nirmi_events_sdk-1.3.2.tar.gz:

Publisher: publish.yml on narmiAI/nirmi-events-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nirmi_events_sdk-1.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for nirmi_events_sdk-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e5feaf709876b30cb49d9b88e75d14029e554d536a8d4ad07d4b8853427b4327
MD5 ddca876cf04ca0024cbb4fb1ff9cce5c
BLAKE2b-256 55419fe8cc827bc9459e33ab7164af7c6e34b69bf88e11654c7935d0c43badb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for nirmi_events_sdk-1.3.2-py3-none-any.whl:

Publisher: publish.yml on narmiAI/nirmi-events-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page