Skip to main content

Greip Python SDK

The Greip Python SDK allows you to easily interact with the Greip API for various functionalities, including IP geolocation, threat intelligence, email validation, and more.

Report Issue · Request Feature · Greip Website · Documentation

GitHub code size in bytes    License: Apache 2.0    API Status


Installation

You can install the Greip SDK via pip. Run the following command:

pip install greip

Usage

To use the Greip SDK, you need to initialize a Greip object with your API token. Here’s a basic example:

import greip

# Initialize the Greip instance with your API token
greip_instance = greip.Greip("YOUR_API_TOKEN")

# Example: Lookup IP information
response = greip_instance.lookup("1.1.1.1")
print(response)  # Access properties like response.ip, response.country, etc.

Methods

The Greip SDK provides various methods to interact with the API:

  • lookup(ip, params=None, lang=“EN”): Get geolocation information about an IP address.
  • threats(ip): Get information about threats related to an IP address.
  • bulk_lookup(ips, params=None, lang=“EN”): Get geolocation information about multiple IP addresses.
  • country(country_code, params=None, lang=“EN”): Get information about a country.
  • profanity(text, params=None, lang=“EN”): Check if a text contains profanity.
  • asn(asn): Get information about an ASN.
  • email(email): Validate an email address.
  • phone(phone, country_code): Validate/lookup a phone number.
  • iban(iban): Validate/lookup an IBAN number.
  • payment(data): Check if a payment transaction is fraudulent.

Example of Method Usage

# Lookup country information
country_info = greip_instance.country("US")
print(country_info)  # Access properties like country_info.countryName, country_info.population, etc.

Development mode

If you need to test the integration without affecting your account subscription usage you can simple set the test_mode attribute to True when you initialize the Greip instance, here's an example:

greip_instance = greip.Greip("YOUR_API_TOKEN", test_mode=True)

Error Handling

The SDK raises ValueError for invalid input parameters and requests.exceptions.RequestException for issues related to API requests. Ensure you handle exceptions properly in your code.

try:
    response = greip_instance.lookup("INVALID_IP")
except ValueError as ve:
    print(f"ValueError: {ve}")
except requests.exceptions.RequestException as re:
    print(f"RequestException: {re}")

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any improvements or bugs you encounter.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Metadata

Release files for greip 1.0.1

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

Source distribution (sdist)

Source distribution for greip 1.0.1
File Size Uploaded
greip-1.0.1.tar.gz 16.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for greip 1.0.1
File Interpreter ABI Platform
greip-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 29.7 kB

Release files / greip-1.0.1.tar.gz

Download URL greip-1.0.1.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3688e479296526aaa8d6749580b546f6b053bd9c1a860f4e91848801687eb419
BLAKE2b-256 checksum
How to use checksums
af331340eaaa286c6c3678972d53408a0d24ac5d023c988d962b69b6a00897f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.5

Release files / greip-1.0.1-py3-none-any.whl

Download URL greip-1.0.1-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d64e0f8d42494e8e4875ab04a34e806453b426e779c2db7e0936da6fb8ed2a44
BLAKE2b-256 checksum
How to use checksums
133f1a5f50e8056d0c45bc64ed31be50a48a7cc8e3d47cc4e1657dee413be0a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.5

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

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