Python client for https://boxapi.ir to crawl and read Instagram data.
Project description
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.
Note
I have not been able to test the DM API. Please make sure to test your implementation thoroughly before using it in production. If you encounter any issues, feel free to open an issue or submit a pull request.
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
Usage
General Instagram API
from boxapi import BoxApiClient
# Initialize BoxApiClient with Box API credentials
# IMPORTANT: MAKE SURE YOU ARE READING YOUR USERNAME AND PASSWORD FROM ENVIRONMENT VARIABLES
box_client = BoxApiClient("your_boxapi_username", "your_boxapi_password")
# Use the Instagram sub-client for general endpoints
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
# Initialize BoxApiClient with Box API credentials
box_client = BoxApiClient("your_boxapi_username", "your_boxapi_password")
# Use DM endpoints by providing the Instagram account credentials per call
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).
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file boxapi-1.0.2.tar.gz.
File metadata
- Download URL: boxapi-1.0.2.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.13.2 Linux/6.12.7-arch1-1.1-g14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bfe62eefc20718e598011b67d93b616f73335d61817c80f39c3e34b4e9d9666
|
|
| MD5 |
4857ebc95678a9d783c859187b03322c
|
|
| BLAKE2b-256 |
d25677ca693216435cb1485850729893821fb1a70cbbfa8f8ceeda2640d1e008
|
File details
Details for the file boxapi-1.0.2-py3-none-any.whl.
File metadata
- Download URL: boxapi-1.0.2-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.1 CPython/3.13.2 Linux/6.12.7-arch1-1.1-g14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfa30396955712469c4005c8137c82f5a63a200af9a89186594376513f5685b6
|
|
| MD5 |
3226c394ce0f66a6367f09a8480478bc
|
|
| BLAKE2b-256 |
6fc014dc3a0c86b221d0c4764942a7febb4186c04a049875db8c2d3a3da0e329
|