updating latest
This commit is contained in:
1
slack-bot/traffic-scraper/prd/16-11-2019_19:57:07.json
Normal file
1
slack-bot/traffic-scraper/prd/16-11-2019_19:57:07.json
Normal file
@@ -0,0 +1 @@
|
||||
[" Let's check the latest updates from Highways England as of 19:57:07! \ud83d\ude93\ud83d\udea8", "There are currently no reported congestion incidents on the M62 \ud83e\udd14", "There are currently no reported accident incidents on the M62 \ud83e\udd14", "Hey Andy, maybe flying would be quicker? \ud83d\ude81"]
|
||||
@@ -6,6 +6,7 @@ import emoji
|
||||
import random
|
||||
import json
|
||||
import os
|
||||
from chromedriver_py import binary_path
|
||||
|
||||
|
||||
class getTrafficInfo(object):
|
||||
@@ -69,7 +70,10 @@ class getTrafficInfo(object):
|
||||
options = webdriver.ChromeOptions()
|
||||
options.add_argument('headless')
|
||||
# Start the Chromedriver
|
||||
browser = webdriver.Chrome(options=options)
|
||||
browser = webdriver.Chrome(
|
||||
executable_path=binary_path,
|
||||
options=options,
|
||||
)
|
||||
browser.get(url)
|
||||
return browser
|
||||
else:
|
||||
|
||||
14
slack-bot/traffic-scraper/prd/requirements.txt
Normal file
14
slack-bot/traffic-scraper/prd/requirements.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
aiohttp==3.6.2
|
||||
async-timeout==3.0.1
|
||||
attrs==19.3.0
|
||||
certifi==2019.9.11
|
||||
chardet==3.0.4
|
||||
chromedriver-py==79.0.3945.16
|
||||
emoji==0.5.4
|
||||
idna==2.8
|
||||
multidict==4.5.2
|
||||
requests==2.22.0
|
||||
selenium==3.141.0
|
||||
slackclient==2.3.1
|
||||
urllib3==1.25.7
|
||||
yarl==1.3.0
|
||||
@@ -32,6 +32,7 @@ accidentMessage = None
|
||||
congestionMessageStart = None
|
||||
congestionMessageEnd = None
|
||||
accidentMessageStart = None
|
||||
|
||||
accidentMessageEnd = None
|
||||
|
||||
messageTitle = data[0]
|
||||
26
slack-bot/traffic-scraper/prd/slackBot2.py
Normal file
26
slack-bot/traffic-scraper/prd/slackBot2.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import slack
|
||||
|
||||
|
||||
@slack.RTMClient.run_on(event='message')
|
||||
def say_hello(**payload):
|
||||
data = payload['data']
|
||||
web_client = payload['web_client']
|
||||
rtm_client = payload['rtm_client']
|
||||
if 'Hello' in data.get('text', []):
|
||||
channel_id = data['channel']
|
||||
thread_ts = data['ts']
|
||||
user = data['user']
|
||||
|
||||
web_client.chat_postMessage(
|
||||
channel=channel_id, text=f"Hi <@{user}>!", thread_ts=thread_ts
|
||||
)
|
||||
|
||||
|
||||
slack_token = (
|
||||
'xoxp-2443045155-231150911092-792886570180-0cf573954c0eeb7f40c7'
|
||||
'8bc6f5c959db'
|
||||
)
|
||||
|
||||
# slack_token = os.environ["SLACK_API_TOKEN"]
|
||||
rtm_client = slack.RTMClient(token=slack_token)
|
||||
rtm_client.start()
|
||||
Reference in New Issue
Block a user