Skip to content

Commit

Permalink
log requests at info level
Browse files Browse the repository at this point in the history
  • Loading branch information
rukayaj committed May 12, 2024
1 parent 6734c95 commit dc84d38
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@
- Create a group, add the bot and any users.
- add IDBot or similar to get the chat id, and add as an env: TELEGRAM_CHAT_ID
- Set the webhook for the bot:
- curl -F "url=https://abc123.ngrok.io/webhook" https://api.telegram.org/bot<YourBOTToken>/setWebhook
- If it changes, delete it with curl https://api.telegram.org/bot<YourBOTToken>/deleteWebhook
- `curl -F "url=https://abc123.ngrok.io/webhook" https://api.telegram.org/bot<YourBOTToken>/setWebhook`
- If it changes, delete it with `curl https://api.telegram.org/bot<YourBOTToken>/deleteWebhook`

# Deploy on Kubernetes
- Create an .env file based on .env.template and populate with your secrets
- Run `kubectl create secret generic telegram-bot --from-env-file=.env`
- `kubectl apply -f deployment.yml`
4 changes: 2 additions & 2 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def handle_exception(e):

@app.before_request
def log_request_info():
app.logger.debug('Headers: %s', request.headers)
app.logger.debug('Body: %s', request.get_data())
app.logger.info('Headers: %s', request.headers)
app.logger.info('Body: %s', request.get_data())

if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
Expand Down

0 comments on commit dc84d38

Please sign in to comment.