Skip to main content

A Python client for the Box API, implementing multiple third-party APIs like Instagram.

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.

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

# 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).

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.


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

boxapi-0.1.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

boxapi-0.1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file boxapi-0.1.0.tar.gz.

File metadata

  • Download URL: boxapi-0.1.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for boxapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2573c60d8c851b663de508827bb6b2cfafbc8e7f1aefb536411ea10e8891d497
MD5 313572457634274a8f7d170b288bd287
BLAKE2b-256 c5d632b2e70175bb9a67c3d53685deeace59e02959c7b9b19543641ee97fdc4b

See more details on using hashes here.

File details

Details for the file boxapi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: boxapi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for boxapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f8a5406dd2e4396499b868d3184cabcab42cebd7a0bf5923c694e08a96798a2
MD5 4a65613c5e9cbe428181b83e4c5ad369
BLAKE2b-256 fab3c7cc8203acd045f67191a0b16e083a0f4514fd969ce9a562d65e6ae55267

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page