diff options
author | Jinwei Zhao <[email protected]> | 2017-01-31 19:39:47 +0800 |
---|---|---|
committer | Jinwei Zhao <[email protected]> | 2017-02-01 21:41:54 +0800 |
commit | 94b20af64c9e0826b9cab3433873d689e6e3d4f7 (patch) | |
tree | f68a52c6eddbb9af1208fe0bbfaa678fb13c91a1 /ingrex | |
parent | 88750f859acf7e91d1f6403f89baa54189f51cbd (diff) | |
download | COMM2TG-94b20af64c9e0826b9cab3433873d689e6e3d4f7.tar.gz |
parse message
Diffstat (limited to 'ingrex')
-rwxr-xr-x | ingrex/intel.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ingrex/intel.py b/ingrex/intel.py index 506c6bc..2cc4e7f 100755 --- a/ingrex/intel.py +++ b/ingrex/intel.py | |||
@@ -43,14 +43,14 @@ 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=600) | 46 | request = self.session.post(url, data=json.dumps(payload), headers=self.headers, timeout=(10, 60)) |
47 | return request.json()['result'] | 47 | return request.json()['result'] |
48 | except requests.ConnectionError: | 48 | except requests.ConnectionError: |
49 | raise IntelError | 49 | raise IntelException |
50 | except Exception: | 50 | except Exception: |
51 | count += 1 | 51 | count += 1 |
52 | continue | 52 | continue |
53 | raise CookieError | 53 | raise CookieException |
54 | 54 | ||
55 | def fetch_msg(self, mints=-1, maxts=-1, reverse=False, tab='all'): | 55 | def fetch_msg(self, mints=-1, maxts=-1, reverse=False, tab='all'): |
56 | "fetch message from Ingress COMM, tab can be 'all', 'faction', 'alerts'" | 56 | "fetch message from Ingress COMM, tab can be 'all', 'faction', 'alerts'" |
@@ -133,12 +133,12 @@ class Intel(object): | |||
133 | return self.fetch(url, payload) | 133 | return self.fetch(url, payload) |
134 | 134 | ||
135 | 135 | ||
136 | class IntelError(BaseException): | 136 | class IntelException(BaseException): |
137 | """Intel Error""" | 137 | """Intel Error""" |
138 | pass | 138 | pass |
139 | 139 | ||
140 | 140 | ||
141 | class CookieError(IntelError): | 141 | class CookieException(IntelException): |
142 | """Intel Error""" | 142 | """Intel Error""" |
143 | pass | 143 | pass |
144 | 144 | ||