Permalink
Browse files

First commit

  • Loading branch information...
0 parents commit 3079d135d5020adb354b4a711d094f6581a277a3 @zachwill committed Apr 11, 2012
Showing with 96 additions and 0 deletions.
  1. +17 −0 README.md
  2. +16 −0 requirements.txt
  3. +36 −0 setup.py
  4. +6 −0 test.py
  5. +1 −0 zippy/__init__.py
  6. +20 −0 zippy/core.py
@@ -0,0 +1,17 @@
+zippy
+=====
+
+A simple Python for the Ziptastic ZIP Code API search.
+
+```python
+>>> import zippy
+
+>>> zippy.do(94155)
+{'SF': {'ZIPCode': 'data'}}
+
+>>> zippy.do('94155')
+{'SF': {'ZIPCode': 'data'}}
+
+>>> zippy.da(94155)
+{'SF': {'ZIPCode': 'data'}}
+```
@@ -0,0 +1,16 @@
+# --------------------
+# HTTP
+# --------------------
+requests
+
+
+# --------------------
+# Testing
+# --------------------
+mock
+
+
+# --------------------
+# JSON
+# --------------------
+simplejson
@@ -0,0 +1,36 @@
+"""
+Setup and installation for the package.
+"""
+
+try:
+ from setuptools import setup
+except ImportError:
+ from distutils.core import setup
+
+
+setup(
+ name="zippy",
+ version="0.1",
+ url="http://github.com/zachwill/zippy",
+ author="Zach Williams",
+ author_email="hey@zachwill.com",
+ description="A simple wrapper for the Ziptastic ZIPCode Search API.",
+ packages=[
+ 'zippy'
+ ],
+ install_requires=[
+ 'mock',
+ 'requests',
+ 'simplejson',
+ ],
+ license='MIT',
+ classifiers=[
+ 'Development Status :: 1 - Planning',
+ 'Intended Audience :: Developers',
+ 'Natural Language :: English',
+ 'License :: OSI Approved :: MIT License',
+ 'Programming Language :: Python',
+ 'Programming Language :: Python :: 2.6',
+ 'Programming Language :: Python :: 2.7',
+ ],
+)
@@ -0,0 +1,6 @@
+"""
+Tests for the package.
+"""
+
+import unittest
+import zippy
@@ -0,0 +1 @@
+from .core import do, da
@@ -0,0 +1,20 @@
+"""
+Core functionality for the Ziptastic ZIPCode API wrapper.
+"""
+
+import requests
+from simplejson import loads
+
+
+def do(zipcode):
+ """Search for a ZIPCode."""
+ if isinstance(zipcode, int):
+ zipcode = str(zipcode)
+ url = "http://zip.elevenbasetwo.com/?zip=%s" % zipcode
+ req = requests.get(url)
+ return loads(req.content)
+
+
+def da(zipcode):
+ """Just because."""
+ return do(zipcode)

0 comments on commit 3079d13

Please sign in to comment.