diff --git a/.funcignore b/.funcignore new file mode 100644 index 0000000..414df2f --- /dev/null +++ b/.funcignore @@ -0,0 +1,4 @@ +.git* +.vscode +local.settings.json +test \ No newline at end of file diff --git a/.gitignore b/.gitignore index ed8ebf5..a10127b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,130 @@ -__pycache__ \ No newline at end of file +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don’t work, or not +# install all needed dependencies. +#Pipfile.lock + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# Azure Functions artifacts +bin +obj +appsettings.json +local.settings.json +.python_packages \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..cbbad0f --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,6 @@ +{ + "recommendations": [ + "ms-azuretools.vscode-azurefunctions", + "ms-python.python" + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..0e43bd3 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,12 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Attach to Python Functions", + "type": "python", + "request": "attach", + "port": 9091, + "preLaunchTask": "func: host start" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..b8dad2e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,7 @@ +{ + "azureFunctions.deploySubpath": ".", + "azureFunctions.scmDoBuildDuringDeployment": true, + "azureFunctions.projectLanguage": "Python", + "azureFunctions.projectRuntime": "~3", + "debug.internalConsoleOptions": "neverOpen" +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..13be064 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,11 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "type": "func", + "command": "host start", + "problemMatcher": "$func-watch", + "isBackground": true + } + ] +} diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index cfa3f5d..0000000 --- a/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7 - -COPY ./ /app \ No newline at end of file diff --git a/chainz-rest/__init__.py b/chainz-rest/__init__.py new file mode 100644 index 0000000..58b0885 --- /dev/null +++ b/chainz-rest/__init__.py @@ -0,0 +1,10 @@ +import logging +import json +import azure.functions as func +import random +from . import quotes + + +def main(req: func.HttpRequest) -> func.HttpResponse: + logging.info("Python HTTP trigger function processed a request.") + return func.HttpResponse(json.dumps({"message": random.choice(quotes.quotes)})) diff --git a/chainz-rest/function.json b/chainz-rest/function.json new file mode 100644 index 0000000..8c4cbe3 --- /dev/null +++ b/chainz-rest/function.json @@ -0,0 +1,20 @@ +{ + "scriptFile": "__init__.py", + "bindings": [ + { + "authLevel": "anonymous", + "type": "httpTrigger", + "direction": "in", + "name": "req", + "methods": [ + "get", + "post" + ] + }, + { + "type": "http", + "direction": "out", + "name": "$return" + } + ] +} diff --git a/chainz-rest/quotes.py b/chainz-rest/quotes.py new file mode 100644 index 0000000..f18b450 --- /dev/null +++ b/chainz-rest/quotes.py @@ -0,0 +1,31 @@ +quotes = [ + "My side chick got pregnant by her main dude and i'm offended.", + "I kiss your lady, eat her pussy, then kiss the baby.", + "Left hand on that steering wheel, right hand on that pussy!", + "For my birthday I threw me a surprise party!", + "She got a big booty so I call her big booty", + "My girl got a big purse with a purse in it, and her pussy so clean, I can go to church in it!", + "Beat the pussy up, I need riot gear.", + "Gas in a Ziplock, now thats loud and clear.", + "My wrist deserve a shout out, 'I'm like what up wrist?' / My stove deserve a shout out, 'I'm like what up stove?'", + "I'm in the kitchen. Yams errrrrwhere.", + "I encourage everyone to pay attention to the issues that matter to you, from jobs and the economy, to education and our schools, to criminal justice reform. Whatever it is that you care about, make sure you use your voice.", + "If you a chicken head, go somewhere and lay some eggs", + "Chain hang to my ding-a-ling, chain hang, chain hang to my ding-a-ling", + "I tried to get a tan but I'm black already.", + "Then I put a fat rabbit on a Craftmatic!", + "Yeah, I love them strippers", + "If I wasn't rapping I'd be trapping.", + "Started from the trap, now I rap", + "I’m so high I can sing to a chandelier / My flow a glass of Ace of Spade and yours a can of beer.", + "I look you right in your face, sing to your bitch like I'm Drake!", + "Ass so big, I told her to look back at it!", + "Drunk and high at the same time. / Drinking champagne on an airplane!", + "Wood grain, chestnut / Titty fuck, chest nut", + "Horsepower, horsepower, all this Polo on, I got horsepower", + "If I die, bury me inside the Louis store", + "GI-VEN-CHY, nigga God Bless you.", + "My favorite dish is turkey lasagna / Even my pajamas designer.", + "Walked in, ill nigga alert! ill nigga alert!", + "Like fuck your baby daddy, his daddy should've worn a condom", +] diff --git a/host.json b/host.json new file mode 100644 index 0000000..d342a8e --- /dev/null +++ b/host.json @@ -0,0 +1,7 @@ +{ + "version": "2.0", + "extensionBundle": { + "id": "Microsoft.Azure.Functions.ExtensionBundle", + "version": "[1.*, 2.0.0)" + } +} diff --git a/main.py b/main.py deleted file mode 100644 index 8c4feb0..0000000 --- a/main.py +++ /dev/null @@ -1,44 +0,0 @@ -from fastapi import FastAPI -import json -import random -from starlette.responses import HTMLResponse - -quotes = json.load(open("quotes.json")) - -app = FastAPI() - - -@app.get("/api") -async def quote(): - return {"message": random.choice(quotes)} - - -@app.get("/api/dump") -async def dump(): - return quotes - - -@app.get("/", response_class=HTMLResponse) -async def index(): - quote = random.choice(quotes) - return f""" - -
-