diff options
Diffstat (limited to 'async_bot.py')
-rwxr-xr-x | async_bot.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/async_bot.py b/async_bot.py index 51a347c..5c60503 100755 --- a/async_bot.py +++ b/async_bot.py | |||
@@ -187,8 +187,7 @@ def insert_message_to_database(time, id, msg): | |||
187 | 187 | ||
188 | 188 | ||
189 | def main(): | 189 | def main(): |
190 | # global intel | 190 | logger = logging.getLogger(__name__) |
191 | logger = logging.getLogger('main') | ||
192 | 191 | ||
193 | # Lat & Lng of fetch region | 192 | # Lat & Lng of fetch region |
194 | field = { | 193 | field = { |
@@ -211,7 +210,7 @@ def main(): | |||
211 | except CookieException: | 210 | except CookieException: |
212 | logger.error(get_time() + ': Fetch Cookie Failed') | 211 | logger.error(get_time() + ': Fetch Cookie Failed') |
213 | time.sleep(3) | 212 | time.sleep(3) |
214 | except Exception: | 213 | except: |
215 | logger.error(get_time() + ": Unexpected error: " + str(sys.exc_info()[0]) + " " + str(inspect.currentframe().f_lineno)) | 214 | logger.error(get_time() + ": Unexpected error: " + str(sys.exc_info()[0]) + " " + str(inspect.currentframe().f_lineno)) |
216 | time.sleep(3) | 215 | time.sleep(3) |
217 | 216 | ||
@@ -224,7 +223,7 @@ def main(): | |||
224 | 223 | ||
225 | with open('cookie') as cookies: | 224 | with open('cookie') as cookies: |
226 | cookies = cookies.read().strip() | 225 | cookies = cookies.read().strip() |
227 | 226 | ||
228 | # fetch message per time | 227 | # fetch message per time |
229 | while True: | 228 | while True: |
230 | try: | 229 | try: |
@@ -232,8 +231,8 @@ def main(): | |||
232 | result = intel.fetch_msg(mints, maxts, reverse, tab) | 231 | result = intel.fetch_msg(mints, maxts, reverse, tab) |
233 | if result: | 232 | if result: |
234 | mints = result[0][1] + 1 | 233 | mints = result[0][1] + 1 |
235 | break | 234 | break |
236 | except Exception: | 235 | except: |
237 | logger.error(get_time() + ": Unexpected error: " + str(sys.exc_info()[0]) + " " + str(inspect.currentframe().f_lineno)) | 236 | logger.error(get_time() + ": Unexpected error: " + str(sys.exc_info()[0]) + " " + str(inspect.currentframe().f_lineno)) |
238 | time.sleep(3) | 237 | time.sleep(3) |
239 | 238 | ||