Getting Started

This guide will help you get started with Gspace in just a few minutes.

Prerequisites

  • Python 3.12 or higher
  • A Google Cloud project with APIs enabled
  • OAuth2 or Service Account credentials

Step 1: Install Gspace

bash
pip install gspace

Step 2: Set Up Google Cloud Project

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the APIs you need:
    • Google Calendar API
    • Gmail API
    • Google Drive API
    • Google Sheets API
    • Google Docs API
  4. Create credentials (OAuth2 or Service Account)

Step 3: Create Your First Script

Create a file called app.py:

python
from gspace import GSpace
from datetime import datetime, timedelta

# Initialize with OAuth2
gspace = GSpace.from_oauth(
    credentials_file="path/to/credentials.json",
    scopes=["calendar", "gmail"]
)

# Create a calendar event
calendar = gspace.calendar()
event = calendar.create_event(
    summary="My First Event",
    start_time=datetime.now() + timedelta(hours=1),
    end_time=datetime.now() + timedelta(hours=2),
    description="Created with Gspace!"
)

print(f"Event created: {event.get('id')}")

# Send an email
gmail = gspace.gmail()
gmail.send_simple_email(
    to="your-email@example.com",
    subject="Hello from Gspace!",
    body="This email was sent using Gspace."
)

print("Email sent successfully!")

Step 4: Run Your Script

bash
python app.py

That's it! You've created your first Gspace application.

Next Steps