| 1321 | |
| 1322 | @staticmethod |
| 1323 | def parse_date(timestamp=None): |
| 1324 | if timestamp is None: |
| 1325 | return None |
| 1326 | if not isinstance(timestamp, str): |
| 1327 | return None |
| 1328 | if 'GMT' in timestamp: |
| 1329 | try: |
| 1330 | parsed = parsedate(timestamp) |
| 1331 | if parsed is None: |
| 1332 | return None |
| 1333 | return calendar.timegm(parsed[:6]) * 1000 |
| 1334 | except (TypeError, OverflowError, OSError): |
| 1335 | return None |
| 1336 | return Exchange.parse8601(timestamp) |
| 1337 | |
| 1338 | _PARSE8601_ISO8601_PATTERN = re.compile( |
| 1339 | r'([0-9]{4})-?([0-9]{2})-?([0-9]{2})(?:T|[\s])?' |