Skip to content

Commit 992839d

Browse files
committed
2.4.0 release
2 parents 7504b22 + 0521e03 commit 992839d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+8569
-71
lines changed

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ The manual (including install instructions) can be found in the doc/ directory.
2929
* Nameservers
3030
* Optional WHOIS data normalization
3131
* Attempts to intelligently reformat WHOIS data for better (human) readability
32+
* Converts various abbreviation types to full locality names
33+
* Airport codes
34+
* Country names (2- and 3-letter ISO codes)
35+
* US states and territories
36+
* Canadian states and territories
37+
* Australian states
3238
* `pwhois`, a simple WHOIS tool using pythonwhois
3339
* Easily readable output format
3440
* Can also output raw WHOIS data
@@ -39,6 +45,8 @@ The manual (including install instructions) can be found in the doc/ directory.
3945

4046
## Important update notes
4147

48+
*2.4.0 and up*: A lot of changes were made to the normalization, and the performance under Python 2.x was significantly improved. The average parsing time under Python 2.7 has dropped by 94% (!), and on my system averages out at 18ms. Performance under Python 3.x is [unchanged](https://github.com/joepie91/python-whois/issues/27). `pythonwhois` will now expand a lot of abbreviations in normalized mode, such as airport codes, ISO country codes, and US/CA/AU state abbreviations. The consequence of this is that the library is now bigger (as it ships a list of these abbreviations). Also note that there *may* be licensing consequences, in particular regarding the airport code database. More information about that can be found below.
49+
4250
*2.3.0 and up*: Python 3 support was fixed. Creation date parsing for contacts was fixed; correct timestamps will now be returned, rather than unformatted ones - if your application relies on the broken variant, you'll need to change your code. Some additional parameters were added to the `net` and `parse` methods to facilitate NIC handle lookups; the defaults are backwards-compatible, and these changes should not have any consequences for your code. Thai WHOIS parsing was implemented, but is a little spotty - data may occasionally be incorrectly split up. Please submit a bug report if you run across any issues.
4351

4452
*2.2.0 and up*: The internal workings of `get_whois_raw` have been changed, to better facilitate parsing of WHOIS data from registries that may return multiple partial matches for a query, such as `whois.verisign-grs.com`. This change means that, by default, `get_whois_raw` will now strip out the part of such a response that does not pertain directly to the requested domain. If your application requires an unmodified raw WHOIS response and is calling `get_whois_raw` directly, you should use the new `never_cut` parameter to keep pythonwhois from doing this post-processing. As this is a potentially breaking behaviour change, the minor version has been bumped.
@@ -51,6 +59,23 @@ The manual (including install instructions) can be found in the doc/ directory.
5159

5260
If any of those apply, don't hesitate to file an issue! The goal is 100% coverage, and we need your feedback to reach that goal.
5361

62+
## License
63+
64+
This library may be used under the WTFPL - or, if you take issue with that, consider it to be under the CC0.
65+
66+
## Data sources
67+
68+
This library uses a number of third-party datasets for normalization:
69+
70+
* `airports.dat`: [OpenFlights Airports Database](http://openflights.org/data.html) ([Open Database License 1.0](http://opendatacommons.org/licenses/odbl/1.0/), [Database Contents License 1.0](http://opendatacommons.org/licenses/dbcl/1.0/))
71+
* `countries.dat`: [Country List](https://github.com/umpirsky/country-list) (MIT license)
72+
* `countries3.dat`: [ISO countries list](https://gist.github.com/eparreno/205900) (license unspecified)
73+
* `states_au.dat`: Part of `pythonwhois` (WTFPL/CC0)
74+
* `states_us.dat`: [State Table](http://statetable.com/) (license unspecified, free reuse encouraged)
75+
* `states_ca.dat`: [State Table](http://statetable.com/) (license unspecified, free reuse encouraged)
76+
77+
Be aware that the OpenFlights database in particular has potential licensing consequences; if you do not wish to be bound by these potential consequences, you may simply delete the `airports.dat` file from your distribution. `pythonwhois` will assume there is no database available, and will not perform airport code conversion (but still function correctly otherwise). This also applies to other included datasets.
78+
5479
## Contributing
5580

5681
Feel free to fork and submit pull requests (to the `develop` branch)! If you change any parsing or normalization logic, ensure to run the full test suite before opening a pull request. Instructions for that are below.

pwhois

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python2
22

3-
import argparse, pythonwhois, json, datetime
3+
import argparse, pythonwhois, json, datetime, sys
44
try:
55
from collections import OrderedDict
66
except ImportError as e:
@@ -100,7 +100,15 @@ else:
100100
for key, value in data_map.items():
101101
if key in contact_data and contact_data[key] is not None:
102102
label = " " + value + (" " * (widest_label - len(value))) + " :"
103-
actual_data = contact_data[key]
103+
if sys.version_info < (3, 0):
104+
if type(contact_data[key]) == str:
105+
actual_data = contact_data[key].decode("utf-8")
106+
elif type(contact_data[key]) == datetime.datetime:
107+
actual_data = unicode(contact_data[key])
108+
else:
109+
actual_data = contact_data[key]
110+
else:
111+
actual_data = str(contact_data[key])
104112
if "\n" in actual_data: # Indent multi-line values properly
105113
lines = actual_data.split("\n")
106114
actual_data = "\n".join([lines[0]] + [(" " * (widest_label + 7)) + line for line in lines[1:]])

0 commit comments

Comments
 (0)