When your app is triggered (see triggers below), Arkhos will call the function arkhos_handler in main.py. It will be passed a request object. def arkhos_handler(request): The request object will have these attributes
Attribute | Description & Example |
---|---|
method |
The event that triggered the app: GET, POST, SCHEDULED, EMAIL
|
GET |
A dict of url GET parameters
eg. https://my-app.arkhosapp.com?name=lola
|
body |
The HTTP (or email) request body, string
|
json |
The HTTP request body parsed as json, dictionary
|
headers | HTTP request headers, dictionary |
path |
The url path, string
|
Your arkhos_handler should return one of the responses below. All responses also accept a status and dict of headers
Response type | Description & Example |
---|---|
arkhos.json |
Return a dict as json
|
arkhos.http |
Return html
|
arkhos.render |
Render an html file. Uses the jinja templating language.
|
Any files in /static folder are available at my-app.arkhosapp.com/static/
my-app
|____main.py
|____profile.html
|____requirements.txt
|____static
| |____theme.css
theme.css is available at https://my-app.arkhosapp.com/static/theme.css
Arkhos comes with a built-in key/value store
Attribute | Description & Example |
---|---|
arkhos.set(key, value) |
Store a key, value. key should be a string. value can be string, int, float, boolean, or datetime
|
arkhos.get(key)
arkhos.get(key, default_value) |
Get a key. Use default_value if the key does not exist.
|
Arkhos will automatically install any dependencies in requirements.txt
requests==2.31.0
certifi==2024.2.2
charset-normalizer==3.3.2
idna==3.6
urllib3==2.2.1
Testing your app locally is easy 🤞
$ pip install arkhos
# from the project root folder, run
$ arkhos
# test a POST request to /api
$ arkhos POST --path "/api"
When you create a new Arkhos app, you can choose the name of the application, eg. my-app.
The app will be available at https://my-app.arkhosapp.com.
You can schedule your app to run using Arkhos cron (coming soon)
You can trigger your app by emailing my-app@arkhosapp.com (coming soon)
You can trigger your app from Slack or Discord (coming eventually)