Skip to main content

No project description provided

Project description

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 bsky-api

Example usage

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)

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

bskyapi-0.2.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

bskyapi-0.2.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file bskyapi-0.2.0.tar.gz.

File metadata

  • Download URL: bskyapi-0.2.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/23.5.0

File hashes

Hashes for bskyapi-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d6206674f50a4830120dcb5fe7246a46cefc92353dbcd881700cf548e58dbcdc
MD5 7c7a9c75623dc38c1bdec694fb44c2ab
BLAKE2b-256 78508c3a1b7b5f1c4fae4b27dc03fdc686c21e3c80f399010b69896663cd2c68

See more details on using hashes here.

File details

Details for the file bskyapi-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: bskyapi-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.13.1 Darwin/23.5.0

File hashes

Hashes for bskyapi-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f0fe3ddc0f13d1054a17115064252acc59728039824e86dfad91d6de40cd29b
MD5 26de3e3b83100b77249254cf83f623af
BLAKE2b-256 534fcf3f08ca8f774757c187f99aa0179cda96b5de04cd222296af5edf86ed52

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