Package: opencellid
----------------OpenCellID Utils----------------.. image:: https://travis-ci.org/ashmastaflash/opencellid-wrapper.svg?branch=master:target: https://travis-ci.org/ashmastaflash/opencellid-wrapper.. image:: https://codeclimate.com/github/ashmastaflash/opencellid-wrapper/badges/gpa.svg:target: https://codeclimate.com/github/ashmastaflash/opencellid-wrapper:alt: Code Climate.. image:: https://codeclimate.com/github/ashmastaflash/opencellid-wrapper/badges/coverage.svg:target: https://codeclimate.com/github/ashmastaflash/opencellid-wrapper/coverage:alt: Test Coverage.. image:: https://codeclimate.com/github/ashmastaflash/opencellid-wrapper/badges/issue_count.svg:target: https://codeclimate.com/github/ashmastaflash/opencellid-wrapper:alt: Issue CountThis project is not associated with the OpenCellID project.  This is a utilitypackage for downloading and parsing the OpenCellID database.OpenCelliD Project is licensed under a Creative Commons Attribution-ShareAlike4.0 International License.Usage (with API key from Unwired Labs)--------------------------------------::import opencellidocid_obj = opencellid.OpenCellIdFeed("/dir/for/feed/file/", "api_key")# Update OpenCellID feed from web:ocid_obj.update_feed()# Print all rows in OpenCellID feed:for row in ocid_obj:print rowUsage (no API key, update from Mozilla Location Services)---------------------------------------------------------::import opencellidocid_obj = opencellid.OpenCellIdFeed("/dir/for/feed/file/")# Update OpenCellID feed from web:ocid_obj.update_feed()# Print all rows in OpenCellID feed:for row in ocid_obj:print rowError Handling--------------The tool will attempt to detect if the download is a gzipped CSV file beforeboving the download to replace the original gzipped CSV.  If an IOError isencountered, a meaningful message will be displayed, and the exception willbe re-raised.  For example, if you're being rate-limited, you'll see...::>>> ocid_obj.update_feed()Updating OpenCellID feed from Unwired Labs.Feed did not update... you're being rate-limited!Traceback (most recent call last):File "<stdin>", line 1, in <module>File "opencellid/opencellid_feed.py", line 60, in update_feedconsumer.next()File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/csv.py", line 107, in nextself.fieldnamesFile "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/csv.py", line 90, in fieldnamesself._fieldnames = self.reader.next()File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 464, in readlinec = self.read(readsize)File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 268, in readself._read(readsize)File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 303, in _readself._read_gzip_header()File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 197, in _read_gzip_headerraise IOError, 'Not a gzipped file'IOError: Not a gzipped fileAnd if your API key is not accepted, you'll see...::>>> ocid_obj.update_feed()Updating OpenCellID feed from Unwired Labs.API token rejected by Unwired Labs!!Traceback (most recent call last):File "<stdin>", line 1, in <module>File "opencellid/opencellid_feed.py", line 60, in update_feedconsumer.next()File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/csv.py", line 107, in nextself.fieldnamesFile "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/csv.py", line 90, in fieldnamesself._fieldnames = self.reader.next()File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 464, in readlinec = self.read(readsize)File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 268, in readself._read(readsize)File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 303, in _readself._read_gzip_header()File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gzip.py", line 197, in _read_gzip_headerraise IOError, 'Not a gzipped file'IOError: Not a gzipped fileWhen this happens, the original feed is not updated, so you can catch andre-initialize the ``ocid_obj`` to pull from MLS until you can sort out therate limiting or API key issue.Installation------------pip install opencellidTesting-------py.testThe test fixture file cell_towers.csv.gz contains information from theOpenCellID database, which is licensed CC-BY-SA 4.0Changelog=========v1.3.3------New~~~- Add support for Python 3.6, 3.7. [Ash]Closes #11v1.3 (2018-10-16)-----------------Changes~~~~~~~- Updated CodeClimate settings. [Ash Wilson]Closes #3- Updated download URL for OpenCellID feed. [Ash Wilson]Updated tests to avoid Travis-CI silence timeout.Closes #2v1.2 (2017-06-13)-----------------Changes~~~~~~~- Improved error handling for bad API token and rate limitingsituations. [Ash Wilson]v1.0 (2017-06-13)-----------------Changes~~~~~~~- Support update from UnwiredLabs or Mozilla Location Services.  APIchanged, now use update_feed() method and source will be chosendepending on the presence of an API key. [Ash Wilson]v0.1.1 (2017-01-23)-------------------New~~~- Unit and integration tests. [Ash Wilson]- Creates an OpenCellIdFeed object which can be updated from web anditerated over. [Ash Wilson]