Skip to content

Commit

Permalink
Minor formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kchristensen committed Jun 19, 2018
1 parent 12adaef commit e1deb2c
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions slappd/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def config_copy():
sys.exit('Error: Could not create directory {}'.format(config_dir))
try:
shutil.copy(config_src, config_dst)
sys.exit('Successfully created configuration file, please edit '
'it to reflect your API information.')
sys.exit('Successfully created configuration file {}, please edit '
'it to reflect your API information.'.format(config_dst))
except IOError:
sys.exit('Error: Could not write to configuration file {}'.format(config_dst))

Expand Down Expand Up @@ -125,7 +125,6 @@ def get_cfg_path():

def slack_message(images=None, msg_type=None, text=None):
""" Sends a Slack message via webhooks """
url = 'https://hooks.slack.com/services/' + CONFIG.get('slack', 'token')
payload = {
'icon_url': images['icon_url'],
'username': 'Untappd',
Expand All @@ -145,7 +144,8 @@ def slack_message(images=None, msg_type=None, text=None):
}]

try:
requests.post(url, json=payload)
requests.post('https://hooks.slack.com/services/{}'.format(
CONFIG.get('slack', 'token')), json=payload)
except requests.exceptions.RequestException:
sys.exit('Error: There was an error connecting to the Slack API')

Expand Down Expand Up @@ -219,9 +219,7 @@ def main():

# We're not deferring, so lump all the messages together
if text and defer_sending:
slack_message(
images=images,
text=text)
slack_message(images=images, text=text)

# Find the id of the most recent check-in
if data['response']['checkins']['count']:
Expand Down

0 comments on commit e1deb2c

Please sign in to comment.