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
bashpip install gspace
Step 2: Set Up Google Cloud Project
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the APIs you need:
- Google Calendar API
- Gmail API
- Google Drive API
- Google Sheets API
- Google Docs API
- Create credentials (OAuth2 or Service Account)
Step 3: Create Your First Script
Create a file called app.py:
pythonfrom 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
bashpython app.py
That's it! You've created your first Gspace application.
Next Steps
- Learn about Authentication
- Explore Calendar Service
- Check out API Reference