equal
deleted
inserted
replaced
1 # coding=utf-8 |
1 # coding=utf-8 |
2 from datetime import datetime |
|
3 |
|
4 # parser.py - Module for parsing whois response data |
2 # parser.py - Module for parsing whois response data |
5 # Copyright (c) 2008 Andrey Petrov |
3 # Copyright (c) 2008 Andrey Petrov |
6 # |
4 # |
7 # This module is part of pywhois and is released under |
5 # This module is part of pywhois and is released under |
8 # the MIT license: http://www.opensource.org/licenses/mit-license.php |
6 # the MIT license: http://www.opensource.org/licenses/mit-license.php |
9 |
7 |
|
8 |
|
9 import json |
|
10 from datetime import datetime |
10 import re |
11 import re |
11 try: |
12 try: |
12 import dateutil.parser as dp |
13 import dateutil.parser as dp |
13 from time_zones import tz_data |
14 from time_zones import tz_data |
14 DATEUTIL = True |
15 DATEUTIL = True |
134 |
135 |
135 |
136 |
136 def __getattr__(self, name): |
137 def __getattr__(self, name): |
137 return self.get(name) |
138 return self.get(name) |
138 |
139 |
|
140 |
|
141 def __str__(self): |
|
142 handler = lambda e: str(e) |
|
143 return json.dumps(self, indent=2, default=handler) |
|
144 |
139 |
145 |
140 @staticmethod |
146 @staticmethod |
141 def load(domain, text): |
147 def load(domain, text): |
142 """Given whois output in ``text``, return an instance of ``WhoisEntry`` |
148 """Given whois output in ``text``, return an instance of ``WhoisEntry`` |
143 that represents its parsed contents. |
149 that represents its parsed contents. |