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=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(["umbersar.bsky.social"])
profile_follows = pf_scraper.fetch_all_follows("umbersar.bsky.social", limit=1000)
profile_followers = pf_scraper.fetch_all_followers("stoltzmaniac.bsky.social", limit=100)
Project details
Release history Release notifications | RSS feed
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.0.tar.gz
(7.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bskydata-0.3.0.tar.gz.
File metadata
- Download URL: bskydata-0.3.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2776d4645ac12a3f94a6e3dcbc32a2fcdcbb1d04381f6f192f58955e0792511f
|
|
| MD5 |
28673c684196b13a81a99fb9cbcc5567
|
|
| BLAKE2b-256 |
208bdd8b0b981b0d3e80ab137f429d20786e88991c203031d39c4e4a5c1a333f
|
File details
Details for the file bskydata-0.3.0-py3-none-any.whl.
File metadata
- Download URL: bskydata-0.3.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1eca36b3a9e28ef31f324ccfc61a2fe4a1648ac65faba927854f7a593211cd9
|
|
| MD5 |
456da4dc481a4231b4780cb462eb437c
|
|
| BLAKE2b-256 |
533463ccf269bf66d56b78c1c6f1fb262bd80c78ea91eefee1428e4d6e7a76cc
|