This commit is contained in:
2022-02-25 01:21:33 +01:00
parent 476a5b55ee
commit 445f60de3d
3 changed files with 74 additions and 1 deletions
+1
View File
@@ -7,6 +7,7 @@ name = "pypi"
pika = "*"
fastapi = "*"
python-dotenv = "*"
uvicorn = "*"
[dev-packages]
neovim = "*"
Generated
+33 -1
View File
@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "fc55e4929bafab86e6aa161c1a58ffb9c95d1b45df759fe4ed632b0ca7b88d86"
"sha256": "cf4791bf3e7d8f95d1aa00a5725f448c0bb52921be77a492c9f6019035acc6fa"
},
"pipfile-spec": 6,
"requires": {
@@ -24,6 +24,22 @@
"markers": "python_full_version >= '3.6.2'",
"version": "==3.5.0"
},
"asgiref": {
"hashes": [
"sha256:2f8abc20f7248433085eda803936d98992f1343ddb022065779f37c5da0181d0",
"sha256:88d59c13d634dcffe0510be048210188edd79aeccb6a6c9028cdad6f31d730a9"
],
"markers": "python_version >= '3.7'",
"version": "==3.5.0"
},
"click": {
"hashes": [
"sha256:6a7a62563bbfabfda3a38f3023a1db4a35978c0abd76f6c9605ecd6554d6d9b1",
"sha256:8458d7b1287c5fb128c90e23381cf99dcde74beaf6c7ff6384ce84d6fe090adb"
],
"markers": "python_version >= '3.6'",
"version": "==8.0.4"
},
"fastapi": {
"hashes": [
"sha256:b58a2c46df14f62ebe6f24a9439927539ba1959b9be55ba0e2f516a683e5b9d4",
@@ -32,6 +48,14 @@
"index": "pypi",
"version": "==0.74.1"
},
"h11": {
"hashes": [
"sha256:70813c1135087a248a4d38cc0e1a0181ffab2188141a93eaf567940c3957ff06",
"sha256:8ddd78563b633ca55346c8cd41ec0af27d3c79931828beffb46ce70a379e7442"
],
"markers": "python_version >= '3.6'",
"version": "==0.13.0"
},
"idna": {
"hashes": [
"sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff",
@@ -120,6 +144,14 @@
],
"markers": "python_version >= '3.6'",
"version": "==4.1.1"
},
"uvicorn": {
"hashes": [
"sha256:8adddf629b79857b48b999ae1b14d6c92c95d4d7840bd86461f09bee75f1653e",
"sha256:c04a9c069111489c324f427501b3840d306c6b91a77b00affc136a840a3f45f1"
],
"index": "pypi",
"version": "==0.17.5"
}
},
"develop": {
+40
View File
@@ -1 +1,41 @@
#!/usr/bin/env python
"""
Git-Puller
A RabbitMQ client and HTTP server.
"""
import os
import pika
from fastapi import FastAPI
from dotenv import load_dotenv
load_dotenv()
HTTP_HOST = os.environ["HTTP_HOST"] or "localhost"
HTTP_PORT = int(os.environ["HTTP_PORT"] or 8000)
RABBIT_HOST = os.environ["RABBIT_HOST"] or "localhost"
RABBIT_PORT = os.environ["RABBIT_PORT"] or "5672"
app = FastAPI()
def get_connexion():
return pika.BlockingConnection(pika.ConnectionParameters(RABBIT_HOST+":"+RABBIT_PORT))
@app.route("/push/{repo}", methods=["GET"])
def webhook():
repo = requests
with get_connexion() as connection:
channel.basic_publish(
exchange='',
routing_key='push',
body='repod!'
)
# print(" [x] Sent 'Hello World!'")
if __name__ == "__main__":
# Create the push queue
with get_connexion() as connection:
channel = connection.channel()
channel.queue_declare(queue='push')
app.run(host=HTTP_HOST, port=HTTP_PORT)