Commits

Lars Yencken committed 7f80326

Add a license and a basic readme.

Comments (0)

Files changed (2)

+Copyright (c) 2012, Lars Yencken. Permission to use, copy, modify, and/or
+distribute this software for any purpose with or without fee is hereby
+granted, provided that the above copyright notice and this permission notice
+appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR
+DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE
+LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY
+DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# Globetrotter
+
+Approximate country and language name matching for `pycountry`, making it an even better reference for messy data.
+
+## Motivation
+
+```
+>>> import pycountry
+>>> pycountry.countries.get(name='Vietnam')
+Traceback (most recent call last):
+  File "<stdin>", line 1, in <module>
+  File "/Users/you/Library/Python/2.7/lib/python/site-packages/pycountry/db.py", line 85, in get
+    return self.indices[field][value]
+KeyError: 'Vietnam'
+>>>
+```
+
+## Usage
+
+Find a country through the `find_country()` method, giving it an approximate string name. It returns a `Country` object with ISO metadata about the match.
+
+```
+>>> import globetrotter
+g>>> globetrotter.find_country('Vietnam')
+<pycountry.db.Country object at 0x1038eed90>
+>>> globetrotter.find_country('Vietnam').name
+u'Viet Nam'
+```
+
+Find a language through the `find_language()` method in a similar way. It returns a `Language` object.
+
+```
+>>> import globetrotter
+>>> globetrotter.find_language('Spanish')
+<pycountry.db.Language object at 0x103a444d0>
+>>> globetrotter.find_language('Spanish').name
+u'Spanish; Castilian'
+```
+