Skip to main content

GSERP API

Overview

The GSERP API is an open-source project designed to perform search queries on Google and return organic search results. It leverages the requests-ip-rotator to handle IP rotation, ensuring that requests are made from different IP addresses to avoid being blocked by Google. The API is built using Python and provides a simple interface for querying and retrieving search results.

Features

  • IP Rotation: Utilizes requests-ip-rotator to rotate IP addresses for each request.
  • Customizable Search: Allows specifying search parameters such as country, language, location, and fields to retrieve.
  • Field Selection: Users can choose which fields to include in the search results, such as title, link, snippet, etc.
  • Error Handling: Provides detailed error messages for invalid field selections and connection issues.

Installation

pip install gserp-api

or from source:

git clone git@github.com:rushout09/gserp-api.git
cd gserp-api
python3 -m venv venv
source venv/bin/activate
pip install -r requriements.txt

Usage

import os
from requests_ip_rotator import ApiGateway
from gserp_api import search

# Set AWS credentials
aws_access_key_id = os.getenv('AWS_ACCESS_KEY_ID')
aws_secret_access_key = os.getenv('AWS_SECRET_ACCESS_KEY')

# Create and start an API Gateway
gateway = ApiGateway("https://www.google.com", access_key_id=aws_access_key_id, secret_access_key=aws_secret_access_key)
gateway.start()

try:
    # Perform a search
    query = "OpenAI GPT-4"
    fields = ["title", "link", "snippet"]
    results = search(gateway, query, *fields, country="US", lang="en")
    print(results)

finally:
    # Shut down the API Gateway
    gateway.shutdown()

How to get AWS Credentials

To obtain AWS credentials, you need to create an IAM user in the AWS Management Console and assign the necessary permissions. Here’s a step-by-step guide:

How to Get AWS Credentials

  1. Sign in to AWS Management Console: Go to the AWS Management Console. Sign in with your AWS account credentials.

  2. Navigate to IAM (Identity and Access Management): In the AWS Management Console, search for "IAM" in the services search bar and select it.

  3. Create a New IAM User: In the IAM dashboard, click on "Users" in the left sidebar. Click the "Add user" button. Enter a username for the new user. Select the "Programmatic access" checkbox to generate an access key ID and secret access key.

  4. Set Permissions: Choose how you want to set permissions for the user. You can either: Attach existing policies directly (e.g., AmazonS3FullAccess for S3 access). Add the user to a group with the necessary permissions. Copy permissions from an existing user. Attach custom policies if needed.

  5. Review and Create User: Review the user details and permissions. Click "Create user".

  6. Download Credentials: After the user is created, you will see the access key ID and secret access key. Download the .csv file containing these credentials or copy them to a secure location. You will not be able to view the secret access key again.

  7. Set Environment Variables: On your local machine, set the AWS credentials as environment variables: your_secret_access_key

  8. Use Credentials in Your Application: Your application can now use these environment variables to authenticate with AWS services.

Metadata

Release files for gserp-api 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gserp-api 0.1.7
File Size Uploaded
gserp_api-0.1.7.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gserp-api 0.1.7
File Interpreter ABI Platform
gserp_api-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 kB

Release files / gserp_api-0.1.7.tar.gz

Download URL gserp_api-0.1.7.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9d2fbaa477461ace8fef71792ddb2efd507fd12f76e6cb24b29ca8a159d3e218
BLAKE2b-256 checksum
How to use checksums
9d7d8d67b6b26baf4214005ef5f1f649c3fe0b58f93763d47a83d5d741b073db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / gserp_api-0.1.7-py3-none-any.whl

Download URL gserp_api-0.1.7-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64f7a9928814b6934c339138150deb6093ef7744678d915c94984e7c96d21c6f
BLAKE2b-256 checksum
How to use checksums
26562c05fe0a56893f24ffdc44e2a47396a648b8b1569b73f2b63b6676b1f072
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page