Skip to content
Commits on Source (5)
......@@ -2,18 +2,22 @@ language: python
python:
- '2.7'
- '3.3'
- '3.4'
- '3.5'
- '3.6'
matrix:
include:
- python: '3.7'
dist: xenial # required for Python 3.7 (travis-ci/travis-ci#9069)
sudo: required # required for Python 3.7 (travis-ci/travis-ci#9069)
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq pandoc
install:
- pip install -r requirements.txt
- pip install -r test-requirements.txt
- pip install -r requirements.txt -r test-requirements.txt
- pip install .
script: ./build.sh
......@@ -22,11 +26,12 @@ after_success: coveralls
deploy:
- provider: pypi
twine_version: 1.12.1
user: odi
password:
secure: MU3ZQ4rcpsXo0xIYSWXBfaKTAPn1IrL7AEcH231sseFV1RVmdC96Sfmtc2llvD9Eoc0KJpdW0Vy50azNqAMJwXCt/q3gagfao1PTnAEbklU+g1s2PTqW401E95Qm6w192WzWk/q0dy3SJwxEQt023QR78K+nEcYaCdLWDHjR2hY=
on:
tags: true
all_branches: true
python: 2.7
python: 3.7
repo: metaodi/osmapi
......@@ -4,6 +4,21 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
## [Unreleased][unreleased]
## 1.2.1 - 2018-11-05
### Fixed
- Deployment to PyPI with Travis
## 1.2.0 - 2018-11-05
### Added
- Support Python 3.7 (thanks a lot [cclauss](https://github.com/cclauss))
### Removed
- Python 3.3 is no longer supported (EOL)
### Changed
- Updated dependencies for Python 3.7
- Adapt README to use Python 3 syntax (thanks [cclauss](https://github.com/cclauss))
## 1.1.0 - 2017-10-11
### Added
- Raise new `XmlResponseInvalidError` if XML response from the OpenStreetMap API is invalid
......
......@@ -4,7 +4,6 @@ osmapi
[![Build](https://img.shields.io/travis/metaodi/osmapi/develop.svg)](https://travis-ci.org/metaodi/osmapi)
[![Coverage](https://img.shields.io/coveralls/metaodi/osmapi/develop.svg)](https://coveralls.io/r/metaodi/osmapi?branch=develop)
[![Version](https://img.shields.io/pypi/v/osmapi.svg)](https://pypi.python.org/pypi/osmapi/)
[![Downloads](https://img.shields.io/pypi/dm/osmapi.svg)](https://pypi.python.org/pypi/osmapi/)
[![License](https://img.shields.io/pypi/l/osmapi.svg)](https://github.com/metaodi/osmapi/blob/master/LICENSE.txt)
Python wrapper for the OSM API
......@@ -35,7 +34,7 @@ To test this library, please create an account on the [development server of Ope
```python
import osmapi
api = osmapi.OsmApi()
print api.NodeGet(123)
print(api.NodeGet(123))
# {u'changeset': 532907, u'uid': 14298,
# u'timestamp': u'2007-09-29T09:19:17Z',
# u'lon': 10.790009299999999, u'visible': True,
......@@ -60,7 +59,7 @@ Note: Each line in the password file should have the format _user:password_
import osmapi
api = osmapi.OsmApi(api="https://api06.dev.openstreetmap.org", username = u"metaodi", password = u"*******")
api.ChangesetCreate({u"comment": u"My first test"})
print api.NodeCreate({u"lon":1, u"lat":1, u"tag": {}})
print(api.NodeCreate({u"lon":1, u"lat":1, u"tag": {}}))
# {u'changeset': 532907, u'lon': 1, u'version': 1, u'lat': 1, u'tag': {}, u'id': 164684}
api.ChangesetClose()
```
......@@ -88,7 +87,7 @@ To run the tests use the following command:
nosetests --verbose
By using tox you can even run the tests against different versions of python (2.7, 3.3, 3.4, 3.5 and 3.6):
By using tox you can even run the tests against different versions of python (2.7, 3.4, 3.5, 3.6 and 3.7):
tox
......
python-osmapi (1.1.0-3) UNRELEASED; urgency=medium
python-osmapi (1.2.1-1) unstable; urgency=medium
* New upstream release.
* Bump Standards-Version to 4.2.1, no changes.
* Drop autopkgtests to test installability & module import.
* Add lintian override for testsuite-autopkgtest-missing.
* Update watch file to limit matches to archive path.
-- Bas Couwenberg <sebastic@debian.org> Sun, 05 Aug 2018 20:52:26 +0200
-- Bas Couwenberg <sebastic@debian.org> Mon, 05 Nov 2018 18:01:39 +0100
python-osmapi (1.1.0-2) unstable; urgency=medium
......
......@@ -213,10 +213,10 @@ class OsmApi:
if password:
self._password = password
elif passwordfile:
for l in open(passwordfile).readlines():
l = l.strip().split(":")
if l[0] == self._username:
self._password = l[1]
for line in open(passwordfile).readlines():
line = line.strip().split(":")
if line[0] == self._username:
self._password = line[1]
# Changest informations
# auto create and close changesets
......@@ -308,7 +308,7 @@ class OsmApi:
for k, v in elem.attributes.items():
try:
result[elem.nodeName][k] = float(v)
except:
except Exception:
result[elem.nodeName][k] = v
return result
......@@ -2223,10 +2223,10 @@ class OsmApi:
result = DateString
try:
result = datetime.strptime(DateString, "%Y-%m-%d %H:%M:%S UTC")
except:
except Exception:
try:
result = datetime.strptime(DateString, "%Y-%m-%dT%H:%M:%SZ")
except:
except Exception:
pass
return result
......@@ -2296,5 +2296,5 @@ class OsmApi:
try:
elem = DomElement.getElementsByTagName(tag)[0]
return elem.firstChild.nodeValue
except:
except Exception:
return None
from __future__ import (absolute_import, print_function, unicode_literals)
__version__ = '1.1.0'
__version__ = '1.2.1'
from .OsmApi import * # noqa
# This file lists the dependencies of this extension.
# Install with a command like: pip install -r pip-requirements.txt
pypandoc==0.7.0
Unidecode==0.04.14
pdoc==0.3.1
Pygments==1.6
requests==2.8.0
pdoc==0.3.2
Pygments==2.2.0
pypandoc==1.4
requests==2.20.0
Unidecode==1.0.22
......@@ -48,5 +48,6 @@ setup(
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
)
# This file lists the dependencies of this extension.
# Install with a command like: pip install -r pip-requirements.txt
flake8==3.0.4; python_version >= '2.7'
flake8==2.1.0; python_version == '2.6'
nose==1.3.0
tox==2.8.1
coverage==3.7.1
coveralls==0.4.1
mock==1.0.1
xmltodict==0.9.0
virtualenv==15.1.0
coverage==4.5.1
coveralls==1.5.1
flake8==3.6.0
mock==2.0.0
nose==1.3.7
tox==3.5.3
virtualenv==16.1.0
xmltodict==0.11.0
......@@ -6,7 +6,7 @@ import xmltodict
import datetime
try:
import urlparse
except:
except Exception:
import urllib
urlparse = urllib.parse
......@@ -23,7 +23,7 @@ def recursive_sort(col): # noqa
col = sorted(col)
except TypeError: # in Python 3.x: lists of dicts are not sortable
col = sorted(col, key=lambda k: hash(frozenset(k.items())))
except:
except Exception:
pass
for idx, elem in enumerate(col):
......@@ -92,10 +92,10 @@ class TestOsmApiChangeset(osmapi_tests.TestOsmApi):
xmltosorteddict(kwargs['data']),
xmltosorteddict(
b'<?xml version="1.0" encoding="UTF-8"?>\n'
b'<osm version="0.6" generator="osmapi/1.1.0">\n'
b'<osm version="0.6" generator="osmapi/1.2.1">\n'
b' <changeset visible="true">\n'
b' <tag k="test" v="foobar"/>\n'
b' <tag k="created_by" v="osmapi/1.1.0"/>\n'
b' <tag k="created_by" v="osmapi/1.2.1"/>\n'
b' </changeset>\n'
b'</osm>\n'
)
......@@ -125,7 +125,7 @@ class TestOsmApiChangeset(osmapi_tests.TestOsmApi):
xmltosorteddict(kwargs['data']),
xmltosorteddict(
b'<?xml version="1.0" encoding="UTF-8"?>\n'
b'<osm version="0.6" generator="osmapi/1.1.0">\n'
b'<osm version="0.6" generator="osmapi/1.2.1">\n'
b' <changeset visible="true">\n'
b' <tag k="test" v="foobar"/>\n'
b' <tag k="created_by" v="MyTestOSMApp"/>\n'
......@@ -163,10 +163,10 @@ class TestOsmApiChangeset(osmapi_tests.TestOsmApi):
xmltosorteddict(kwargs['data']),
xmltosorteddict(
b'<?xml version="1.0" encoding="UTF-8"?>\n'
b'<osm version="0.6" generator="osmapi/1.1.0">\n'
b'<osm version="0.6" generator="osmapi/1.2.1">\n'
b' <changeset visible="true">\n'
b' <tag k="foobar" v="A new test changeset"/>\n'
b' <tag k="created_by" v="osmapi/1.1.0"/>\n'
b' <tag k="created_by" v="osmapi/1.2.1"/>\n'
b' </changeset>\n'
b'</osm>\n'
)
......@@ -190,7 +190,7 @@ class TestOsmApiChangeset(osmapi_tests.TestOsmApi):
xmltosorteddict(kwargs['data']),
xmltosorteddict(
b'<?xml version="1.0" encoding="UTF-8"?>\n'
b'<osm version="0.6" generator="osmapi/1.1.0">\n'
b'<osm version="0.6" generator="osmapi/1.2.1">\n'
b' <changeset visible="true">\n'
b' <tag k="foobar" v="A new test changeset"/>\n'
b' <tag k="created_by" v="CoolTestApp"/>\n'
......@@ -276,7 +276,7 @@ class TestOsmApiChangeset(osmapi_tests.TestOsmApi):
xmltosorteddict(kwargs['data']),
xmltosorteddict(
b'<?xml version="1.0" encoding="UTF-8"?>\n'
b'<osmChange version="0.6" generator="osmapi/1.1.0">\n'
b'<osmChange version="0.6" generator="osmapi/1.2.1">\n'
b'<create>\n'
b' <node lat="47.123" lon="8.555" visible="true" '
b'changeset="4444">\n'
......@@ -350,7 +350,7 @@ class TestOsmApiChangeset(osmapi_tests.TestOsmApi):
xmltosorteddict(kwargs['data']),
xmltosorteddict(
b'<?xml version="1.0" encoding="UTF-8"?>\n'
b'<osmChange version="0.6" generator="osmapi/1.1.0">\n'
b'<osmChange version="0.6" generator="osmapi/1.2.1">\n'
b'<modify>\n'
b' <way id="4294967296" version="2" visible="true" '
b'changeset="4444">\n'
......@@ -434,7 +434,7 @@ class TestOsmApiChangeset(osmapi_tests.TestOsmApi):
xmltosorteddict(kwargs['data']),
xmltosorteddict(
b'<?xml version="1.0" encoding="UTF-8"?>\n'
b'<osmChange version="0.6" generator="osmapi/1.1.0">\n'
b'<osmChange version="0.6" generator="osmapi/1.2.1">\n'
b'<delete>\n'
b' <relation id="676" version="2" visible="true" '
b'changeset="4444">\n'
......
......@@ -64,7 +64,7 @@ class TestOsmApi(unittest.TestCase):
try:
with open(path) as file:
return_values.append(file.read())
except:
except Exception:
pass
return return_values
......
[tox]
envlist = py27,py33,py34,py35,py36
envlist = py27,py34,py35,py36,py37
[testenv]
commands=nosetests --verbose
deps =
......