No project description provided
Project description
Nubela API Client
This project provides a Python client for interacting with the Nubela API, specifically for querying LinkedIn profiles.
Features
- Easy-to-use interface for querying Nubela profiles
- Caching mechanism to store and reuse previous query results
- Offline mode for development and testing
- Configurable settings using environment variables
Installation
To install the required dependencies, run:
pip install requests pydantic-settings
Usage
Basic usage
from nubela_api import NubelaAPI, NubelaSettings
Create settings (API key can be set via NUBELA_API_KEY environment variable)
settings = NubelaSettings(api_key="your_api_key_here")
Initialize the API client
api = NubelaAPI(settings=settings, offline=False)
Query a LinkedIn profile
linkedin_url = "https://www.linkedin.com/in/example-profile" response = api.query_linkedin(linkedin_url)
Access the response data
print(response.full_name) print(response.occupation)
Custom parameters
You can pass custom parameters to the API call:
custom_params = { "linkedin_profile_url": "https://www.linkedin.com/in/example-profile", "extra": "include", "skills": "include", } response = api.query(custom_params)
Caching
The client automatically caches responses. To disable caching for a specific query:
response = api.query_linkedin(linkedin_url, use_cache=False)
Offline mode
For development or testing, you can enable offline mode:
api = NubelaAPI(settings=settings, offline=True)
This will raise a ValueError if an API call is attempted.
Configuration
You can configure the API client using environment variables:
- NUBELA_API_KEY: Your Nubela API key
- NUBELA_API_ENDPOINT: The API endpoint (default: "https://nubela.co/proxycurl/api/v2/linkedin")
Error Handling
The client will raise exceptions for various error conditions:
- ValueError: If the API key is missing or if trying to make an API call in offline mode
- OfflineError: Custom exception for offline-related errors (not currently used in the provided code)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
[Add your chosen license here]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nubela_api-0.2.0.tar.gz
.
File metadata
- Download URL: nubela_api-0.2.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.9 Darwin/23.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d05612d0c16c1accd9b3e63d901cf9151bca8a61dc2442ae03f81a73a2e73f0f |
|
MD5 | d9ae9ae41c700c9708465cd0f82a7307 |
|
BLAKE2b-256 | d85b7cad17a045315002e55a335872b37151daa6af9bb3289ec6106e54fc1517 |
File details
Details for the file nubela_api-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: nubela_api-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.9 Darwin/23.0.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 910a4434140895eba8579220c8368eb260a0ab181b8c4a9c5d62f08a089a880e |
|
MD5 | 828805d75fb0af5210190a9b88cea488 |
|
BLAKE2b-256 | 771b3911e45281f8bd2eed821c6d03a1d03a12ce40f0cd4d55ea02af36f50402 |