Skip to content

Instantly share code, notes, and snippets.

View dejanceltra's full-sized avatar

Dejan Levec dejanceltra

View GitHub Profile
"""
Simple KV store accessible via TCP.
Supports two operations:
- get(key): fetching value (or None if not found)
- set(key, value): setting value
Server is single-threaded asyncio-based, which simplifies implementation,
and probably multi-threaded would be slower, since it would need to share `_cache` dictionary between threads.
import os
from time import sleep
import requests
from typing import Any
class CircleCI:
def __init__(self, token: str, project_username: str, project_reponame: str):
self._token = token
self._project = f'{project_username}/{project_reponame}'