Merge pull request #25 from AlexMekkering/optional_telegram_lines
Support optional telegram signatures
This commit is contained in:
		
						commit
						5f1afeb1f8
					
				| @ -51,11 +51,9 @@ class TelegramParser(object): | |||||||
|         for signature, parser in self.telegram_specification['objects'].items(): |         for signature, parser in self.telegram_specification['objects'].items(): | ||||||
|             match = re.search(signature, telegram_data, re.DOTALL) |             match = re.search(signature, telegram_data, re.DOTALL) | ||||||
| 
 | 
 | ||||||
|             # All telegram specification lines/signatures are expected to be |             # Some signatures are optional and may not be present, | ||||||
|             # present. |             # so only parse lines that match | ||||||
|             if not match: |             if match: | ||||||
|                 raise ParseError('Telegram specification does not match ' |  | ||||||
|                                  'telegram data') |  | ||||||
|                 telegram[signature] = parser.parse(match.group(0)) |                 telegram[signature] = parser.parse(match.group(0)) | ||||||
| 
 | 
 | ||||||
|         return telegram |         return telegram | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user