Skip to main content

Open Source Google SERP API

Project description

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.

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

gserp_api-0.1.6.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gserp_api-0.1.6-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file gserp_api-0.1.6.tar.gz.

File metadata

  • Download URL: gserp_api-0.1.6.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for gserp_api-0.1.6.tar.gz
Algorithm Hash digest
SHA256 e42db6d57c3343f92168b318a399f08ef6144a23a4511533f9853eda821f46fb
MD5 07547403a3d01a7fe3b003f7ce32fda7
BLAKE2b-256 a88171b6cf8e5d6a7eccca8398051f6b82a258978210e4fe223cbe09cf19ccb9

See more details on using hashes here.

File details

Details for the file gserp_api-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: gserp_api-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for gserp_api-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e02e68bf7d4ec2ef6a0cfa9c31ee3754158ec05e99307c8ba1f2166cd748600a
MD5 2f540068f45e8501ce905c8db92a9d20
BLAKE2b-256 67301b34047779a505fed400fdbaacef9445336cceb1c40be7fad791fe216450

See more details on using hashes here.

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