Skip to main content

No project description provided

Project description

BlueSky API Data Wrapper

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 bskydata

Example usage

import os
from dotenv import load_dotenv
from bskydata.api.client import BskyApiClient
from bskydata.scrapers.search_terms import SearchTermScraper
from bskydata.scrapers.profiles import ProfileScraper
from bskydata.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=200)

# 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=200)
profile_followers = pf_scraper.fetch_all_followers("stoltzmaniac.bsky.social", limit=200)

# 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=200)

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

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

bskydata-0.3.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

bskydata-0.3.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file bskydata-0.3.1.tar.gz.

File metadata

  • Download URL: bskydata-0.3.1.tar.gz
  • Upload date:
  • Size: 7.9 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 bskydata-0.3.1.tar.gz
Algorithm Hash digest
SHA256 f6150bfb898ef9527da1d13fd70cd5de8fd474ad65caf9a2417d97c4ae2492cb
MD5 fae6d8fee7415ad14bb973630f0d32a9
BLAKE2b-256 b4d62f466a6918d26ba8aa2ccd12828676a9b88c91a40829ea2640de205e735f

See more details on using hashes here.

File details

Details for the file bskydata-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: bskydata-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 9.7 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 bskydata-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d22d2313fd55d1d036785f2972de398c3c198313566e89553098e316809befbf
MD5 0d235233e24c42ee2d4c5d1edda0b1ca
BLAKE2b-256 50f9f035ba522d511ae539fc8e56e2a053d9df32ba05e3cec94ceb40d3082100

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