This release is a pre-release and may not be stable for production use.
ape-farcaster
ape-farcaster is a modern Python SDK for the Farcaster protocol
Full documentation can be found
Installation
pip install -U farcaster
or install with Poetry:
poetry add farcaster
Usage
To use the Warpcast API you need to have a Farcaster account. We will use the mnemonic or private key of the Farcaster custody account (not your main wallet) to connect to the API.
First, save your Farcaster mnemonic or private key to a .env file. Now you can initialize the client, and automatically connect to the Farcaster API!
import os
from farcaster import Warpcast
from dotenv import load_dotenv # can be installed with `pip install python-dotenv`
load_dotenv()
client = Warpcast(mnemonic=os.environ.get("<MNEMONIC_ENV_VAR>"))
print(client.get_healthcheck())
Examples
Get a cast
response = client.get_cast("0x321712dc8eccc5d2be38e38c1ef0c8916c49949a80ffe20ec5752bb23ea4d86f")
print(response.cast.author.username) # "dwr"
Publish a cast
response = client.post_cast(text="Hello world!")
print(response.cast.hash) # "0x...."
Get a user by username
user = client.get_user_by_username("mason")
print(user.username) # "mason"
Get a user's followers using a fid (farcaster ID)
response = client.get_followers(fid=50)
print(response.users) # [user1, user2, user3]
Stream recent casts
for cast in client.stream_casts():
if cast:
print(cast.text) # "Hello world!"
Get users who recently joined Farcaster
response = client.get_recent_users()
print(response.users) # [user1, user2, user3]
Get your own user object
user = client.get_me()
print(user.username) # "you"
Recast a cast
response = client.recast("0x....")
print(response.cast.hash) # "0x...."
and many, many more things.
Please note that support for Python 3.7 is no longer actively maintained. Python 3.8, 3.9, or 3.10 are recommended.
🛡 License
Disclaimer
_This code is being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of the code. It has not been audited and as such there can be no assurance it will work as intended, and users may experience delays, failures, errors, omissions or loss of transmitted information. Nothing in this repo should be construed as investment advice or legal advice for any particular facts or circumstances and is not meant to replace competent counsel. It is strongly advised for you to contact a reputable attorney in your jurisdiction for any questions or concerns with respect thereto.
Metadata
Release files for ape-farcaster 0.8.0b0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ape-farcaster-0.8.0b0.tar.gz | 862.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ape_farcaster-0.8.0b0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 877.5 kB
Release files / ape-farcaster-0.8.0b0.tar.gz
| Download URL | ape-farcaster-0.8.0b0.tar.gz |
|---|---|
| Size | 862.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bbe07036f0843b30b16ea299fedc450667818bc6d65b74c056aba32fcd7aaa18
|
|
BLAKE2b-256 checksum How to use checksums |
e1de28fbef73311c9edb3ba3e3efc0f43ef6c62e084d288de391adab0cc7d2a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / ape_farcaster-0.8.0b0-py3-none-any.whl
| Download URL | ape_farcaster-0.8.0b0-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ee8fc14012ee892a5d2b66ae7dbedf8c76f48b096f1b2541c4d625ff046785a
|
|
BLAKE2b-256 checksum How to use checksums |
9af4f9cb428d4a293bcc5ec895e0015d7646417e05db46fbcf219ecf18a45eb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|