BoxAPI Python
A Python client for interacting with the Box API for Instagram. This library wraps multiple Instagram endpoints including user information, media retrieval, and direct messages, allowing you to easily integrate Instagram functionality into your Python applications.
Table of Contents
Features
- Modular Design: Separate sub-clients for general Instagram endpoints and direct message (DM) endpoints.
- Easy Integration: Instantiate a single client to access the full functionality of the Box API.
- Flexible Usage: Use DM endpoints only when needed—save overhead if your application doesn’t require them.
- Extensible: Add additional endpoints or support for other platforms with minimal changes.
Installation
You can install the package via pip or Poetry.
Using pip
pip install boxapi
Using Poetry
poetry add boxapi
Project Structure
boxapi-python/
├── boxapi/
│ ├── __init__.py # Package initializer, re-exports public API
│ ├── constants.py # Global constants and endpoint paths
│ ├── client.py # BoxApiClient: top-level client for Box API
│ ├── instagram/
│ │ ├── __init__.py # Makes the instagram module importable
│ │ ├── api_client.py # InstagramAPIClient: general Instagram endpoints
│ │ └── dm_client.py # InstagramDMClient: direct message endpoints
│ └── utils/
│ └── base_url_session.py # Custom session with base URL support
├── examples/ # Example scripts demonstrating usage
├── tests/ # (Optional) Unit tests
├── pyproject.toml # Build configuration for Poetry
├── LICENSE # License file
└── README.md # This file
Usage
General Instagram API
from boxapi import BoxApiClient
box_client = BoxApiClient("your_boxapi_username", "your_boxapi_password")
user_info = box_client.instagram.get_user_info("leomessi")
print(user_info)
Direct Messages
Direct Message functionality is available through a separate sub-client. Instantiate it when needed:
from boxapi import BoxApiClient
box_client = BoxApiClient("your_boxapi_username", "your_boxapi_password")
login_response = box_client.instagram_dm.direct_login("insta_username", "insta_password")
print(login_response)
Examples
Check out the examples folder for complete scripts demonstrating how to use the different features of this library (It's a work in progress).
Contributing
Contributions are welcome! Feel free to fork the repository and submit pull requests. Please review our contributing guidelines for more information.
License
This project is licensed under the MIT License. See the LICENSE file for details.