bsky-bridge


Namebsky-bridge JSON
Version 1.0.11 PyPI version JSON
download
home_pagehttps://github.com/0xExal/bsky-bridge
SummaryA Python interface for interacting with the BlueSky social network's API.
upload_time2025-02-02 17:23:35
maintainerNone
docs_urlNone
authorExal
requires_python>=3.6
licenseNone
keywords bluesky api bluesky api python bridge social network social network api bluesky python post content bluesky post open-source python open-source api
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
              # bsky-bridge: A Python Library for the BlueSky API

  `bsky-bridge` is a Python library designed to bridge the interaction between Python applications and the BlueSky Social Network via its API.

  ## Table of Contents

  - [Features](#features)
  - [Installation](#installation)
  - [Usage](#usage)
    - [Creating a Session](#creating-a-session)
    - [Posting Content](#posting-content)
    - [Posting Images](#posting-images)
    - [Posting with Language Specification](#Posting-with-Language-Specification)
  - [Contribution](#contribution)
  - [License](#license)

  ## Features

  - Easy authentication with the BlueSky API.
  - Functions to post text and images to BlueSky via the API.
  - Parser to identify and extract mentions (@handle), links (URLs), and hashtags (#tags) from text, useful for processing and formatting posts.
  - Session persistence and automatic token refresh to handle authentication efficiently and prevent rate limiting.
  - Optional Language Specification: Users can manually specify the languages of their posts using the langs parameter to enhance filtering and parsing capabilities.

  ## Installation

  ```bash
  pip install bsky-bridge
  ```

  ## Usage

  ### Creating a Session

  Start by establishing a session with your BlueSky handle and App passwords (To be created in your account settings).
  ```python
  from bsky_bridge import BskySession

  session = BskySession("your_handle.bsky.social", "your_APPpassword")
  ```

  You can also specify a custom directory for storing the session file (By default it will be ".bsky_sessions" in the current directory).
  ```python
  from bsky_bridge import BskySession

  session = BskySession("your_handle.bsky.social", "your_APPpassword", "/custom/path/to/sessions")
  ```

  ### Posting Content

  After initializing a session, you can post text to BlueSky:

  ```python
  from bsky_bridge import BskySession, post_text

  session = BskySession("your_handle.bsky.social", "your_APPpassword")

  response = post_text(session, "Hello BlueSky!")
  print(response)
  ```

  ### Posting Images

  To post images along with text, you can use the `post_image` method:

  ```python
  from bsky_bridge import BskySession, post_image

  session = BskySession("your_handle.bsky.social", "your_APPpassword")

  postText = "Check out this cool image!"
  imagePath = "path_to_your_image.jpeg"
  altText = "An awesome image"
  response = post_image(session, postText, imagePath, altText)
  print(response)
  ```

  **Note**: The library automatically handles resizing and compressing larger images to ensure they do not exceed 1 MB in size, all while maintaining a quality balance. This ensures efficient and quick image uploads.

  ### Posting with Language Specification
  To specify the languages of your post, simply add the langs parameter.

  ```python
  from bsky_bridge import BskySession, post_image

  # Initialize the session
  session = BskySession("your_handle.bsky.social", "your_APPpassword")

  # Define your post text and specify languages
  text = "Bonjour le monde!\nHello World!"
  specified_langs = ["fr", "en-US"]

  # Post the text with specified languages
  response = post_text(session, text, langs=specified_langs)
  print(response)


  # Define your post text, image path, alt text, and specify languages
  post_text_content = "Check out this beautiful sunset!\nมองดูพระอาทิตย์ตกที่สวยงามนี้!"
  image_path = "sunset.jpeg"
  alt_text = "Sunset over the mountains"
  specified_langs = ["en-US", "th"]

  # Post the image with specified languages
  response = post_image(
      session,
      post_text_content,
      image_path,
      alt_text,
      langs=specified_langs
  )
  print(response)
  ```

  ## Contribution

  Contributions are welcome! Please submit issues for any bug or problem you discover, and pull requests for new features or fixes.

  ## License

  [MIT License](LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/0xExal/bsky-bridge",
    "name": "bsky-bridge",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "bluesky, api, bluesky api, python, bridge, social network, social network api, bluesky python, post content, bluesky post, open-source Python, open-source API",
    "author": "Exal",
    "author_email": "hello@exal.sh",
    "download_url": "https://files.pythonhosted.org/packages/41/89/6deac89e84ef4b09b1c3b1cc1260f00f1cfceae253b6a90b0aaf5147d20e/bsky_bridge-1.0.11.tar.gz",
    "platform": null,
    "description": "  # bsky-bridge: A Python Library for the BlueSky API\n\n  `bsky-bridge` is a Python library designed to bridge the interaction between Python applications and the BlueSky Social Network via its API.\n\n  ## Table of Contents\n\n  - [Features](#features)\n  - [Installation](#installation)\n  - [Usage](#usage)\n    - [Creating a Session](#creating-a-session)\n    - [Posting Content](#posting-content)\n    - [Posting Images](#posting-images)\n    - [Posting with Language Specification](#Posting-with-Language-Specification)\n  - [Contribution](#contribution)\n  - [License](#license)\n\n  ## Features\n\n  - Easy authentication with the BlueSky API.\n  - Functions to post text and images to BlueSky via the API.\n  - Parser to identify and extract mentions (@handle), links (URLs), and hashtags (#tags) from text, useful for processing and formatting posts.\n  - Session persistence and automatic token refresh to handle authentication efficiently and prevent rate limiting.\n  - Optional Language Specification: Users can manually specify the languages of their posts using the langs parameter to enhance filtering and parsing capabilities.\n\n  ## Installation\n\n  ```bash\n  pip install bsky-bridge\n  ```\n\n  ## Usage\n\n  ### Creating a Session\n\n  Start by establishing a session with your BlueSky handle and App passwords (To be created in your account settings).\n  ```python\n  from bsky_bridge import BskySession\n\n  session = BskySession(\"your_handle.bsky.social\", \"your_APPpassword\")\n  ```\n\n  You can also specify a custom directory for storing the session file (By default it will be \".bsky_sessions\" in the current directory).\n  ```python\n  from bsky_bridge import BskySession\n\n  session = BskySession(\"your_handle.bsky.social\", \"your_APPpassword\", \"/custom/path/to/sessions\")\n  ```\n\n  ### Posting Content\n\n  After initializing a session, you can post text to BlueSky:\n\n  ```python\n  from bsky_bridge import BskySession, post_text\n\n  session = BskySession(\"your_handle.bsky.social\", \"your_APPpassword\")\n\n  response = post_text(session, \"Hello BlueSky!\")\n  print(response)\n  ```\n\n  ### Posting Images\n\n  To post images along with text, you can use the `post_image` method:\n\n  ```python\n  from bsky_bridge import BskySession, post_image\n\n  session = BskySession(\"your_handle.bsky.social\", \"your_APPpassword\")\n\n  postText = \"Check out this cool image!\"\n  imagePath = \"path_to_your_image.jpeg\"\n  altText = \"An awesome image\"\n  response = post_image(session, postText, imagePath, altText)\n  print(response)\n  ```\n\n  **Note**: The library automatically handles resizing and compressing larger images to ensure they do not exceed 1 MB in size, all while maintaining a quality balance. This ensures efficient and quick image uploads.\n\n  ### Posting with Language Specification\n  To specify the languages of your post, simply add the langs parameter.\n\n  ```python\n  from bsky_bridge import BskySession, post_image\n\n  # Initialize the session\n  session = BskySession(\"your_handle.bsky.social\", \"your_APPpassword\")\n\n  # Define your post text and specify languages\n  text = \"Bonjour le monde!\\nHello World!\"\n  specified_langs = [\"fr\", \"en-US\"]\n\n  # Post the text with specified languages\n  response = post_text(session, text, langs=specified_langs)\n  print(response)\n\n\n  # Define your post text, image path, alt text, and specify languages\n  post_text_content = \"Check out this beautiful sunset!\\n\u0e21\u0e2d\u0e07\u0e14\u0e39\u0e1e\u0e23\u0e30\u0e2d\u0e32\u0e17\u0e34\u0e15\u0e22\u0e4c\u0e15\u0e01\u0e17\u0e35\u0e48\u0e2a\u0e27\u0e22\u0e07\u0e32\u0e21\u0e19\u0e35\u0e49!\"\n  image_path = \"sunset.jpeg\"\n  alt_text = \"Sunset over the mountains\"\n  specified_langs = [\"en-US\", \"th\"]\n\n  # Post the image with specified languages\n  response = post_image(\n      session,\n      post_text_content,\n      image_path,\n      alt_text,\n      langs=specified_langs\n  )\n  print(response)\n  ```\n\n  ## Contribution\n\n  Contributions are welcome! Please submit issues for any bug or problem you discover, and pull requests for new features or fixes.\n\n  ## License\n\n  [MIT License](LICENSE)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python interface for interacting with the BlueSky social network's API.",
    "version": "1.0.11",
    "project_urls": {
        "Homepage": "https://github.com/0xExal/bsky-bridge"
    },
    "split_keywords": [
        "bluesky",
        " api",
        " bluesky api",
        " python",
        " bridge",
        " social network",
        " social network api",
        " bluesky python",
        " post content",
        " bluesky post",
        " open-source python",
        " open-source api"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8edc6673cbe468aa8effbece1c5057f0c8a9f8b6af77bcf6f50bf7823c328fa3",
                "md5": "0f0702323de6d90d3c8cc9c379dea630",
                "sha256": "96fe7e57f30dc1ae809550814b5722cd7861db6415439e3c3bd9198fc1dc4c90"
            },
            "downloads": -1,
            "filename": "bsky_bridge-1.0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0f0702323de6d90d3c8cc9c379dea630",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 9741,
            "upload_time": "2025-02-02T17:23:33",
            "upload_time_iso_8601": "2025-02-02T17:23:33.645160Z",
            "url": "https://files.pythonhosted.org/packages/8e/dc/6673cbe468aa8effbece1c5057f0c8a9f8b6af77bcf6f50bf7823c328fa3/bsky_bridge-1.0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "41896deac89e84ef4b09b1c3b1cc1260f00f1cfceae253b6a90b0aaf5147d20e",
                "md5": "caf5b034e0fd592810252bfdb87c8beb",
                "sha256": "35da1ffd4a615034b4bfc01120a8c55c106744dda03ae7cc55e3b6c9ac6ad421"
            },
            "downloads": -1,
            "filename": "bsky_bridge-1.0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "caf5b034e0fd592810252bfdb87c8beb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 10206,
            "upload_time": "2025-02-02T17:23:35",
            "upload_time_iso_8601": "2025-02-02T17:23:35.329929Z",
            "url": "https://files.pythonhosted.org/packages/41/89/6deac89e84ef4b09b1c3b1cc1260f00f1cfceae253b6a90b0aaf5147d20e/bsky_bridge-1.0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-02 17:23:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "0xExal",
    "github_project": "bsky-bridge",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "bsky-bridge"
}
        
Elapsed time: 0.99037s