Google Cloud & Search Engine ID
Configuration: Google Cloud & Search Engine ID
To utilize the Eternity library for real-time web retrieval, you must provide valid credentials from Google. This requires two specific values: a Google API Key and a Programmable Search Engine ID (CX).
1. Obtain a Google API Key
The API Key authenticates your requests to the Google Custom Search JSON API.
- Go to the Google Cloud Console.
- Create a new project (or select an existing one).
- Navigate to APIs & Services > Library.
- Search for Custom Search API and click Enable.
- Navigate to APIs & Services > Credentials.
- Click Create Credentials and select API key.
- Copy the generated key for use in your code.
2. Obtain a Search Engine ID (CX)
The Search Engine ID identifies the specific search engine configuration you want to use.
- Visit the Programmable Search Engine dashboard.
- Click Add to create a new search engine.
- Name your search engine (e.g., "Eternity Web Search").
- Under What to search?, select Search the entire web to allow for broad data retrieval.
- Note: Ensure "Search the entire web" is toggled ON if you want results from across the internet rather than specific domains.
- Click Create.
- In the control panel for your new search engine, locate the Search engine ID and copy it.
Usage Example
Once you have both credentials, initialize the Eternity class by passing them as strings.
from eternity import Eternity
# Your credentials
API_KEY = "AIzaSy..."
SEARCH_ENGINE_ID = "0123456789abcdefg"
# Initialize the library
et = Eternity(api_key=API_KEY, engine_id=SEARCH_ENGINE_ID)
# Perform a search
results = et.get_combined_text("Latest developments in quantum computing")
print(results)
Authentication Parameters
| Parameter | Type | Description |
| :--- | :--- | :--- |
| api_key | str | A valid Google Cloud API Key with the "Custom Search API" enabled. |
| engine_id | str | The unique identifier (CX) for your Programmable Search Engine. |