bskyapi


Namebskyapi JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/stoltzmaniac/bskyapi
SummaryNone
upload_time2024-12-11 04:42:36
maintainerNone
docs_urlNone
authorScott Stoltzman
requires_python<3.14,>=3.11
licenseApache 2.0
keywords bluesky bsky api wrapper atproto
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # BlueSky API

This is built as a wrapper for the `atproto` package. While that package is fantastic, it can be a bit tricky to navigate. This package will **hopefully** give a productive user experience.

### Installation
```
pip install bskyapi
```

### Example usage

```python
import os
from dotenv import load_dotenv
from bskyapi.clients import BskyApiClient
from bskyapi.scrapers.search_term import SearchTermScraper
from bskyapi.scrapers.profile import ProfileScraper
from bskyapi.storage.writers import JsonFileWriter
load_dotenv()

BSKY_USERNAME = os.getenv('BSKY_USERNAME')
BSKY_PASSWORD = os.getenv('BSKY_PASSWORD')

# Create a client -- reuse this across your code rather than instantiating a new one each time
# If you run this frequently, you will be rate limited
client = BskyApiClient(username = BSKY_USERNAME, 
                       password = BSKY_PASSWORD)

# Scrape all posts for the search term "rstats"
st_scraper = SearchTermScraper(client)
rstats_posts = st_scraper.fetch_all_posts("rstats", limit=100)

# Scrape user: follows, followers, profiles
pf_scraper = ProfileScraper(client)
profiles = pf_scraper.fetch_all_profiles(["stoltzmaniac.bsky.social", "bsky.app"])
profile_follows = pf_scraper.fetch_all_follows("stoltzmaniac.bsky.social", limit=100)
profile_followers = pf_scraper.fetch_all_followers("stoltzmaniac.bsky.social", limit=100)

# Add output files -- you can specify different file names within each method if you prefer not to use the defaults
json_writer = JsonFileWriter()
scraper = SearchTermScraper(client, writer=json_writer)
data = scraper.fetch_all_posts("rstats", limit=100)

pf_scraper = ProfileScraper(client, writer=json_writer)
profiles = pf_scraper.fetch_all_profiles(["stoltzmaniac.bsky.social", "bsky.app"])
profile_follows = pf_scraper.fetch_all_follows("stoltzmaniac.bsky.social", limit=100)
profile_followers = pf_scraper.fetch_all_followers("stoltzmaniac.bsky.social", limit=100)
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/stoltzmaniac/bskyapi",
    "name": "bskyapi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.14,>=3.11",
    "maintainer_email": null,
    "keywords": "bluesky, bsky, api, wrapper, atproto",
    "author": "Scott Stoltzman",
    "author_email": "scottstoltzman@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/17/e3/08c10f6fccd7e645a108e441324e63d6bf1a246689f33534e536d3c3f530/bskyapi-0.2.1.tar.gz",
    "platform": null,
    "description": "# BlueSky API\n\nThis is built as a wrapper for the `atproto` package. While that package is fantastic, it can be a bit tricky to navigate. This package will **hopefully** give a productive user experience.\n\n### Installation\n```\npip install bskyapi\n```\n\n### Example usage\n\n```python\nimport os\nfrom dotenv import load_dotenv\nfrom bskyapi.clients import BskyApiClient\nfrom bskyapi.scrapers.search_term import SearchTermScraper\nfrom bskyapi.scrapers.profile import ProfileScraper\nfrom bskyapi.storage.writers import JsonFileWriter\nload_dotenv()\n\nBSKY_USERNAME = os.getenv('BSKY_USERNAME')\nBSKY_PASSWORD = os.getenv('BSKY_PASSWORD')\n\n# Create a client -- reuse this across your code rather than instantiating a new one each time\n# If you run this frequently, you will be rate limited\nclient = BskyApiClient(username = BSKY_USERNAME, \n                       password = BSKY_PASSWORD)\n\n# Scrape all posts for the search term \"rstats\"\nst_scraper = SearchTermScraper(client)\nrstats_posts = st_scraper.fetch_all_posts(\"rstats\", limit=100)\n\n# Scrape user: follows, followers, profiles\npf_scraper = ProfileScraper(client)\nprofiles = pf_scraper.fetch_all_profiles([\"stoltzmaniac.bsky.social\", \"bsky.app\"])\nprofile_follows = pf_scraper.fetch_all_follows(\"stoltzmaniac.bsky.social\", limit=100)\nprofile_followers = pf_scraper.fetch_all_followers(\"stoltzmaniac.bsky.social\", limit=100)\n\n# Add output files -- you can specify different file names within each method if you prefer not to use the defaults\njson_writer = JsonFileWriter()\nscraper = SearchTermScraper(client, writer=json_writer)\ndata = scraper.fetch_all_posts(\"rstats\", limit=100)\n\npf_scraper = ProfileScraper(client, writer=json_writer)\nprofiles = pf_scraper.fetch_all_profiles([\"stoltzmaniac.bsky.social\", \"bsky.app\"])\nprofile_follows = pf_scraper.fetch_all_follows(\"stoltzmaniac.bsky.social\", limit=100)\nprofile_followers = pf_scraper.fetch_all_followers(\"stoltzmaniac.bsky.social\", limit=100)\n```\n\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": null,
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://github.com/stoltzmaniac/bskyapi",
        "Repository": "https://github.com/stoltzmaniac/bskyapi"
    },
    "split_keywords": [
        "bluesky",
        " bsky",
        " api",
        " wrapper",
        " atproto"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2ade90120e48358132cd51fbb3a5edff0c02c2373f093deb13e37d0071326779",
                "md5": "df0a8f489f9e2d1f3e524a2f0869ee0b",
                "sha256": "d943ea74a6d21ddef065783383c8765c63679c966caeae261bd39ebe9910cfcc"
            },
            "downloads": -1,
            "filename": "bskyapi-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "df0a8f489f9e2d1f3e524a2f0869ee0b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.14,>=3.11",
            "size": 9496,
            "upload_time": "2024-12-11T04:42:34",
            "upload_time_iso_8601": "2024-12-11T04:42:34.128787Z",
            "url": "https://files.pythonhosted.org/packages/2a/de/90120e48358132cd51fbb3a5edff0c02c2373f093deb13e37d0071326779/bskyapi-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "17e308c10f6fccd7e645a108e441324e63d6bf1a246689f33534e536d3c3f530",
                "md5": "0158d21ff77e21b0a5d03117691d312d",
                "sha256": "3e6a49e20dcf098396c5c1814efcc7f5bd594511647f2acdc4710eaf22f72e2b"
            },
            "downloads": -1,
            "filename": "bskyapi-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0158d21ff77e21b0a5d03117691d312d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.14,>=3.11",
            "size": 7831,
            "upload_time": "2024-12-11T04:42:36",
            "upload_time_iso_8601": "2024-12-11T04:42:36.322200Z",
            "url": "https://files.pythonhosted.org/packages/17/e3/08c10f6fccd7e645a108e441324e63d6bf1a246689f33534e536d3c3f530/bskyapi-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-11 04:42:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "stoltzmaniac",
    "github_project": "bskyapi",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "bskyapi"
}
        
Elapsed time: 2.90072s