DEV Community

Cover image for Introducing the SharpAPI Python Client SDK
Dawid Makowski
Dawid Makowski

Posted on • Edited on

Introducing the SharpAPI Python Client SDK

Photo by Brecht Corbeel on Unsplash

🚀 Why SharpAPI Python Client SDK?

SharpAPI PyPI The SharpAPI Python Client SDK bridges the gap between your Python applications and SharpAPI's robust AI-powered services.

By leveraging this SDK, Python developers can effortlessly incorporate advanced functionalities such as sentiment analysis, content generation, data categorization, and more, without delving deep into complex API integrations.

Check the Python SDK directly at Python Package Index ➺ PyPI.org

Code Samples & Real-World Use Cases

For Python developers looking to dive into SharpAPI, our SharpAPI Python Test Suite on GitHub is the perfect starting point. This repository offers hands-on code samples and use case examples, covering a wide range of SharpAPI's powerful capabilities, from resume parsing to SEO tag generation. With step-by-step instructions and an interactive CLI, developers can easily test out functionalities, simulate diverse workflows, and integrate AI-powered automation into their Python projects faster. Check it out and explore the potential of SharpAPI's Python SDK to streamline your development process today!

Key Benefits:

  • Ease of Integration: Simplify the process of connecting your Python applications to SharpAPI services with straightforward installation and intuitive methods.
  • Comprehensive Features: Access a wide range of AI-powered tools tailored for various industries, enabling diverse use cases from automating marketing content to enhancing HR processes.
  • Reliability and Performance: The SDK ensures efficient communication with SharpAPI endpoints, handling responses and errors gracefully.

🌟 Features at a Glance

The SharpAPI Python Client SDK is packed with features designed to cater to multiple sectors:

E-Commerce

  • Generate Engaging Product Introductions: Craft compelling product descriptions that captivate your audience.
  • Create Personalized Thank-You Emails: Automate the generation of tailored thank-you messages to enhance customer relationships.
  • Streamline Product Categorization: Automatically categorize products to optimize inventory management and user navigation.
  • Perform Sentiment Analysis on Product Reviews: Gain insights into customer feedback to inform product development and marketing strategies.

Content & Marketing Automation

  • Translate Text for a Global Audience: Break language barriers by translating content seamlessly.
  • Paraphrase and Proofread Any Text: Enhance the quality and clarity of your content with automated paraphrasing and proofreading.
  • Detect Spam Content: Maintain content integrity by identifying and filtering out spam.
  • Extract Contact Information: Automatically extract emails and phone numbers from text to streamline lead generation.
  • Summarize Content and Generate Keywords/Tags: Condense lengthy content and generate relevant keywords to improve SEO.
  • Generate SEO Meta Tags: Boost your website's search engine visibility with AI-generated SEO tags.

HR Tech

  • Generate Job Descriptions: Create detailed and attractive job postings effortlessly.
  • Identify Related Job Positions and Skills: Discover related roles and necessary skills to inform recruitment strategies.
  • Parse and Extract Information from Resumes: Automate resume parsing to streamline the hiring process.

Travel, Tourism & Hospitality

  • Analyze Sentiment in Travel Reviews: Understand customer sentiments to enhance travel experiences.
  • Categorize Tours, Activities, and Hospitality Products: Organize offerings efficiently to improve user experience and management.

📦 Installation

Getting started with the SharpAPI Python Client SDK is quick and easy. You can install it via PyPI using pip or through Poetry for dependency management.

Using pip:

pip install sharpapi-python-client
Enter fullscreen mode Exit fullscreen mode

Using Poetry:

poetry add sharpapi-python-client
Enter fullscreen mode Exit fullscreen mode

🔧 Configuration

1. Obtain Your SharpAPI API Key

To use the SDK, you need an API key from SharpAPI. If you haven't already, sign up at SharpAPI.com and obtain your unique API key.

2. Set Up Environment Variables

For security and convenience, it's best to store your API key in an environment variable. Create a .env file in your project's root directory:

SHARP_API_KEY=your_sharpapi_api_key_here
Enter fullscreen mode Exit fullscreen mode

Ensure that .env is included in your .gitignore to prevent accidental exposure of your API key.

3. Loading Environment Variables

The SDK utilizes python-dotenv to load environment variables. Initialize it in your application before using the SDK:

from dotenv import load_dotenv

load_dotenv()  # Loads environment variables from .env file
Enter fullscreen mode Exit fullscreen mode

💻 Usage

The SharpAPI Python Client SDK offers a straightforward interface to interact with various SharpAPI endpoints. Below are examples demonstrating how to utilize some of its key functionalities.

🛠 Basic Example: Generating Product Categories

from sharpapi import SharpApiService

# Initialize the SharpApiService with your API key
sharp_api = SharpApiService(api_key='YOUR_SHARP_API_KEY')

try:
    # Generate Product Categories
    status_url = sharp_api.product_categories(
        product_name='Lenovo Chromebook Laptop (2023), 14" FHD Touchscreen Slim 3, 8-Core MediaTek Kompanio 520 CPU, 4GB RAM, 128GB Storage',
        language='German',  # Optional
        max_quantity=400,   # Optional
        voice_tone='Neutral',  # Optional
        context='Optional current e-store categories'  # Optional
    )

    # Fetch and print the results
    result_sharp_api_job = sharp_api.fetch_results(status_url)
    print(result_sharp_api_job.get_result_json())
except Exception as e:
    print(f"An error occurred: {e}")
Enter fullscreen mode Exit fullscreen mode

🛠 Advanced Example: Parsing a Resume

from sharpapi import SharpApiService

# Initialize the SharpApiService with your API key
sharp_api = SharpApiService(api_key='YOUR_SHARP_API_KEY')

try:
    # Parse Resume
    status_url = sharp_api.parse_resume(
        file_path='path/to/sample_resume.pdf',
        language='English'  # Optional
    )

    # Fetch and print the parsed resume data
    parsed_resume = sharp_api.fetch_results(status_url)
    print(parsed_resume.get_result_json())
except Exception as e:
    print(f"An error occurred: {e}")
Enter fullscreen mode Exit fullscreen mode

🛠 Example: Performing Sentiment Analysis on Product Reviews

from sharpapi import SharpApiService

# Initialize the SharpApiService with your API key
sharp_api = SharpApiService(api_key='YOUR_SHARP_API_KEY')

try:
    # Analyze Sentiment
    review_text = "This product exceeded my expectations! Highly recommended."
    status_url = sharp_api.product_review_sentiment(review_text)

    # Fetch and print the sentiment analysis results
    sentiment_result = sharp_api.fetch_results(status_url)
    print(sentiment_result.get_result_json())
except Exception as e:
    print(f"An error occurred: {e}")
Enter fullscreen mode Exit fullscreen mode

Happy Coding! 🚀

Top comments (0)