diff --git a/.gitignore b/.gitignore index 0d20b64..196b3c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ *.pyc +build/ +dist/ +python_fcc.egg-info/ diff --git a/block_conversion_api.py b/block_conversion_api.py deleted file mode 100644 index cf8c837..0000000 --- a/block_conversion_api.py +++ /dev/null @@ -1,13 +0,0 @@ -from generic_api import * - -# Simple Python wrapper around the Block Conversion API provided by the FCC. - -class BlockConversionAPI(GenericAPI): - def __init__(self): - GenericAPI.__init__(self, [("get_block", "http://data.fcc.gov/api/block/find")]) - - -# Sample use of BlockConversionAPI -if __name__ == "__main__": - bc = BlockConversionAPI() - print bc.get_block(lat=41, long=-87) # (Should be San Francisco) \ No newline at end of file diff --git a/broadband_api.py b/broadband_api.py deleted file mode 100644 index 4f8f562..0000000 --- a/broadband_api.py +++ /dev/null @@ -1,15 +0,0 @@ -from generic_api import * - -# Simple Python wrapper around the Broadband API provided by the FCC. - -APIS = [("get_data", "http://data.fcc.gov/api/speedtest/find")] - -class BroadbandApi(GenericAPI): - def __init__(self): - GenericAPI.__init__(self, APIS) - - -# Sample use of BroadbandApi -if __name__ == "__main__": - bb = BroadbandApi() - print bb.get_data(latitude=37, longitude=-122) # (Should be San Francisco) \ No newline at end of file diff --git a/build/lib.linux-x86_64-2.6/python-fcc/FRNConversionsAPI.py b/build/lib.linux-x86_64-2.6/python-fcc/FRNConversionsAPI.py deleted file mode 100644 index 87fa5b1..0000000 --- a/build/lib.linux-x86_64-2.6/python-fcc/FRNConversionsAPI.py +++ /dev/null @@ -1,45 +0,0 @@ -from generic_api import * -import urllib,json - - -# Simple Python wrapper around the Broadband API provided by the FCC. - -class FRNConversionsAPI(GenericAPI): - """ - FRNConversionsAPI: - - an API to access information about broadband provides. - - original API: http://reboot.fcc.gov/developer/frn-conversions-api - - - methods: - -- getList(stateCode, multi) - takes stateCode=IL or stateCode=17 (FIPS code), - (optional) multi=Yes or multi=No to signify whether to include FRNs also operating outside this state. - - -- getInfo(frn) - takes frn='0017855545' (FRN id) - """ - - - def __init__(self): - apis= [ - ('getList', 'http://data.fcc.gov/api/frn/getList'), - ('getInfo', 'http://data.fcc.gov/api/frn/getInfo')] - - GenericAPI.__init__(self,apis) - - -if __name__ == "__main__": - bb = FRNConversionsAPI() - - x=bb.getList(stateCode='IL') - print type(x) - print len(x) - print x.keys() - - #print x - - print - x=bb.getInfo(frn='0017855545') - print type(x) - print len(x) - print x diff --git a/build/lib.linux-x86_64-2.6/python-fcc/__init__.py b/build/lib.linux-x86_64-2.6/python-fcc/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/build/lib.linux-x86_64-2.6/python-fcc/broadband_api.py b/build/lib.linux-x86_64-2.6/python-fcc/broadband_api.py deleted file mode 100644 index 4f8f562..0000000 --- a/build/lib.linux-x86_64-2.6/python-fcc/broadband_api.py +++ /dev/null @@ -1,15 +0,0 @@ -from generic_api import * - -# Simple Python wrapper around the Broadband API provided by the FCC. - -APIS = [("get_data", "http://data.fcc.gov/api/speedtest/find")] - -class BroadbandApi(GenericAPI): - def __init__(self): - GenericAPI.__init__(self, APIS) - - -# Sample use of BroadbandApi -if __name__ == "__main__": - bb = BroadbandApi() - print bb.get_data(latitude=37, longitude=-122) # (Should be San Francisco) \ No newline at end of file diff --git a/build/lib.linux-x86_64-2.6/python-fcc/license_view_api.py b/build/lib.linux-x86_64-2.6/python-fcc/license_view_api.py deleted file mode 100644 index afa9201..0000000 --- a/build/lib.linux-x86_64-2.6/python-fcc/license_view_api.py +++ /dev/null @@ -1,22 +0,0 @@ -from generic_api import * - -# Simple Python wrapper around the License View API provided by the FCC. - -APIS = [ ("get_licenses", "http://data.fcc.gov/api/license-view/basicSearch/getLicenses" ) - , ("get_common_names", "http://data.fcc.gov/api/license-view/licenses/getCommonNames") - , ("get_statuses", "http://data.fcc.gov/api/license-view/licenses/getStatuses") - , ("get_categories", "http://data.fcc.gov/api/license-view/licenses/getCategories") - , ("get_entities", "http://data.fcc.gov/api/license-view/licenses/getEntities") - , ("get_renewals", "http://data.fcc.gov/api/license-view/licenses/getRenewals") - , ("get_issued", "http://data.fcc.gov/api/license-view/licenses/getIssued") - ] - - -class LicenseViewAPI(GenericAPI): - def __init__(self): - GenericAPI.__init__(self, APIS) - -# Sample use of BlockConversionAPI -if __name__ == "__main__": - bc = LicenseViewAPI() - print bc.get_licenses(searchValue = "Verizon Wireless") \ No newline at end of file diff --git a/build/lib.linux-x86_64-2.6/python-fcc/sba_businesses_api.py b/build/lib.linux-x86_64-2.6/python-fcc/sba_businesses_api.py deleted file mode 100644 index efcf19b..0000000 --- a/build/lib.linux-x86_64-2.6/python-fcc/sba_businesses_api.py +++ /dev/null @@ -1,33 +0,0 @@ -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 = [ "by_category" - , "all_by_state" - , "by_business_type" - , "state_only" - , "state_and_county" - , "state_and_city" - , "by_zip" - ] - -APIS = build_api_list(list, "http://api.sba.gov/license_permit") - -class SBABusinessesAPI(GenericAPI): - def __init__(self): - GenericAPI.__init__(self, APIS) - - -# Sample use of BroadbandApi -if __name__ == "__main__": - bb = SBABusinessesAPI() - print bb.by_category("doing business as") # (Should be San Francisco) \ No newline at end of file diff --git a/build/lib.linux-x86_64-2.6/python-fcc/tests/__init__.py b/build/lib.linux-x86_64-2.6/python-fcc/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/build/lib.linux-x86_64-2.6/python-fcc/tests/__main__.py b/build/lib.linux-x86_64-2.6/python-fcc/tests/__main__.py deleted file mode 100644 index 19b9936..0000000 --- a/build/lib.linux-x86_64-2.6/python-fcc/tests/__main__.py +++ /dev/null @@ -1,5 +0,0 @@ -from tests.testcases import * -from tests.testutils import * - -if __name__ == '__main__': - unittest.main() diff --git a/build/lib.linux-x86_64-2.6/python-fcc/tests/testcases.py b/build/lib.linux-x86_64-2.6/python-fcc/tests/testcases.py deleted file mode 100644 index 79df288..0000000 --- a/build/lib.linux-x86_64-2.6/python-fcc/tests/testcases.py +++ /dev/null @@ -1,105 +0,0 @@ -import sys -import unittest - -sys.path.append('../') - -from broadband_api import * -from FRNConversionsAPI import * -from block_conversion_api import * - -class TestBroadbandAPI (unittest.TestCase): - def setUp(self): - self.bb = BroadbandApi() - self.frnapi = FRNConversionsAPI() - - - #Sweep across the US and compare to precomputed values. - def test_Sweep(self): - - # The following is how I computed the values beforehand: - - # print "results = " - # print "[", - # for x in range(10): - # print self.bb.request(latitude=41, longitude=-86 + x * 10)['status'] == 'OK', ",", - # print "]" - results = [ True , True , False , False , False , False , False , False , False , False , ] - - for x in range(10): - self.assertTrue((self.bb.get_data(latitude=41, longitude=-86 + x * 10)['status'] == 'OK') == results[x]) - - - # Does SF exist? - def test_SF(self): - result = self.bb.get_data(latitude=37, longitude=-122) - - self.assertTrue(result['status'] == 'OK') - self.assertTrue('SpeedTestCounty' in result) - - # Does Chicago exist? - def test_Chicago(self): - result = self.bb.get_data(latitude=41, longitude=-87) - - self.assertTrue(result['status'] == 'OK') - - - # Test the middle of nowhere (Disclaimer: I have no idea where - # this is, so it may not be in the middle of nowhere) - def test_Nowhere(self): - result = self.bb.get_data(latitude=35, longitude=35) - - self.assertTrue(result['status'] == 'Fail') - - def test_FRN(self): - result = self.frnapi.getInfo(frn='0017855545') - self.assertTrue(result['Info']['frn'] == '0017855545') - - def test_companyName(self): - result = self.frnapi.getInfo(frn='0017855545') - self.assertTrue(result['Info']['companyName']=='Cygnus Telecommunications Corporation') - - def test_FRNapiIsDict(self): - result1 = self.frnapi.getList(stateCode='IL') - result2 = self.frnapi.getInfo(frn='0017855545') - self.assertTrue(type(result1)==type({}) and type(result2)==type({})) - def test_CygnusInIL(self): - result = self.frnapi.getList(stateCode='IL') - #print result['Frns'] - #Cygnus Telecommunications Corporation - self.assertTrue('Cygnus Telecommunications Corporation' in [x['companyName'] for x in result['Frns']['Frn']]) - - - - - - - -class TestBlockConversionAPI (unittest.TestCase): - def setUp(self): - self.bb = BlockConversionAPI() - - # Does SF exist? - def test_SF(self): - result = self.bb.get_block(latitude=37, longitude=-122) - - self.assertTrue(result['status'] == 'OK') - self.assertTrue(result['State']['code'] == 'CA') - self.assertTrue(result['Block']['FIPS'] == '060871001001002C') - - - # Does (somewhere near) Chicago exist? - def test_Chicago(self): - result = self.bb.get_block(latitude=41, longitude=-87) - - self.assertTrue(result['Block']['FIPS'] == '180739908004112') - - - # Test the middle of nowhere (Disclaimer: I have no idea where - # this is, so it may not be in the middle of nowhere) - def test_Nowhere(self): - result = self.bb.get_block(latitude=35, longitude=35) - - self.assertTrue(result['status'] == 'Fail') - -if __name__ == '__main__': - unittest.main() diff --git a/dist/python_fcc-0.1-py2.6.egg b/dist/python_fcc-0.1-py2.6.egg deleted file mode 100644 index 4362df0..0000000 Binary files a/dist/python_fcc-0.1-py2.6.egg and /dev/null differ diff --git a/generic_api.py b/generic_api.py deleted file mode 100644 index d11ed36..0000000 --- a/generic_api.py +++ /dev/null @@ -1,130 +0,0 @@ -import urllib -import json - -class NoArgumentsException(Exception): - def __str__(self): - return "No arguments were found." - -class BadJSONException(Exception): - def __str__(self): - return "The returned JSON was invalid." - -class NonexistentStyleException(Exception): - def __str__(self): - return "The requested API style was invalid." - -class MustBeOrderedException(Exception): - def __str__(self): - return "The arguments you pass to the SBA API must be ordered." - - -# Perform requests to generic APIs. - -PHP_STYLE = 0 # &x=1&y=2 -SBA_WEIRD_STYLE = 1 - -class BaseAPIRequest: - def __init__(self, url): - self.url = url - - if self.url.startswith("http://api.sba.gov") or self.url.startswith("api.sba.gov"): - self.api_style = SBA_WEIRD_STYLE - else: - self.api_style = PHP_STYLE - - def __format_url_php_style(self, *ordered_args, **args): - """ - Format the url with the arguments in PHP style. That is, - ?x=5&y=6 - """ - if args is None: raise NoArgumentsException - - args["format"] = "json" #Ask for JSON formatted response - append = "" - - for arg in args: append += str(arg) + "=" + str(args[arg]) + "&" - - append = append[:-1] #Take off last '&' - self.formatted_url = self.url + "?" + append - - def __format_url_weird_style(self, *ordered_args, **args): - """ - Format the url with the arguments in the weird style given by SBA. - arg1/arg2/arg3.json - """ - - append = "" - for arg in ordered_args: append += str(arg) + "/" - append = append[:-1] #Take off last '/' - - - self.formatted_url = self.url + append + ".json" - - # Formats a URL with the provided keyword arguments. - def format_url(self, *ordered_args, **args): - if self.api_style == PHP_STYLE: - self.__format_url_php_style(*ordered_args, **args) - elif self.api_style == SBA_WEIRD_STYLE: - print ordered_args - print args - if len(args) != 0: - raise MustBeOrderedException # MUST be ordered. - - self.__format_url_weird_style(*ordered_args) - else: - raise NonexistentStyleException - - # Requests the API and returns the JSON object. - def request(self, *ordered_args, **args): - self.format_url(*ordered_args, **args) - #print self.formatted_url - t = urllib.urlopen(self.formatted_url).read().strip() - if t.startswith("callback("): - t=t[t.index("(")+1:-1] - - print self.formatted_url - - try: - return json.loads(t) - - except: - raise BadJSONException - return None - - -class GenericAPI: - - """ - __init__ - Parameters: APIS, a list of tuples of form (FUNCTIONNAME, LINK). - - Creates functions of name FUNCTIONNAME that perform an API call to LINK - when called, giving back the response as JSON. - - Returns: Nothing - """ - - def __init__(self, apis): - - self.api_objects = [] - self.api_functions = [] - self.functions = [] - - # Who writes normal functions when you can use CLOSURES?!? - - number = 0 - - # Bind each function to the class. - for api in apis: - self.api_objects.append(BaseAPIRequest(api[1])) - self.bind_closure(number) - setattr(self, api[0], self.api_functions[number]) - number += 1 - - # Creates a function on the current class. - def bind_closure(self, number): - def generic_api_call(*ordered_args, **kwargs): - self.api_objects[number].format_url(*ordered_args, **kwargs) - return self.api_objects[number].request(*ordered_args, **kwargs) - - self.api_functions.append(generic_api_call) \ No newline at end of file diff --git a/license_view_api.py b/license_view_api.py deleted file mode 100644 index afa9201..0000000 --- a/license_view_api.py +++ /dev/null @@ -1,22 +0,0 @@ -from generic_api import * - -# Simple Python wrapper around the License View API provided by the FCC. - -APIS = [ ("get_licenses", "http://data.fcc.gov/api/license-view/basicSearch/getLicenses" ) - , ("get_common_names", "http://data.fcc.gov/api/license-view/licenses/getCommonNames") - , ("get_statuses", "http://data.fcc.gov/api/license-view/licenses/getStatuses") - , ("get_categories", "http://data.fcc.gov/api/license-view/licenses/getCategories") - , ("get_entities", "http://data.fcc.gov/api/license-view/licenses/getEntities") - , ("get_renewals", "http://data.fcc.gov/api/license-view/licenses/getRenewals") - , ("get_issued", "http://data.fcc.gov/api/license-view/licenses/getIssued") - ] - - -class LicenseViewAPI(GenericAPI): - def __init__(self): - GenericAPI.__init__(self, APIS) - -# Sample use of BlockConversionAPI -if __name__ == "__main__": - bc = LicenseViewAPI() - print bc.get_licenses(searchValue = "Verizon Wireless") \ No newline at end of file diff --git a/python-fcc/FRNConversionsAPI.py b/python-fcc/FRNConversionsAPI.py deleted file mode 100644 index 87fa5b1..0000000 --- a/python-fcc/FRNConversionsAPI.py +++ /dev/null @@ -1,45 +0,0 @@ -from generic_api import * -import urllib,json - - -# Simple Python wrapper around the Broadband API provided by the FCC. - -class FRNConversionsAPI(GenericAPI): - """ - FRNConversionsAPI: - - an API to access information about broadband provides. - - original API: http://reboot.fcc.gov/developer/frn-conversions-api - - - methods: - -- getList(stateCode, multi) - takes stateCode=IL or stateCode=17 (FIPS code), - (optional) multi=Yes or multi=No to signify whether to include FRNs also operating outside this state. - - -- getInfo(frn) - takes frn='0017855545' (FRN id) - """ - - - def __init__(self): - apis= [ - ('getList', 'http://data.fcc.gov/api/frn/getList'), - ('getInfo', 'http://data.fcc.gov/api/frn/getInfo')] - - GenericAPI.__init__(self,apis) - - -if __name__ == "__main__": - bb = FRNConversionsAPI() - - x=bb.getList(stateCode='IL') - print type(x) - print len(x) - print x.keys() - - #print x - - print - x=bb.getInfo(frn='0017855545') - print type(x) - print len(x) - print x diff --git a/python-fcc/__init__.py b/python-fcc/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/python-fcc/block_conversion_api.py b/python-fcc/block_conversion_api.py deleted file mode 100644 index cf8c837..0000000 --- a/python-fcc/block_conversion_api.py +++ /dev/null @@ -1,13 +0,0 @@ -from generic_api import * - -# Simple Python wrapper around the Block Conversion API provided by the FCC. - -class BlockConversionAPI(GenericAPI): - def __init__(self): - GenericAPI.__init__(self, [("get_block", "http://data.fcc.gov/api/block/find")]) - - -# Sample use of BlockConversionAPI -if __name__ == "__main__": - bc = BlockConversionAPI() - print bc.get_block(lat=41, long=-87) # (Should be San Francisco) \ No newline at end of file diff --git a/python-fcc/build/lib.linux-x86_64-2.6/tests/__init__.py b/python-fcc/build/lib.linux-x86_64-2.6/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/python-fcc/build/lib.linux-x86_64-2.6/tests/__main__.py b/python-fcc/build/lib.linux-x86_64-2.6/tests/__main__.py deleted file mode 100644 index 19b9936..0000000 --- a/python-fcc/build/lib.linux-x86_64-2.6/tests/__main__.py +++ /dev/null @@ -1,5 +0,0 @@ -from tests.testcases import * -from tests.testutils import * - -if __name__ == '__main__': - unittest.main() diff --git a/python-fcc/build/lib.linux-x86_64-2.6/tests/testcases.py b/python-fcc/build/lib.linux-x86_64-2.6/tests/testcases.py deleted file mode 100644 index 79df288..0000000 --- a/python-fcc/build/lib.linux-x86_64-2.6/tests/testcases.py +++ /dev/null @@ -1,105 +0,0 @@ -import sys -import unittest - -sys.path.append('../') - -from broadband_api import * -from FRNConversionsAPI import * -from block_conversion_api import * - -class TestBroadbandAPI (unittest.TestCase): - def setUp(self): - self.bb = BroadbandApi() - self.frnapi = FRNConversionsAPI() - - - #Sweep across the US and compare to precomputed values. - def test_Sweep(self): - - # The following is how I computed the values beforehand: - - # print "results = " - # print "[", - # for x in range(10): - # print self.bb.request(latitude=41, longitude=-86 + x * 10)['status'] == 'OK', ",", - # print "]" - results = [ True , True , False , False , False , False , False , False , False , False , ] - - for x in range(10): - self.assertTrue((self.bb.get_data(latitude=41, longitude=-86 + x * 10)['status'] == 'OK') == results[x]) - - - # Does SF exist? - def test_SF(self): - result = self.bb.get_data(latitude=37, longitude=-122) - - self.assertTrue(result['status'] == 'OK') - self.assertTrue('SpeedTestCounty' in result) - - # Does Chicago exist? - def test_Chicago(self): - result = self.bb.get_data(latitude=41, longitude=-87) - - self.assertTrue(result['status'] == 'OK') - - - # Test the middle of nowhere (Disclaimer: I have no idea where - # this is, so it may not be in the middle of nowhere) - def test_Nowhere(self): - result = self.bb.get_data(latitude=35, longitude=35) - - self.assertTrue(result['status'] == 'Fail') - - def test_FRN(self): - result = self.frnapi.getInfo(frn='0017855545') - self.assertTrue(result['Info']['frn'] == '0017855545') - - def test_companyName(self): - result = self.frnapi.getInfo(frn='0017855545') - self.assertTrue(result['Info']['companyName']=='Cygnus Telecommunications Corporation') - - def test_FRNapiIsDict(self): - result1 = self.frnapi.getList(stateCode='IL') - result2 = self.frnapi.getInfo(frn='0017855545') - self.assertTrue(type(result1)==type({}) and type(result2)==type({})) - def test_CygnusInIL(self): - result = self.frnapi.getList(stateCode='IL') - #print result['Frns'] - #Cygnus Telecommunications Corporation - self.assertTrue('Cygnus Telecommunications Corporation' in [x['companyName'] for x in result['Frns']['Frn']]) - - - - - - - -class TestBlockConversionAPI (unittest.TestCase): - def setUp(self): - self.bb = BlockConversionAPI() - - # Does SF exist? - def test_SF(self): - result = self.bb.get_block(latitude=37, longitude=-122) - - self.assertTrue(result['status'] == 'OK') - self.assertTrue(result['State']['code'] == 'CA') - self.assertTrue(result['Block']['FIPS'] == '060871001001002C') - - - # Does (somewhere near) Chicago exist? - def test_Chicago(self): - result = self.bb.get_block(latitude=41, longitude=-87) - - self.assertTrue(result['Block']['FIPS'] == '180739908004112') - - - # Test the middle of nowhere (Disclaimer: I have no idea where - # this is, so it may not be in the middle of nowhere) - def test_Nowhere(self): - result = self.bb.get_block(latitude=35, longitude=35) - - self.assertTrue(result['status'] == 'Fail') - -if __name__ == '__main__': - unittest.main() diff --git a/python-fcc/dist/python_fcc-0.1-py2.6.egg b/python-fcc/dist/python_fcc-0.1-py2.6.egg deleted file mode 100644 index 846f128..0000000 Binary files a/python-fcc/dist/python_fcc-0.1-py2.6.egg and /dev/null differ diff --git a/python-fcc/generic_api.py b/python-fcc/generic_api.py deleted file mode 100644 index d11ed36..0000000 --- a/python-fcc/generic_api.py +++ /dev/null @@ -1,130 +0,0 @@ -import urllib -import json - -class NoArgumentsException(Exception): - def __str__(self): - return "No arguments were found." - -class BadJSONException(Exception): - def __str__(self): - return "The returned JSON was invalid." - -class NonexistentStyleException(Exception): - def __str__(self): - return "The requested API style was invalid." - -class MustBeOrderedException(Exception): - def __str__(self): - return "The arguments you pass to the SBA API must be ordered." - - -# Perform requests to generic APIs. - -PHP_STYLE = 0 # &x=1&y=2 -SBA_WEIRD_STYLE = 1 - -class BaseAPIRequest: - def __init__(self, url): - self.url = url - - if self.url.startswith("http://api.sba.gov") or self.url.startswith("api.sba.gov"): - self.api_style = SBA_WEIRD_STYLE - else: - self.api_style = PHP_STYLE - - def __format_url_php_style(self, *ordered_args, **args): - """ - Format the url with the arguments in PHP style. That is, - ?x=5&y=6 - """ - if args is None: raise NoArgumentsException - - args["format"] = "json" #Ask for JSON formatted response - append = "" - - for arg in args: append += str(arg) + "=" + str(args[arg]) + "&" - - append = append[:-1] #Take off last '&' - self.formatted_url = self.url + "?" + append - - def __format_url_weird_style(self, *ordered_args, **args): - """ - Format the url with the arguments in the weird style given by SBA. - arg1/arg2/arg3.json - """ - - append = "" - for arg in ordered_args: append += str(arg) + "/" - append = append[:-1] #Take off last '/' - - - self.formatted_url = self.url + append + ".json" - - # Formats a URL with the provided keyword arguments. - def format_url(self, *ordered_args, **args): - if self.api_style == PHP_STYLE: - self.__format_url_php_style(*ordered_args, **args) - elif self.api_style == SBA_WEIRD_STYLE: - print ordered_args - print args - if len(args) != 0: - raise MustBeOrderedException # MUST be ordered. - - self.__format_url_weird_style(*ordered_args) - else: - raise NonexistentStyleException - - # Requests the API and returns the JSON object. - def request(self, *ordered_args, **args): - self.format_url(*ordered_args, **args) - #print self.formatted_url - t = urllib.urlopen(self.formatted_url).read().strip() - if t.startswith("callback("): - t=t[t.index("(")+1:-1] - - print self.formatted_url - - try: - return json.loads(t) - - except: - raise BadJSONException - return None - - -class GenericAPI: - - """ - __init__ - Parameters: APIS, a list of tuples of form (FUNCTIONNAME, LINK). - - Creates functions of name FUNCTIONNAME that perform an API call to LINK - when called, giving back the response as JSON. - - Returns: Nothing - """ - - def __init__(self, apis): - - self.api_objects = [] - self.api_functions = [] - self.functions = [] - - # Who writes normal functions when you can use CLOSURES?!? - - number = 0 - - # Bind each function to the class. - for api in apis: - self.api_objects.append(BaseAPIRequest(api[1])) - self.bind_closure(number) - setattr(self, api[0], self.api_functions[number]) - number += 1 - - # Creates a function on the current class. - def bind_closure(self, number): - def generic_api_call(*ordered_args, **kwargs): - self.api_objects[number].format_url(*ordered_args, **kwargs) - return self.api_objects[number].request(*ordered_args, **kwargs) - - self.api_functions.append(generic_api_call) \ No newline at end of file diff --git a/python-fcc/python_fcc.egg-info/PKG-INFO b/python-fcc/python_fcc.egg-info/PKG-INFO deleted file mode 100644 index bd3636d..0000000 --- a/python-fcc/python_fcc.egg-info/PKG-INFO +++ /dev/null @@ -1,10 +0,0 @@ -Metadata-Version: 1.0 -Name: python-fcc -Version: 0.1 -Summary: An API abstraction of the FCC API found at http://reboot.fcc.gov/developer -Home-page: http://github.com/codeforamerica/FCC-Python-Egg -Author: johnfn, quadrismegistus -Author-email: grantm@stanford.edu, heuser@stanford.edu -License: UNKNOWN -Description: UNKNOWN -Platform: UNKNOWN diff --git a/python-fcc/python_fcc.egg-info/SOURCES.txt b/python-fcc/python_fcc.egg-info/SOURCES.txt deleted file mode 100644 index 0717a3d..0000000 --- a/python-fcc/python_fcc.egg-info/SOURCES.txt +++ /dev/null @@ -1,8 +0,0 @@ -setup.py -python_fcc.egg-info/PKG-INFO -python_fcc.egg-info/SOURCES.txt -python_fcc.egg-info/dependency_links.txt -python_fcc.egg-info/top_level.txt -tests/__init__.py -tests/__main__.py -tests/testcases.py \ No newline at end of file diff --git a/python-fcc/python_fcc.egg-info/dependency_links.txt b/python-fcc/python_fcc.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/python-fcc/python_fcc.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/python-fcc/python_fcc.egg-info/top_level.txt b/python-fcc/python_fcc.egg-info/top_level.txt deleted file mode 100644 index 2b29f27..0000000 --- a/python-fcc/python_fcc.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -tests diff --git a/python-fcc/sba_businesses_api.py b/python-fcc/sba_businesses_api.py deleted file mode 100644 index efcf19b..0000000 --- a/python-fcc/sba_businesses_api.py +++ /dev/null @@ -1,33 +0,0 @@ -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 = [ "by_category" - , "all_by_state" - , "by_business_type" - , "state_only" - , "state_and_county" - , "state_and_city" - , "by_zip" - ] - -APIS = build_api_list(list, "http://api.sba.gov/license_permit") - -class SBABusinessesAPI(GenericAPI): - def __init__(self): - GenericAPI.__init__(self, APIS) - - -# Sample use of BroadbandApi -if __name__ == "__main__": - bb = SBABusinessesAPI() - print bb.by_category("doing business as") # (Should be San Francisco) \ No newline at end of file diff --git a/python-fcc/sba_loans_grants_api.py b/python-fcc/sba_loans_grants_api.py deleted file mode 100644 index 998c312..0000000 --- a/python-fcc/sba_loans_grants_api.py +++ /dev/null @@ -1,35 +0,0 @@ -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) \ No newline at end of file diff --git a/python-fcc/tests/__init__.py b/python-fcc/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/python-fcc/tests/__main__.py b/python-fcc/tests/__main__.py deleted file mode 100644 index 19b9936..0000000 --- a/python-fcc/tests/__main__.py +++ /dev/null @@ -1,5 +0,0 @@ -from tests.testcases import * -from tests.testutils import * - -if __name__ == '__main__': - unittest.main() diff --git a/python-fcc/tests/testcases.py b/python-fcc/tests/testcases.py deleted file mode 100644 index 79df288..0000000 --- a/python-fcc/tests/testcases.py +++ /dev/null @@ -1,105 +0,0 @@ -import sys -import unittest - -sys.path.append('../') - -from broadband_api import * -from FRNConversionsAPI import * -from block_conversion_api import * - -class TestBroadbandAPI (unittest.TestCase): - def setUp(self): - self.bb = BroadbandApi() - self.frnapi = FRNConversionsAPI() - - - #Sweep across the US and compare to precomputed values. - def test_Sweep(self): - - # The following is how I computed the values beforehand: - - # print "results = " - # print "[", - # for x in range(10): - # print self.bb.request(latitude=41, longitude=-86 + x * 10)['status'] == 'OK', ",", - # print "]" - results = [ True , True , False , False , False , False , False , False , False , False , ] - - for x in range(10): - self.assertTrue((self.bb.get_data(latitude=41, longitude=-86 + x * 10)['status'] == 'OK') == results[x]) - - - # Does SF exist? - def test_SF(self): - result = self.bb.get_data(latitude=37, longitude=-122) - - self.assertTrue(result['status'] == 'OK') - self.assertTrue('SpeedTestCounty' in result) - - # Does Chicago exist? - def test_Chicago(self): - result = self.bb.get_data(latitude=41, longitude=-87) - - self.assertTrue(result['status'] == 'OK') - - - # Test the middle of nowhere (Disclaimer: I have no idea where - # this is, so it may not be in the middle of nowhere) - def test_Nowhere(self): - result = self.bb.get_data(latitude=35, longitude=35) - - self.assertTrue(result['status'] == 'Fail') - - def test_FRN(self): - result = self.frnapi.getInfo(frn='0017855545') - self.assertTrue(result['Info']['frn'] == '0017855545') - - def test_companyName(self): - result = self.frnapi.getInfo(frn='0017855545') - self.assertTrue(result['Info']['companyName']=='Cygnus Telecommunications Corporation') - - def test_FRNapiIsDict(self): - result1 = self.frnapi.getList(stateCode='IL') - result2 = self.frnapi.getInfo(frn='0017855545') - self.assertTrue(type(result1)==type({}) and type(result2)==type({})) - def test_CygnusInIL(self): - result = self.frnapi.getList(stateCode='IL') - #print result['Frns'] - #Cygnus Telecommunications Corporation - self.assertTrue('Cygnus Telecommunications Corporation' in [x['companyName'] for x in result['Frns']['Frn']]) - - - - - - - -class TestBlockConversionAPI (unittest.TestCase): - def setUp(self): - self.bb = BlockConversionAPI() - - # Does SF exist? - def test_SF(self): - result = self.bb.get_block(latitude=37, longitude=-122) - - self.assertTrue(result['status'] == 'OK') - self.assertTrue(result['State']['code'] == 'CA') - self.assertTrue(result['Block']['FIPS'] == '060871001001002C') - - - # Does (somewhere near) Chicago exist? - def test_Chicago(self): - result = self.bb.get_block(latitude=41, longitude=-87) - - self.assertTrue(result['Block']['FIPS'] == '180739908004112') - - - # Test the middle of nowhere (Disclaimer: I have no idea where - # this is, so it may not be in the middle of nowhere) - def test_Nowhere(self): - result = self.bb.get_block(latitude=35, longitude=35) - - self.assertTrue(result['status'] == 'Fail') - -if __name__ == '__main__': - unittest.main() diff --git a/python_fcc.egg-info/PKG-INFO b/python_fcc.egg-info/PKG-INFO deleted file mode 100644 index bd3636d..0000000 --- a/python_fcc.egg-info/PKG-INFO +++ /dev/null @@ -1,10 +0,0 @@ -Metadata-Version: 1.0 -Name: python-fcc -Version: 0.1 -Summary: An API abstraction of the FCC API found at http://reboot.fcc.gov/developer -Home-page: http://github.com/codeforamerica/FCC-Python-Egg -Author: johnfn, quadrismegistus -Author-email: grantm@stanford.edu, heuser@stanford.edu -License: UNKNOWN -Description: UNKNOWN -Platform: UNKNOWN diff --git a/python_fcc.egg-info/SOURCES.txt b/python_fcc.egg-info/SOURCES.txt deleted file mode 100644 index f08a8d9..0000000 --- a/python_fcc.egg-info/SOURCES.txt +++ /dev/null @@ -1,16 +0,0 @@ -setup.py -python-fcc/FRNConversionsAPI.py -python-fcc/__init__.py -python-fcc/block_conversion_api.py -python-fcc/broadband_api.py -python-fcc/generic_api.py -python-fcc/license_view_api.py -python-fcc/sba_businesses_api.py -python-fcc/sba_loans_grants_api.py -python-fcc/tests/__init__.py -python-fcc/tests/__main__.py -python-fcc/tests/testcases.py -python_fcc.egg-info/PKG-INFO -python_fcc.egg-info/SOURCES.txt -python_fcc.egg-info/dependency_links.txt -python_fcc.egg-info/top_level.txt \ No newline at end of file diff --git a/python_fcc.egg-info/dependency_links.txt b/python_fcc.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/python_fcc.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/python_fcc.egg-info/top_level.txt b/python_fcc.egg-info/top_level.txt deleted file mode 100644 index c79c61a..0000000 --- a/python_fcc.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -python-fcc diff --git a/FRNConversionsAPI.py b/python_fcc/FRNConversionsAPI.py similarity index 90% rename from FRNConversionsAPI.py rename to python_fcc/FRNConversionsAPI.py index 87fa5b1..eb6e21e 100644 --- a/FRNConversionsAPI.py +++ b/python_fcc/FRNConversionsAPI.py @@ -32,14 +32,14 @@ def __init__(self): bb = FRNConversionsAPI() x=bb.getList(stateCode='IL') - print type(x) - print len(x) - print x.keys() + print(type(x)) + print(len(x)) + print(x.keys()) #print x print x=bb.getInfo(frn='0017855545') - print type(x) - print len(x) - print x + print(type(x)) + print(len(x)) + print(x) diff --git a/__init__.py b/python_fcc/__init__.py similarity index 100% rename from __init__.py rename to python_fcc/__init__.py diff --git a/build/lib.linux-x86_64-2.6/python-fcc/block_conversion_api.py b/python_fcc/block_conversion_api.py similarity index 83% rename from build/lib.linux-x86_64-2.6/python-fcc/block_conversion_api.py rename to python_fcc/block_conversion_api.py index cf8c837..6b899f3 100644 --- a/build/lib.linux-x86_64-2.6/python-fcc/block_conversion_api.py +++ b/python_fcc/block_conversion_api.py @@ -10,4 +10,4 @@ def __init__(self): # Sample use of BlockConversionAPI if __name__ == "__main__": bc = BlockConversionAPI() - print bc.get_block(lat=41, long=-87) # (Should be San Francisco) \ No newline at end of file + print(bc.get_block(lat=41, long=-87)) # (Should be San Francisco) diff --git a/python-fcc/broadband_api.py b/python_fcc/broadband_api.py similarity index 81% rename from python-fcc/broadband_api.py rename to python_fcc/broadband_api.py index 4f8f562..eeb0dfb 100644 --- a/python-fcc/broadband_api.py +++ b/python_fcc/broadband_api.py @@ -12,4 +12,4 @@ def __init__(self): # Sample use of BroadbandApi if __name__ == "__main__": bb = BroadbandApi() - print bb.get_data(latitude=37, longitude=-122) # (Should be San Francisco) \ No newline at end of file + print(bb.get_data(latitude=37, longitude=-122)) # (Should be San Francisco) diff --git a/build/lib.linux-x86_64-2.6/python-fcc/generic_api.py b/python_fcc/generic_api.py similarity index 93% rename from build/lib.linux-x86_64-2.6/python-fcc/generic_api.py rename to python_fcc/generic_api.py index d11ed36..90b3990 100644 --- a/build/lib.linux-x86_64-2.6/python-fcc/generic_api.py +++ b/python_fcc/generic_api.py @@ -65,8 +65,8 @@ def format_url(self, *ordered_args, **args): if self.api_style == PHP_STYLE: self.__format_url_php_style(*ordered_args, **args) elif self.api_style == SBA_WEIRD_STYLE: - print ordered_args - print args + print(ordered_args) + print(args) if len(args) != 0: raise MustBeOrderedException # MUST be ordered. @@ -78,11 +78,11 @@ def format_url(self, *ordered_args, **args): def request(self, *ordered_args, **args): self.format_url(*ordered_args, **args) #print self.formatted_url - t = urllib.urlopen(self.formatted_url).read().strip() - if t.startswith("callback("): + t = urllib.request.urlopen(self.formatted_url).read().strip() + if t.startswith(b"callback("): t=t[t.index("(")+1:-1] - print self.formatted_url + print(self.formatted_url) try: return json.loads(t) @@ -127,4 +127,4 @@ def generic_api_call(*ordered_args, **kwargs): self.api_objects[number].format_url(*ordered_args, **kwargs) return self.api_objects[number].request(*ordered_args, **kwargs) - self.api_functions.append(generic_api_call) \ No newline at end of file + self.api_functions.append(generic_api_call) diff --git a/python-fcc/license_view_api.py b/python_fcc/license_view_api.py similarity index 91% rename from python-fcc/license_view_api.py rename to python_fcc/license_view_api.py index afa9201..3e74e92 100644 --- a/python-fcc/license_view_api.py +++ b/python_fcc/license_view_api.py @@ -1,4 +1,4 @@ -from generic_api import * +from .generic_api import * # Simple Python wrapper around the License View API provided by the FCC. @@ -19,4 +19,4 @@ def __init__(self): # Sample use of BlockConversionAPI if __name__ == "__main__": bc = LicenseViewAPI() - print bc.get_licenses(searchValue = "Verizon Wireless") \ No newline at end of file + print(bc.get_licenses(searchValue = "Verizon Wireless")) diff --git a/sba_businesses_api.py b/python_fcc/sba_businesses_api.py similarity index 90% rename from sba_businesses_api.py rename to python_fcc/sba_businesses_api.py index efcf19b..7482021 100644 --- a/sba_businesses_api.py +++ b/python_fcc/sba_businesses_api.py @@ -30,4 +30,4 @@ def __init__(self): # Sample use of BroadbandApi if __name__ == "__main__": bb = SBABusinessesAPI() - print bb.by_category("doing business as") # (Should be San Francisco) \ No newline at end of file + print(bb.by_category("doing business as")) # (Should be San Francisco) diff --git a/build/lib.linux-x86_64-2.6/python-fcc/sba_loans_grants_api.py b/python_fcc/sba_loans_grants_api.py similarity index 92% rename from build/lib.linux-x86_64-2.6/python-fcc/sba_loans_grants_api.py rename to python_fcc/sba_loans_grants_api.py index 998c312..d9e7fae 100644 --- a/build/lib.linux-x86_64-2.6/python-fcc/sba_loans_grants_api.py +++ b/python_fcc/sba_loans_grants_api.py @@ -32,4 +32,4 @@ def __init__(self): # Sample use of BroadbandApi if __name__ == "__main__": bb = SBALoansGrantsAPI() - print bb.by_category("doing business as") # (Should be San Francisco) \ No newline at end of file + print(bb.by_category("doing business as")) # (Should be San Francisco) diff --git a/sba_loans_grants_api.py b/sba_loans_grants_api.py deleted file mode 100644 index 998c312..0000000 --- a/sba_loans_grants_api.py +++ /dev/null @@ -1,35 +0,0 @@ -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) \ No newline at end of file diff --git a/setup.py b/setup.py index c72156e..cdb4397 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages setup( name = "python-fcc", - version = "0.1", + version = "0.1.1", description = "An API abstraction of the FCC API found at http://reboot.fcc.gov/developer", author='johnfn, quadrismegistus', author_email='grantm@stanford.edu, heuser@stanford.edu', diff --git a/tests/__main__.py b/tests/__main__.py index 19b9936..3bbb2df 100644 --- a/tests/__main__.py +++ b/tests/__main__.py @@ -1,5 +1,4 @@ -from tests.testcases import * -from tests.testutils import * +from .testcases import * -if __name__ == '__main__': - unittest.main() +if __name__ == "__main__": + unittest.main() diff --git a/tests/testcases.py b/tests/testcases.py index 79df288..9686ec2 100644 --- a/tests/testcases.py +++ b/tests/testcases.py @@ -1,105 +1,66 @@ import sys import unittest -sys.path.append('../') +from python_fcc.broadband_api import * +from python_fcc.FRNConversionsAPI import * +from python_fcc.block_conversion_api import * -from broadband_api import * -from FRNConversionsAPI import * -from block_conversion_api import * -class TestBroadbandAPI (unittest.TestCase): - def setUp(self): - self.bb = BroadbandApi() - self.frnapi = FRNConversionsAPI() - +class TestBroadbandAPI(unittest.TestCase): + def setUp(self): + self.bb = BroadbandApi() + self.frnapi = FRNConversionsAPI() - #Sweep across the US and compare to precomputed values. - def test_Sweep(self): + def test_FRN(self): + result = self.frnapi.getInfo(frn="0016095838") + self.assertTrue(result["Results"][0]["frn"] == "0016095838") - # The following is how I computed the values beforehand: + def test_companyName(self): + result = self.frnapi.getInfo(frn="0016095838") + self.assertTrue( + result["Results"][0]["companyName"] == "Cygnus Communications Corporation" + ) - # print "results = " - # print "[", - # for x in range(10): - # print self.bb.request(latitude=41, longitude=-86 + x * 10)['status'] == 'OK', ",", - # print "]" - results = [ True , True , False , False , False , False , False , False , False , False , ] + def test_FRNapiIsDict(self): + result1 = self.frnapi.getList(stateCode="IL") + result2 = self.frnapi.getInfo(frn="0016095838") + self.assertTrue(type(result1) == type({}) and type(result2) == type({})) - for x in range(10): - self.assertTrue((self.bb.get_data(latitude=41, longitude=-86 + x * 10)['status'] == 'OK') == results[x]) + def test_CygnusInIL(self): + result = self.frnapi.getList(stateCode="IL") + # print result['Frns'] + # Cygnus Telecommunications Corporation + self.assertTrue( + "Cygnus Communications Corporation" + in [x["companyName"] for x in result["Results"]] + ) - # Does SF exist? - def test_SF(self): - result = self.bb.get_data(latitude=37, longitude=-122) +class TestBlockConversionAPI(unittest.TestCase): + def setUp(self): + self.bb = BlockConversionAPI() - self.assertTrue(result['status'] == 'OK') - self.assertTrue('SpeedTestCounty' in result) - - # Does Chicago exist? - def test_Chicago(self): - result = self.bb.get_data(latitude=41, longitude=-87) + # Does SF exist? (Really, more Santa Cruz) + def test_SF(self): + result = self.bb.get_block(latitude=37, longitude=-122) - self.assertTrue(result['status'] == 'OK') + self.assertTrue(result["status"] == "OK") + self.assertTrue(result["State"]["code"] == "CA") + self.assertTrue(result["Block"]["FIPS"] == "060871001001003") + # Does (somewhere near) Chicago exist? (Jasper, IN) + def test_Chicago(self): + result = self.bb.get_block(latitude=41, longitude=-87) - # Test the middle of nowhere (Disclaimer: I have no idea where - # this is, so it may not be in the middle of nowhere) - def test_Nowhere(self): - result = self.bb.get_data(latitude=35, longitude=35) - - self.assertTrue(result['status'] == 'Fail') + self.assertTrue(result["Block"]["FIPS"] == "180731008003098") - def test_FRN(self): - result = self.frnapi.getInfo(frn='0017855545') - self.assertTrue(result['Info']['frn'] == '0017855545') + # Test the middle of nowhere (Disclaimer: I have no idea where + # this is, so it may not be in the middle of nowhere) + def test_Nowhere(self): + result = self.bb.get_block(latitude=35, longitude=35) - def test_companyName(self): - result = self.frnapi.getInfo(frn='0017855545') - self.assertTrue(result['Info']['companyName']=='Cygnus Telecommunications Corporation') - - def test_FRNapiIsDict(self): - result1 = self.frnapi.getList(stateCode='IL') - result2 = self.frnapi.getInfo(frn='0017855545') - self.assertTrue(type(result1)==type({}) and type(result2)==type({})) - def test_CygnusInIL(self): - result = self.frnapi.getList(stateCode='IL') - #print result['Frns'] - #Cygnus Telecommunications Corporation - self.assertTrue('Cygnus Telecommunications Corporation' in [x['companyName'] for x in result['Frns']['Frn']]) + self.assertTrue(result["Block"]["FIPS"] == None) - - - - - -class TestBlockConversionAPI (unittest.TestCase): - def setUp(self): - self.bb = BlockConversionAPI() - - # Does SF exist? - def test_SF(self): - result = self.bb.get_block(latitude=37, longitude=-122) - - self.assertTrue(result['status'] == 'OK') - self.assertTrue(result['State']['code'] == 'CA') - self.assertTrue(result['Block']['FIPS'] == '060871001001002C') - - - # Does (somewhere near) Chicago exist? - def test_Chicago(self): - result = self.bb.get_block(latitude=41, longitude=-87) - - self.assertTrue(result['Block']['FIPS'] == '180739908004112') - - - # Test the middle of nowhere (Disclaimer: I have no idea where - # this is, so it may not be in the middle of nowhere) - def test_Nowhere(self): - result = self.bb.get_block(latitude=35, longitude=35) - - self.assertTrue(result['status'] == 'Fail') - -if __name__ == '__main__': +if __name__ == "__main__": unittest.main()