Documentation
This commit is contained in:
parent
f4a66b3e55
commit
7bca418530
4 changed files with 33 additions and 6 deletions
13
README.md
13
README.md
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
You will need:
|
You will need:
|
||||||
1. API Client and Secret
|
1. API Client and Secret
|
||||||
2. Python 3.12 or above
|
2. Python 3.11 or something sensible or above
|
||||||
3. A method for environment variables like [python-dotenv](https://pypi.org/project/python-dotenv/)
|
3. A method for environment variables like [python-dotenv](https://pypi.org/project/python-dotenv/)
|
||||||
|
|
||||||
### API client key and secret from the site
|
### API client key and secret from the site
|
||||||
|
|
@ -37,5 +37,14 @@ API = trustcafeapiwrapper.APIClient(
|
||||||
)
|
)
|
||||||
|
|
||||||
profile = API.run_job('userprofile.get', "simon-little")
|
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.",
|
||||||
|
))
|
||||||
|
```
|
||||||
|
## More
|
||||||
|
- [Development "Things to think about do"](https://gitlab.com/trustcafe/trustcafe-api-wrapper/-/blob/main/development.md)
|
||||||
|
- [Documentation](https://gitlab.com/trustcafe/trustcafe-api-wrapper/-/blob/main/documentation.md)
|
||||||
|
|
|
||||||
18
documentation.md
Normal file
18
documentation.md
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Basic usage (without an .env)
|
||||||
|
Here's how to make a post to the homepage (aka Maintrunk)
|
||||||
|
|
||||||
|
```python
|
||||||
|
import trustcafeapiwrapper
|
||||||
|
from trustcafeapiwrapper.wrappers.post.create_post import create_post
|
||||||
|
|
||||||
|
# Setup the API Client
|
||||||
|
API = trustcafeapiwrapper.APIClient(
|
||||||
|
client_id="YOUR_CLIENT_ID"
|
||||||
|
client_secret="YOUR_CLIENT_SECRET"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Use the create_post wrapper
|
||||||
|
API.wrapped(create_post(
|
||||||
|
"This is a test post created via the create_post wrapper function.",
|
||||||
|
))
|
||||||
|
```
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[project]
|
[project]
|
||||||
name = "trustcafeapiwrapper"
|
name = "trustcafeapiwrapper"
|
||||||
version = "0.1.0.1"
|
version = "0.1.0.3"
|
||||||
description = "Add your description here"
|
description = "Add your description here"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.13"
|
requires-python = ">=3.13"
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,9 @@ def save_response(response):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# print("-----------Get a user profile----------------")
|
print("-----------Get a user profile----------------")
|
||||||
# profile = API.run_job('userprofile.get', "simon-little")
|
profile = API.run_job('userprofile.get', "simon-little")
|
||||||
# print(profile)
|
print(profile)
|
||||||
# print("-------------- Get a branch -----------------")
|
# print("-------------- Get a branch -----------------")
|
||||||
# branch = API.run_job('branch.get', "music")
|
# branch = API.run_job('branch.get', "music")
|
||||||
# print(branch)
|
# print(branch)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue