|
|
@ -10,6 +10,7 @@ from furl import furl
|
|
|
|
import requests
|
|
|
|
import requests
|
|
|
|
import extruct
|
|
|
|
import extruct
|
|
|
|
import html
|
|
|
|
import html
|
|
|
|
|
|
|
|
import locale
|
|
|
|
|
|
|
|
|
|
|
|
def make_affiliate(url):
|
|
|
|
def make_affiliate(url):
|
|
|
|
u = furl(url)
|
|
|
|
u = furl(url)
|
|
|
@ -29,7 +30,7 @@ def unfurl(url):
|
|
|
|
currency = ld['offers']['priceCurrency']
|
|
|
|
currency = ld['offers']['priceCurrency']
|
|
|
|
if currency == 'SEK':
|
|
|
|
if currency == 'SEK':
|
|
|
|
currency = 'kr'
|
|
|
|
currency = 'kr'
|
|
|
|
price = ld['offers']['price'] + ' ' + currency
|
|
|
|
price = f'{float(ld["offers"]["price"]):n}' + ' ' + currency
|
|
|
|
|
|
|
|
|
|
|
|
return {'fallback': title + ' <' + url + '>',
|
|
|
|
return {'fallback': title + ' <' + url + '>',
|
|
|
|
'color': '#cf8e00', # ELAB-orange
|
|
|
|
'color': '#cf8e00', # ELAB-orange
|
|
|
@ -51,6 +52,9 @@ def unfurl(url):
|
|
|
|
#'ts': 123456789 # Endast om informationen är knuten till en viss tidpunkt
|
|
|
|
#'ts': 123456789 # Endast om informationen är knuten till en viss tidpunkt
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Sätt locale (för att få komma som decimaltecken).
|
|
|
|
|
|
|
|
locale.setlocale(locale.LC_ALL, '')
|
|
|
|
|
|
|
|
|
|
|
|
# Our app's Slack Event Adapter for receiving actions via the Events API
|
|
|
|
# Our app's Slack Event Adapter for receiving actions via the Events API
|
|
|
|
slack_signing_secret = os.environ['SLACK_SIGNING_SECRET'] # <https://api.slack.com/apps/AN6HH95ML/general>
|
|
|
|
slack_signing_secret = os.environ['SLACK_SIGNING_SECRET'] # <https://api.slack.com/apps/AN6HH95ML/general>
|
|
|
|
slack_events_adapter = SlackEventAdapter(slack_signing_secret, '/slack-eggberg/events')
|
|
|
|
slack_events_adapter = SlackEventAdapter(slack_signing_secret, '/slack-eggberg/events')
|
|
|
|