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 2.0.0

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 2.0.0
File Size Uploaded Provenance Actions
greip-2.0.0.tar.gz 15.8 kB Without provenance Details for greip-2.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 29.1 kB

Release files / greip-2.0.0.tar.gz

Download URL greip-2.0.0.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1ddbc1d5af676fcaa34059bc683cc8186c8853ce902fa276ddba12d7f694568c
BLAKE2b-256 checksum
How to use checksums
72358d707168487f5d35da04b6e665fad188bf209bc4de9c7cc106ec250ea136
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

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

Download URL greip-2.0.0-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0403ba7df1ca8ed2472615c6c6bda24a9638b2e9c3d65d62b275ae49042cdb26
BLAKE2b-256 checksum
How to use checksums
4149a54f4a454aa7fb5b4e1df053ddfd2da8a387d12c5f39a974007c46ff5cae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for greip 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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