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]
Release files for nubela-api 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nubela_api-0.2.0.tar.gz | 6.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nubela_api-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.2 kB
Release files / nubela_api-0.2.0.tar.gz
| Download URL | nubela_api-0.2.0.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d05612d0c16c1accd9b3e63d901cf9151bca8a61dc2442ae03f81a73a2e73f0f
|
|
BLAKE2b-256 checksum How to use checksums |
d85b7cad17a045315002e55a335872b37151daa6af9bb3289ec6106e54fc1517
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.11.9 Darwin/23.0.0
|
Release files / nubela_api-0.2.0-py3-none-any.whl
| Download URL | nubela_api-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
910a4434140895eba8579220c8368eb260a0ab181b8c4a9c5d62f08a089a880e
|
|
BLAKE2b-256 checksum How to use checksums |
771b3911e45281f8bd2eed821c6d03a1d03a12ce40f0cd4d55ea02af36f50402
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.11.9 Darwin/23.0.0
|