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 bskyapi

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.1.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.1-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bskyapi-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 3e6a49e20dcf098396c5c1814efcc7f5bd594511647f2acdc4710eaf22f72e2b
MD5 0158d21ff77e21b0a5d03117691d312d
BLAKE2b-256 17e308c10f6fccd7e645a108e441324e63d6bf1a246689f33534e536d3c3f530

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bskyapi-0.2.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d943ea74a6d21ddef065783383c8765c63679c966caeae261bd39ebe9910cfcc
MD5 df0a8f489f9e2d1f3e524a2f0869ee0b
BLAKE2b-256 2ade90120e48358132cd51fbb3a5edff0c02c2373f093deb13e37d0071326779

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