1.5 KiB
1.5 KiB
Trustcafe API Wrapper
Prerequisites
You will need:
- API Client and Secret
- Python 3.11 or something sensible or above
- A method for environment variables like python-dotenv
API client key and secret from the site
- https://www.trustcafe.io/en/myaccount/apiaccess for production and https://alpha.wts2.net/en/myaccount/apiaccess for alpha (this will change in the future)
- Click "Create new client credentials key pair"
- Choose all of the scopes or select which you would like to restrict the key to
- Scroll down and press Save
- Copy the client key and secret to your environment, the secret cannot be retrieved without making a new one
Installation
pip install trustcafeapiwrapper
OR
uv add trustcafeapiwrapper
Usage
import trustcafeapiwrapper, os
API = trustcafeapiwrapper.APIClient(
client_id=os.getenv("client_id"),
client_secret=os.getenv("client_secret"),
env="alpha" # alpha | production.
debug=False
)
profile = API.run_job('userprofile.get', "simon-little")
from trustcafeapiwrapper.wrappers.post.create_post import create_post
API.wrapped(create_post(
"This is a test post created via the create_post wrapper function.",
))