Fakultas Ilmu Komputer UI

Commit e3823b4b authored by Nurma Ayu Wigati S. Subroto's avatar Nurma Ayu Wigati S. Subroto
Browse files

1906438014-240

parent 4d9fccb0
import requests
from twilio.rest import Client
endpoint = "https://api.twitch.tv/helix/streams?"
headers = {"Client-ID": "gitlab.cs.ui.ac.id"}
params = {"user_login": "nurma.ayu@ui.ac.id"}
response = request.get(endpoint, params=params, headers=headers)
json_response = response.json()
streams = json_response.get('data', [])
is_active = lambda stream:stream.get('type') == 'live'
streams_active = filter(is_active, streams)
at_least_one_stream_active = any(streams_active)
if at_least_one_stream_active:
client = Client(<Your Account SID>, <Your Auth Token>)
client.messages.create(body='LIVE !!!',from_=<Your Trial Number>,to=<Your Real Number>)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment