aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xasync_bot.py11
-rwxr-xr-xingrex/intel.py2
2 files changed, 6 insertions, 7 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
189def main(): 189def 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
diff --git a/ingrex/intel.py b/ingrex/intel.py
index 2cc4e7f..ca48bf0 100755
--- a/ingrex/intel.py
+++ b/ingrex/intel.py
@@ -43,7 +43,7 @@ class Intel(object):
43 count = 0 43 count = 0
44 while count < 3: 44 while count < 3:
45 try: 45 try:
46 request = self.session.post(url, data=json.dumps(payload), headers=self.headers, timeout=(10, 60)) 46 request = self.session.post(url, data=json.dumps(payload), headers=self.headers, timeout=300)
47 return request.json()['result'] 47 return request.json()['result']
48 except requests.ConnectionError: 48 except requests.ConnectionError:
49 raise IntelException 49 raise IntelException
Powered by cgit v1.2.3 (git 2.41.0)