Skip to content
Browse files

gah... my beautiful abstraction

  • Loading branch information...
1 parent cea2918 commit 4f4443abd12fb191eb950826db8094360b8089aa @johnfn johnfn committed Apr 16, 2011
Showing with 35 additions and 0 deletions.
  1. +35 −0 sba_loans_grants_api.py
View
35 sba_loans_grants_api.py
@@ -0,0 +1,35 @@
+from generic_api import *
+
+# Simple Python wrapper around the SBA Business API.
+
+def build_api_list(list, base):
+ result = []
+ for item in list:
+ result.append((item, base + "/" + item + "/" ))
+
+ return result
+
+
+#These are the function calls that the SBABusinessesAPI object exposes.
+list = [ "federal"
+ , "state_financing_for"
+ , "federal_and_state_financing_for"
+ # , "nil/for_profit"
+ # , "nil/for_profit/nil" #What were they thinking?!
+ # , "nil/for_profit"
+ # STATE ABBREVIATION/for_profit/nil/SPECIALTY
+ # STATE ABBREVIATION/for_profit/nil/SPECIALTY1-SPECIALTY2- ... SPECIALTYN
+ # STATE ABBREVIATION/for_profit/INDUSTRY/SPECIALTY
+ ]
+
+APIS = build_api_list(list, "http://api.sba.gov/loans_grants")
+
+class SBALoansGrantsAPI(GenericAPI):
+ def __init__(self):
+ GenericAPI.__init__(self, APIS)
+
+
+# Sample use of BroadbandApi
+if __name__ == "__main__":
+ bb = SBALoansGrantsAPI()
+ print bb.by_category("doing business as") # (Should be San Francisco)

0 comments on commit 4f4443a

Please sign in to comment.
Something went wrong with that request. Please try again.