Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
env
node_modules
.serverless
__pycache__
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# padel_availability

## How to install
- ensure python3.9 is installed `python3 --version`
- install virtualenv `pip3 install virtualenv`
- use `pip3 install virtualenv --break-system-packages` when using python3.11 or newer
- create envrionment `python3 -m venv env`
- create environment directly for python3.9 `python3.9 -m venv env`
- activate envrionment `source env/bin/activate`
- you should now see a "(env)" in your command line
- for later deactivating the environment run `deactivate`
Expand All @@ -14,3 +14,8 @@
- install dependency `pip3 install ...`
- save dependency to requirements.txt by running `pip3 freeze > requirements.txt`
- and commit it

## Deploy serverless function
- run `npm install` to install serverless dependency
- run `npm run deploy` to deploy
- you probably have to authenticate via serverless and aws
15 changes: 15 additions & 0 deletions handler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import json
from padel_availability import *
from datetime import datetime, timedelta

def check_availability(event, context):
body = {
"message": "Go Serverless v2.0! Your function executed successfully!",
"input": event,
}

today = datetime.now().date()
availability = getAvailability(today + timedelta(1))
return {"statusCode": 200, "body": json.dumps(list(availability))}

print(check_availability("", ""))
Loading