Deserializes string to datetime. The string should be in iso8601 datetime format. :param string: str. :return: datetime.
(self, string)
| 647 | ) |
| 648 | |
| 649 | def __deserialize_datetime(self, string): |
| 650 | """Deserializes string to datetime. |
| 651 | |
| 652 | The string should be in iso8601 datetime format. |
| 653 | |
| 654 | :param string: str. |
| 655 | :return: datetime. |
| 656 | """ |
| 657 | try: |
| 658 | return parse(string) |
| 659 | except ImportError: |
| 660 | return string |
| 661 | except ValueError: |
| 662 | raise rest.ApiException( |
| 663 | status=0, |
| 664 | reason=( |
| 665 | "Failed to parse `{0}` as datetime object" |
| 666 | .format(string) |
| 667 | ) |
| 668 | ) |
| 669 | |
| 670 | def __deserialize_model(self, data, klass): |
| 671 | """Deserializes list or dict to model. |