Add github API client and settings pipeline
This commit is contained in:
parent
378ac11656
commit
6dc9980fb0
6 changed files with 82 additions and 5 deletions
2
Pipfile
2
Pipfile
|
@ -22,3 +22,5 @@ allow_prereleases = true
|
||||||
[packages]
|
[packages]
|
||||||
aiohttp = "*"
|
aiohttp = "*"
|
||||||
apscheduler = "*"
|
apscheduler = "*"
|
||||||
|
pygithub = "*"
|
||||||
|
python-dotenv = "*"
|
||||||
|
|
58
Pipfile.lock
generated
58
Pipfile.lock
generated
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "51ea2d5cdebbe8681e35959921839ceecbd37164697962c5fa7b6d815982bd83"
|
"sha256": "b0d2de2b0b35e9c52f6fd20d157bb51571a1c3a243d372f2a15dd7944ff2fb90"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
@ -66,6 +66,13 @@
|
||||||
],
|
],
|
||||||
"version": "==18.2.0"
|
"version": "==18.2.0"
|
||||||
},
|
},
|
||||||
|
"certifi": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:47f9c83ef4c0c621eaef743f133f09fa8a74a9b75f037e8624f83bd1b6626cb7",
|
||||||
|
"sha256:993f830721089fef441cdfeb4b2c8c9df86f0c63239f06bd025a76a7daddb033"
|
||||||
|
],
|
||||||
|
"version": "==2018.11.29"
|
||||||
|
},
|
||||||
"chardet": {
|
"chardet": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
|
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
|
||||||
|
@ -73,6 +80,13 @@
|
||||||
],
|
],
|
||||||
"version": "==3.0.4"
|
"version": "==3.0.4"
|
||||||
},
|
},
|
||||||
|
"deprecated": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:8bfeba6e630abf42b5d111b68a05f7fe3d6de7004391b3cd614947594f87a4ff",
|
||||||
|
"sha256:b784e0ca85a8c1e694d77e545c10827bd99772392e79d5f5442e761515a1246e"
|
||||||
|
],
|
||||||
|
"version": "==1.2.4"
|
||||||
|
},
|
||||||
"idna": {
|
"idna": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407",
|
"sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407",
|
||||||
|
@ -121,6 +135,28 @@
|
||||||
],
|
],
|
||||||
"version": "==4.5.2"
|
"version": "==4.5.2"
|
||||||
},
|
},
|
||||||
|
"pygithub": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:263102b43a83e2943900c1313109db7a00b3b78aeeae2c9137ba694982864872"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==1.43.5"
|
||||||
|
},
|
||||||
|
"pyjwt": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:5c6eca3c2940464d106b99ba83b00c6add741c9becaec087fb7ccdefea71350e",
|
||||||
|
"sha256:8d59a976fb773f3e6a39c85636357c4f0e242707394cadadd9814f5cbaa20e96"
|
||||||
|
],
|
||||||
|
"version": "==1.7.1"
|
||||||
|
},
|
||||||
|
"python-dotenv": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:a84569d0e00d178bc5b957f7ff208bf49287cbf61857c31c258c4a91f571527b",
|
||||||
|
"sha256:c9b1ddd3cdbe75c7d462cb84674d87130f4b948f090f02c7d7144779afb99ae0"
|
||||||
|
],
|
||||||
|
"index": "pypi",
|
||||||
|
"version": "==0.10.1"
|
||||||
|
},
|
||||||
"pytz": {
|
"pytz": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:32b0891edff07e28efe91284ed9c31e123d84bea3fd98e1f72be2508f43ef8d9",
|
"sha256:32b0891edff07e28efe91284ed9c31e123d84bea3fd98e1f72be2508f43ef8d9",
|
||||||
|
@ -128,6 +164,13 @@
|
||||||
],
|
],
|
||||||
"version": "==2018.9"
|
"version": "==2018.9"
|
||||||
},
|
},
|
||||||
|
"requests": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:502a824f31acdacb3a35b6690b5fbf0bc41d63a24a45c4004352b0242707598e",
|
||||||
|
"sha256:7bf2a778576d825600030a110f3c0e3e8edc51dfaafe1c146e39a2027784957b"
|
||||||
|
],
|
||||||
|
"version": "==2.21.0"
|
||||||
|
},
|
||||||
"six": {
|
"six": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c",
|
"sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c",
|
||||||
|
@ -151,6 +194,19 @@
|
||||||
],
|
],
|
||||||
"version": "==2.0.0b1"
|
"version": "==2.0.0b1"
|
||||||
},
|
},
|
||||||
|
"urllib3": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:61bf29cada3fc2fbefad4fdf059ea4bd1b4a86d2b6d15e1c7c0b582b9752fe39",
|
||||||
|
"sha256:de9529817c93f27c8ccbfead6985011db27bd0ddfcdb2d86f3f663385c6a9c22"
|
||||||
|
],
|
||||||
|
"version": "==1.24.1"
|
||||||
|
},
|
||||||
|
"wrapt": {
|
||||||
|
"hashes": [
|
||||||
|
"sha256:4aea003270831cceb8a90ff27c4031da6ead7ec1886023b80ce0dfe0adf61533"
|
||||||
|
],
|
||||||
|
"version": "==1.11.1"
|
||||||
|
},
|
||||||
"yarl": {
|
"yarl": {
|
||||||
"hashes": [
|
"hashes": [
|
||||||
"sha256:024ecdc12bc02b321bc66b41327f930d1c2c543fa9a561b39861da9388ba7aa9",
|
"sha256:024ecdc12bc02b321bc66b41327f930d1c2c543fa9a561b39861da9388ba7aa9",
|
||||||
|
|
5
actioner/clients.py
Normal file
5
actioner/clients.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
from github import Github
|
||||||
|
|
||||||
|
from actioner.settings import GITHUB_TOKEN
|
||||||
|
|
||||||
|
github = Github(GITHUB_TOKEN)
|
|
@ -1,13 +1,15 @@
|
||||||
|
import logging
|
||||||
from multiprocessing import Process
|
from multiprocessing import Process
|
||||||
|
|
||||||
from aiohttp.web import run_app as run_web_app
|
from aiohttp.web import run_app as run_web_app
|
||||||
|
|
||||||
from actioner.scheduler import create_scheduler, start_scheduler
|
from actioner.scheduler import create_scheduler, start_scheduler
|
||||||
|
from actioner.settings import LOGGING_LEVEL
|
||||||
from actioner.web import get_server
|
from actioner.web import get_server
|
||||||
import logging
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
logging.basicConfig(level=logging.INFO)
|
logging.basicConfig(level=LOGGING_LEVEL)
|
||||||
|
|
||||||
server = get_server()
|
server = get_server()
|
||||||
scheduler = create_scheduler()
|
scheduler = create_scheduler()
|
||||||
|
|
10
actioner/settings.py
Normal file
10
actioner/settings.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import os
|
||||||
|
from logging import _nameToLevel
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
GITHUB_TOKEN = os.environ['GITHUB_TOKEN']
|
||||||
|
|
||||||
|
LOGGING_LEVEL = _nameToLevel[os.environ.get('LOGGING_LEVEL', 'INFO')]
|
|
@ -1,8 +1,10 @@
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
|
from actioner.clients import github
|
||||||
|
|
||||||
async def healthcheck(request):
|
async def healthcheck(request):
|
||||||
return web.json_response({})
|
return web.json_response({
|
||||||
|
'github': github.get_user().login
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
def get_server():
|
def get_server():
|
||||||
|
|
Reference in a new issue