A very convenient reddit scheduler backend with support for multiple credentials
-
CRUD operations for owned Reddit user credentials -
CRUD operations for scheduling submissions -
Repeating task to trigger submissions on scheduled date -
Dockerization of the project (Work in progress) -
SSL support (now possible via nginx proxy etc)
Just clone the repo, create a python environment and install the dependencies:
pip install -r requirements.txt
Or use Docker:
docker compose up -d
First, run the server:
uvicorn main:app --port 8080 --reload
Get your master key by sending a GET request to:
http://127.0.0.1:8080/init/
Once the request is completed, you will receive a master key in return:
{
"master_key": "cAebyYIUtX-3urYrp05_GlxtrVgLUKX7rQxDBdG5mGA"
}
This will only work once. Once created, you won't be able to view your master key again. Following requests will result in 404. In order to create a new key, you will need to delete the "db.sqlite3" file manually.
API is simple and follows REST best practices. You will need to send a request with a valid master key in the "Authorization" header. In case you still need a detailed documentation, below you can find a table showcasing the endpoints and their corresponding HTTP methods. As well as the examples of how to use the API for each endpoint.
See Examples For Axios.
HTTP Method | GET |
---|---|
Endpoint | /reddit_users/ |
Parameters | page, per_page |
Example |
curl -L 'http://127.0.0.1:8080/reddit_users/?page=1&per_page=10' \
-H 'Authorization: Basic cAebyYIUtX-3urYrp05_GlxtrVgLUKX7rQxDBdG5mGA' |
HTTP Method | GET |
---|---|
Endpoint | /reddit_users/{USER}/ |
Parameters | with_crosspostable_subs (bool) |
Example |
curl -L 'http://127.0.0.1:8080/reddit_users/spez/' \
-H 'Authorization: Basic cAebyYIUtX-3urYrp05_GlxtrVgLUKX7rQxDBdG5mGA' |
HTTP Method | POST |
---|---|
Endpoint | /reddit_users/ |
Example |
curl -L 'http://127.0.0.1:8080/reddit_users/' \
-H 'Authorization: Basic cAebyYIUtX-3urYrp05_GlxtrVgLUKX7rQxDBdG5mGA' \
-H 'Content-Type: application/json' \
-d '{
"username": "new_user",
"password": "new_password",
"client_id": "new_client_id",
"client_secret": "new_client_secret"
}' |
HTTP Method | PUT |
---|---|
Endpoint | /reddit_users/{USER}/ |
Example |
curl -L -X PUT 'http://127.0.0.1:8080/reddit_users/spez/' \
-H 'Authorization: Basic cAebyYIUtX-3urYrp05_GlxtrVgLUKX7rQxDBdG5mGA' \
-H 'Content-Type: application/json' \
-d '{
"username": "spez",
"password": "new_password",
"client_id": "new_client_id",
"client_secret": "new_client_secret"
}' |
HTTP Method | DELETE |
---|---|
Endpoint | /reddit_users/{USER}/ |
Example |
curl -L -X DELETE 'http://127.0.0.1:8080/reddit_users/spez/' \
-H 'Authorization: Basic cAebyYIUtX-3urYrp05_GlxtrVgLUKX7rQxDBdG5mGA' |
HTTP Method | GET |
---|---|
Endpoint | /scheduled_submissions/ |
Parameters | page, per_page |
Example |
curl -L 'http://127.0.0.1:8080/scheduled_submissions/?page=1&per_page=10' \
-H 'Authorization: Basic cAebyYIUtX-3urYrp05_GlxtrVgLUKX7rQxDBdG5mGA' |
HTTP Method | POST |
---|---|
Endpoint | /scheduled_submissions/ |
Example |
curl -L 'http://127.0.0.1:8080/scheduled_submissions/' \
-H 'Authorization: Basic cAebyYIUtX-3urYrp05_GlxtrVgLUKX7rQxDBdG5mGA' \
-H 'Content-Type: application/json' \
-d '{
"username": "spez",
"planned_unix_datetime": 1753876468,
"sub": "ProgrammerHumor",
"title": "New submission",
"text": "Lorem ipsum dolor sit down",
"flairid": null,
"nsfw": false,
"crosspost_requests":[
{
"sub":"EtsyMemes",
"planned_unix_datetime":1753877470
}
]
}' |
HTTP Method | GET |
---|---|
Endpoint | /scheduled_submissions/{SUBMISSION_ROWID}/ |
Example |
curl -L 'http://127.0.0.1:8080/scheduled_submissions/1/' \
-H 'Authorization: Basic cAebyYIUtX-3urYrp05_GlxtrVgLUKX7rQxDBdG5mGA' |
HTTP Method |
PUT |
---|---|
Endpoint | /scheduled_submissions/{SUBMISSION_ROWID}/ |
Example |
curl -L -X PUT 'http://127.0.0.1:8080/scheduled_submissions/1/' \
-H 'Authorization: Basic cAebyYIUtX-3urYrp05_GlxtrVgLUKX7rQxDBdG5mGA' \
-H 'Content-Type: application/json' \
-d '{
"username": "spez",
"planned_unix_datetime": 1753876468,
"sub": "ProgrammerHumor",
"title": "Updated submission",
"text": "Lorem ipsum dolor sit down",
"flairid": null,
"nsfw": false
}' |
HTTP Method | DELETE |
---|---|
Endpoint | /scheduled_submissions/{SUBMISSION_ROWID}/ |
Example |
curl -L -X DELETE 'http://127.0.0.1:8080/scheduled_submissions/1/' \
-H 'Authorization: Basic cAebyYIUtX-3urYrp05_GlxtrVgLUKX7rQxDBdG5mGA' |
Please remember to replace the placeholders such as {USER}
and {SUBMISSION_ROWID}
with actual values in your requests. This documentation should provide a clear overview of the API endpoints and how to interact with them professionally.