Skip to content

Commit

Permalink
Move quickstart from samples (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
daabr authored Aug 20, 2024
1 parent c627e34 commit d31681e
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ projects for:
| 🐍 [Google Forms to Jira](./google_forms_to_jira/) | Poll a form for responses and create an issue for each one | Google Forms → Jira |
| 🐍 [Jira assignee from schedule](./jira_google_calendar/assignee_from_schedule/) | Assign new Jira issues to the current on-caller based on a schedule in a shared calendar | Jira ↔ Google Calendar |
| 🐍 [Jira deadline to event](./jira_google_calendar/deadline_to_event/) | Create/update calendar events based on the deadlines of Jira issues | Jira ↔ Google Calendar |
| 🐍 [Quickstart](./quickstart/) | Basic workflow for tutorials | HTTP |
|[Pull Request Review Reminder (Purrr)](./purrr/) | Streamline code reviews and cut down turnaround time to merge pull requests | GitHub ↔ Slack |
|[ReviewKitteh](./reviewkitteh/) | Monitor pull requests, and meow at random people | GitHub, Google Sheets, Slack |
| 🐍 [Task chain](./task_chain/) | Run a sequence of tasks with fault tolerance | Slack |
Expand Down
6 changes: 6 additions & 0 deletions quickstart/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Quickstart

Basic workflow for tutorials.

Used in https://docs.autokitteh.com/get_started/quickstart and in
https://docs.autokitteh.com/get_started/client/cli/quickstart.
23 changes: 23 additions & 0 deletions quickstart/autokitteh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This YAML file is a declarative manifest that describes
# the minimal setup of an AutoKitteh project.

version: v1

project:
name: quickstart
connections:
- name: http_conn
integration: http
triggers:
- name: http_get
connection: http_conn
event_type: get
data:
path: trigger_path
call: program.py:on_http_get
- name: http_get_with_param
connection: http_conn
event_type: get
data:
path: iterations/{iters}
call: program.py:on_http_get
17 changes: 17 additions & 0 deletions quickstart/program.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""Basic handler for incoming HTTP GET requests."""

import time


FIVE_SECONDS = 5


def on_http_get(event):
print(f"Received {event.data.method} request")

iterations = int(event.data.params.get("iters", "0"))
for i in range(iterations):
print("Loop iteration: %d of %d" % (i + 1, iterations))
time.sleep(FIVE_SECONDS)

print(f"Finished processing {event.data.method} request")

0 comments on commit d31681e

Please sign in to comment.