Skip to content

Commit

Permalink
Refactor: message push
Browse files Browse the repository at this point in the history
  • Loading branch information
tychxn committed Feb 5, 2020
1 parent 00445f3 commit a0e8746
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion jd_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self):

self.timeout = float(global_config.get('config', 'timeout') or DEFAULT_TIMEOUT)
self.send_message = global_config.getboolean('messenger', 'enable')
self.messenger = Messenger() if self.send_message else None
self.messenger = Messenger(global_config.get('messenger', 'sckey').strip()) if self.send_message else None

self.item_cat = dict()
self.item_vender_ids = dict() # 记录商家id
Expand Down
4 changes: 1 addition & 3 deletions messenger.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@

import requests

from config import global_config
from exception import AsstException
from log import logger


class Messenger(object):
"""消息推送类"""

def __init__(self):
sc_key = global_config.get('messenger', 'sckey').strip()
def __init__(self, sc_key):
if not sc_key:
raise AsstException('sc_key can not be empty')

Expand Down

0 comments on commit a0e8746

Please sign in to comment.