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.1.tar.gz (20.1 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.1-py3-none-any.whl (21.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nirmi_events_sdk-1.3.1.tar.gz
  • Upload date:
  • Size: 20.1 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.1.tar.gz
Algorithm Hash digest
SHA256 d47dc9b7d08d7b24cb71d02d8be7f9fbcfd84b819f66253c1711375e5fcd472c
MD5 8fc5dd51aae7d47bf70b05c8a4a90ed9
BLAKE2b-256 91d1be916ec17a7b47ce1c1dfb07b0637ff84f7f3095d90494be54e8e08f0f5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for nirmi_events_sdk-1.3.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for nirmi_events_sdk-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9f83992281d2fc0abf9b76a1654a8b4b23ee52212b659179fe1130395b2c82a2
MD5 13ba9b07a6021269d8b1bdcfea3f0b4b
BLAKE2b-256 e88978397c2106fa640d567584cf41b663f05d09125cb319b6f49868c1d8163a

See more details on using hashes here.

Provenance

The following attestation bundles were made for nirmi_events_sdk-1.3.1-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