Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
Kape
Commits
e3823b4b
Commit
e3823b4b
authored
Dec 06, 2019
by
Nurma Ayu Wigati S. Subroto
Browse files
1906438014-240
parent
4d9fccb0
Changes
1
Hide whitespace changes
Inline
Side-by-side
assets/js/NotificationSMS.jsx
0 → 100644
View file @
e3823b4b
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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment