python-sage-meta


Namepython-sage-meta JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/sageteamorg/python-sage-meta
SummaryA python package for managing Meta GraphQL API.
upload_time2024-08-01 09:30:42
maintainerNone
docs_urlNone
authorradin qahremani
requires_python<4.0,>=3.11
licenseMIT
keywords python facebook-api facebook meta python-packages
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # python-sage-meta
![Black](https://img.shields.io/badge/code%20style-black-000000.svg)
![Pylint](https://img.shields.io/badge/pylint-9-brightgreen)
[![codecov](https://codecov.io/gh/sageteamorg/python-sage-meta/graph/badge.svg?token=I10LGK910X)](https://codecov.io/gh/sageteamorg/python-sage-meta)

![PyPI release](https://img.shields.io/pypi/v/python-sage-meta "python-sage-meta")
![Supported Python versions](https://img.shields.io/pypi/pyversions/python-sage-meta "python-sage-meta")
![Documentation](https://img.shields.io/readthedocs/python-sage-meta "python-sage-meta")
![License](https://img.shields.io/badge/license-MIT-red)
![GitHub last commit](https://img.shields.io/github/last-commit/sageteamorg/python-sage-meta)

## Table of Contents
- [python-sage-meta](#python-sage-meta)
  - [Table of Contents](#table-of-contents)
  - [Introduction](#introduction)
  - [Features](#features)
  - [Installation](#installation)
  - [Configuration](#configuration)
    - [Single User Configuration](#single-user-configuration)
    - [Multi-User Configuration](#multi-user-configuration)
  - [Examples](#examples)
    - [Example 1: Account Management](#example-1-account-management)
    - [Example 2: Media Management](#example-2-media-management)
    - [Example 3: Content Publishing](#example-3-content-publishing)
  - [License](#license)

## Introduction
`python-sage-meta` is a comprehensive Python package designed to simplify the management of Facebook and Instagram operations through the Facebook Graph API. It provides easy-to-use interfaces for managing accounts, media, comments, hashtags, content publishing, and product tagging. This package is ideal for developers looking to integrate social media functionalities into their applications seamlessly.

## Features
- Account management for Facebook and Instagram accounts
- Media management for uploading and handling Instagram photos, videos, and carousels
- Comment management for Instagram comments, mentions, and replies
- Hashtag management for searching and retrieving hashtag information
- Content publishing for Instagram photos, videos, and carousels
- Product tagging for Instagram media

## Installation
To install `python-sage-meta`, use pip:
```bash
pip install python-sage-meta
```

## Configuration

The sage_meta package requires certain configuration variables to establish and manage interactions with the Facebook Graph API effectively.

This library offers flexibility to accommodate both single-user and multi-user scenarios:

  - **Single User Configuration**: If you are integrating this library into a Django application or any other single-user setup, you can define the necessary variables within your application's settings. This approach ensures that the configuration behaves as a single user, maintaining a consistent and straightforward setup.

 - **Multi-User Configuration**: For applications requiring support for multiple users, such as a web application with various user accounts, the library allows you to dynamically change the configuration variables upon each instantiation. This flexibility ensures that each user can have their own Facebook Graph API settings, enabling personalized social media management.

Configuration Variables

To configure the sage_meta package, you need to set the following variables:

  Access Token: The Facebook Graph API access token used for authentication.

Example Configuration

Here is an example of how to set up these variables in your project:

```python
  ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"
```
### Single User Configuration

For a single-user setup, you can configure the sage_meta package as follows:

```python

    import sage_meta

    ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"

    fb_client = sage_meta.FacebookClient(
        access_token=ACCESS_TOKEN
    )
```
### Multi-User Configuration

For multi-user applications, you can dynamically configure the sage_meta package upon each instantiation:

```python

    import sage_meta

    class UserService:
        def __init__(self, user_access_token):
            self.fb_client = sage_meta.FacebookClient(
                access_token=user_access_token
            )

        def get_user_data(self):
            return self.fb_client.get_user_data()

    # Example usage
    user_service = UserService("USER_SPECIFIC_ACCESS_TOKEN")
    user_data = user_service.get_user_data()
```
This example demonstrates how to dynamically configure the package for different users, ensuring personalized management of Facebook and Instagram operations for each user.

Ensure that your configuration is securely managed, especially the access tokens, to prevent unauthorized access to your Facebook and Instagram accounts.


## Examples

### Example 1: Account Management

This example demonstrates how to manage Facebook and Instagram accounts using the `AccountHandler` class.

```python
from sage_meta.services.base import FacebookClient

ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"
fb_client = FacebookClient(access_token=ACCESS_TOKEN)
accounts = fb_client.account_handler.get_accounts()
for account in accounts:
    print(account.name)
```

### Example 2: Media Management

This example demonstrates how to manage media for Instagram using the `MediaHandler` class.

```python
from sage_meta.services.base import FacebookClient

ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"
fb_client = FacebookClient(access_token=ACCESS_TOKEN)
media_items = fb_client.media_handler.get_instagram_media(insta_id="INSTAGRAM_BUSINESS_ACCOUNT_ID")
for media in media_items:
    print(media.caption)
```


### Example 3: Content Publishing

This example demonstrates how to publish content to Instagram using the `ContentPublishing` class.

```python
from sage_meta.services.base import FacebookClient

ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"
fb_client = FacebookClient(access_token=ACCESS_TOKEN)
publish_response = fb_client.content_publisher.publish_photo(
    image_url="https://example.com/image.jpg",
    caption="This is an example caption."
)
print(publish_response)
```

## License
This project is licensed under the MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sageteamorg/python-sage-meta",
    "name": "python-sage-meta",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.11",
    "maintainer_email": null,
    "keywords": "python, facebook-api, facebook, meta, python-packages",
    "author": "radin qahremani",
    "author_email": "radin@sageteam.org",
    "download_url": "https://files.pythonhosted.org/packages/57/17/0212f08a9c5100c4bfeb16528fa421caa976f4cb0abde63b7be55250db1f/python_sage_meta-0.1.0.tar.gz",
    "platform": null,
    "description": "# python-sage-meta\n![Black](https://img.shields.io/badge/code%20style-black-000000.svg)\n![Pylint](https://img.shields.io/badge/pylint-9-brightgreen)\n[![codecov](https://codecov.io/gh/sageteamorg/python-sage-meta/graph/badge.svg?token=I10LGK910X)](https://codecov.io/gh/sageteamorg/python-sage-meta)\n\n![PyPI release](https://img.shields.io/pypi/v/python-sage-meta \"python-sage-meta\")\n![Supported Python versions](https://img.shields.io/pypi/pyversions/python-sage-meta \"python-sage-meta\")\n![Documentation](https://img.shields.io/readthedocs/python-sage-meta \"python-sage-meta\")\n![License](https://img.shields.io/badge/license-MIT-red)\n![GitHub last commit](https://img.shields.io/github/last-commit/sageteamorg/python-sage-meta)\n\n## Table of Contents\n- [python-sage-meta](#python-sage-meta)\n  - [Table of Contents](#table-of-contents)\n  - [Introduction](#introduction)\n  - [Features](#features)\n  - [Installation](#installation)\n  - [Configuration](#configuration)\n    - [Single User Configuration](#single-user-configuration)\n    - [Multi-User Configuration](#multi-user-configuration)\n  - [Examples](#examples)\n    - [Example 1: Account Management](#example-1-account-management)\n    - [Example 2: Media Management](#example-2-media-management)\n    - [Example 3: Content Publishing](#example-3-content-publishing)\n  - [License](#license)\n\n## Introduction\n`python-sage-meta` is a comprehensive Python package designed to simplify the management of Facebook and Instagram operations through the Facebook Graph API. It provides easy-to-use interfaces for managing accounts, media, comments, hashtags, content publishing, and product tagging. This package is ideal for developers looking to integrate social media functionalities into their applications seamlessly.\n\n## Features\n- Account management for Facebook and Instagram accounts\n- Media management for uploading and handling Instagram photos, videos, and carousels\n- Comment management for Instagram comments, mentions, and replies\n- Hashtag management for searching and retrieving hashtag information\n- Content publishing for Instagram photos, videos, and carousels\n- Product tagging for Instagram media\n\n## Installation\nTo install `python-sage-meta`, use pip:\n```bash\npip install python-sage-meta\n```\n\n## Configuration\n\nThe sage_meta package requires certain configuration variables to establish and manage interactions with the Facebook Graph API effectively.\n\nThis library offers flexibility to accommodate both single-user and multi-user scenarios:\n\n  - **Single User Configuration**: If you are integrating this library into a Django application or any other single-user setup, you can define the necessary variables within your application's settings. This approach ensures that the configuration behaves as a single user, maintaining a consistent and straightforward setup.\n\n - **Multi-User Configuration**: For applications requiring support for multiple users, such as a web application with various user accounts, the library allows you to dynamically change the configuration variables upon each instantiation. This flexibility ensures that each user can have their own Facebook Graph API settings, enabling personalized social media management.\n\nConfiguration Variables\n\nTo configure the sage_meta package, you need to set the following variables:\n\n  Access Token: The Facebook Graph API access token used for authentication.\n\nExample Configuration\n\nHere is an example of how to set up these variables in your project:\n\n```python\n  ACCESS_TOKEN = \"YOUR_ACCESS_TOKEN\"\n```\n### Single User Configuration\n\nFor a single-user setup, you can configure the sage_meta package as follows:\n\n```python\n\n    import sage_meta\n\n    ACCESS_TOKEN = \"YOUR_ACCESS_TOKEN\"\n\n    fb_client = sage_meta.FacebookClient(\n        access_token=ACCESS_TOKEN\n    )\n```\n### Multi-User Configuration\n\nFor multi-user applications, you can dynamically configure the sage_meta package upon each instantiation:\n\n```python\n\n    import sage_meta\n\n    class UserService:\n        def __init__(self, user_access_token):\n            self.fb_client = sage_meta.FacebookClient(\n                access_token=user_access_token\n            )\n\n        def get_user_data(self):\n            return self.fb_client.get_user_data()\n\n    # Example usage\n    user_service = UserService(\"USER_SPECIFIC_ACCESS_TOKEN\")\n    user_data = user_service.get_user_data()\n```\nThis example demonstrates how to dynamically configure the package for different users, ensuring personalized management of Facebook and Instagram operations for each user.\n\nEnsure that your configuration is securely managed, especially the access tokens, to prevent unauthorized access to your Facebook and Instagram accounts.\n\n\n## Examples\n\n### Example 1: Account Management\n\nThis example demonstrates how to manage Facebook and Instagram accounts using the `AccountHandler` class.\n\n```python\nfrom sage_meta.services.base import FacebookClient\n\nACCESS_TOKEN = \"YOUR_ACCESS_TOKEN\"\nfb_client = FacebookClient(access_token=ACCESS_TOKEN)\naccounts = fb_client.account_handler.get_accounts()\nfor account in accounts:\n    print(account.name)\n```\n\n### Example 2: Media Management\n\nThis example demonstrates how to manage media for Instagram using the `MediaHandler` class.\n\n```python\nfrom sage_meta.services.base import FacebookClient\n\nACCESS_TOKEN = \"YOUR_ACCESS_TOKEN\"\nfb_client = FacebookClient(access_token=ACCESS_TOKEN)\nmedia_items = fb_client.media_handler.get_instagram_media(insta_id=\"INSTAGRAM_BUSINESS_ACCOUNT_ID\")\nfor media in media_items:\n    print(media.caption)\n```\n\n\n### Example 3: Content Publishing\n\nThis example demonstrates how to publish content to Instagram using the `ContentPublishing` class.\n\n```python\nfrom sage_meta.services.base import FacebookClient\n\nACCESS_TOKEN = \"YOUR_ACCESS_TOKEN\"\nfb_client = FacebookClient(access_token=ACCESS_TOKEN)\npublish_response = fb_client.content_publisher.publish_photo(\n    image_url=\"https://example.com/image.jpg\",\n    caption=\"This is an example caption.\"\n)\nprint(publish_response)\n```\n\n## License\nThis project is licensed under the MIT License.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A python package for managing Meta GraphQL API.",
    "version": "0.1.0",
    "project_urls": {
        "Documentation": "https://python-sage-meta.readthedocs.io/en/latest/",
        "Homepage": "https://github.com/sageteamorg/python-sage-meta",
        "Issues": "https://github.com/sageteamorg/python-sage-meta/issues",
        "Repository": "https://github.com/sageteamorg/python-sage-meta",
        "Source Code": "https://github.com/sageteamorg/python-sage-meta"
    },
    "split_keywords": [
        "python",
        " facebook-api",
        " facebook",
        " meta",
        " python-packages"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a56eb4e752d6765aaa20753c3fb39e067d7ea89f4d2c36429bbd48afafeb3eb2",
                "md5": "b3cb03bb74314dcd3d90e3615b70a34e",
                "sha256": "1363551c9c94a3205bd192d8abe0a31e81427b910711f942095cb0374a1c8a13"
            },
            "downloads": -1,
            "filename": "python_sage_meta-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b3cb03bb74314dcd3d90e3615b70a34e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.11",
            "size": 17477,
            "upload_time": "2024-08-01T09:30:40",
            "upload_time_iso_8601": "2024-08-01T09:30:40.725772Z",
            "url": "https://files.pythonhosted.org/packages/a5/6e/b4e752d6765aaa20753c3fb39e067d7ea89f4d2c36429bbd48afafeb3eb2/python_sage_meta-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "57170212f08a9c5100c4bfeb16528fa421caa976f4cb0abde63b7be55250db1f",
                "md5": "4c53554bb0311dea5a214a8993414237",
                "sha256": "1889c50ba7846ce16930595815ee4600679edb93b919836b081a1340bb64dac4"
            },
            "downloads": -1,
            "filename": "python_sage_meta-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4c53554bb0311dea5a214a8993414237",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.11",
            "size": 14181,
            "upload_time": "2024-08-01T09:30:42",
            "upload_time_iso_8601": "2024-08-01T09:30:42.401070Z",
            "url": "https://files.pythonhosted.org/packages/57/17/0212f08a9c5100c4bfeb16528fa421caa976f4cb0abde63b7be55250db1f/python_sage_meta-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-01 09:30:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sageteamorg",
    "github_project": "python-sage-meta",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "python-sage-meta"
}
        
Elapsed time: 0.80004s