Skip to content

Commit

Permalink
fix:added logs
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-Roshan-lab committed Jan 19, 2024
1 parent 7a6f486 commit 983b7c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/subscribe_to_topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@

def main(context):
if 'timetable_app' not in firebase_admin._apps:
key = eval(os.environ['KEY'])
cred = credentials.Certificate(key)
firebase_admin.initialize_app(cred, name='timetable_app')
key = eval(os.environ['KEY'])
context.log(key)
if (context.req.path == "/"):
return context.res.json({"msg": "working, use /subscribe to register users"})
if (context.req.path == "/subscribe"):
token = context.req.query['token']
context.log(token)
response = messaging.subscribe_to_topic(token, "timetable")
context.log(response.success_count, 'tokens were subscribed successfully')
return context.res.json({"msg": "success"}, 200)
Expand Down

0 comments on commit 983b7c6

Please sign in to comment.