Skip to content

Instantly share code, notes, and snippets.

@deguchi deguchi/index.py
Last active Jul 6, 2017

Embed
What would you like to do?
# -*- coding: utf-8 -*-
import re
import json
import requests
url = 'https://store.nintendo.co.jp/customize.html'
content = requests.get(url).text
if re.search(r'\bSOLD\s+OUT\b', content):
print('Nintendo Switch SOLD OUT.')
else:
requests.post('SET-YOUR_SLACK-WEBHOOK-URL', data = json.dumps({
'channel': u'発売',
'text': u"Hi, @deguchi. My Nintendo Store customization html has been changed.<%s>" % url, # 投稿するテキスト
'username': u'発売チェッカー', # 投稿のユーザー名
'icon_emoji': u':ghost:', # 投稿のプロフィール画像に入れる絵文字
'link_names': 1, # メンションを有効にする
}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.