Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Python 2.7 support #119

Merged
merged 5 commits into from
Nov 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project follows [Semantic Versioning](http://semver.org/).

## [Unreleased][unreleased]
### Changed
- **BC-Break**: osmapi does **not** support Python 2.7, 3.3, 3.4 and 3.5 anymore

## 1.3.0 - 2020-10-05
### Added
Expand Down
17 changes: 6 additions & 11 deletions osmapi/OsmApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,16 @@

"""

from __future__ import (absolute_import, print_function, unicode_literals)
import xml.dom.minidom
import xml.parsers.expat
import time
import sys
import urllib
import urllib.parse
import requests
from datetime import datetime

from osmapi import __version__

# Python 3.x
if getattr(urllib, 'urlencode', None) is None:
urllib.urlencode = urllib.parse.urlencode


class OsmApiError(Exception):
"""
Expand Down Expand Up @@ -1426,7 +1421,7 @@ def ChangesetsGet( # noqa
params["closed"] = 1

if params:
uri += "?" + urllib.urlencode(params)
uri += "?" + urllib.parse.urlencode(params)

data = self._get(uri)
changesets = self._OsmResponseToDom(data, tag="changeset")
Expand Down Expand Up @@ -1464,7 +1459,7 @@ def ChangesetComment(self, ChangesetId, comment):
If no authentication information are provided,
`OsmApi.UsernamePasswordMissingError` is raised.
"""
params = urllib.urlencode({'text': comment})
params = urllib.parse.urlencode({'text': comment})
data = self._post(
"/api/0.6/changeset/%s/comment" % (ChangesetId),
params
Expand Down Expand Up @@ -1628,7 +1623,7 @@ def NoteCreate(self, NoteData):
Returns updated NoteData (without timestamp).
"""
uri = "/api/0.6/notes"
uri += "?" + urllib.urlencode(NoteData)
uri += "?" + urllib.parse.urlencode(NoteData)
return self._NoteAction(uri)

def NoteComment(self, NoteId, comment):
Expand Down Expand Up @@ -1683,7 +1678,7 @@ def NotesSearch(self, query, limit=100, closed=7):
params['q'] = query
params['limit'] = limit
params['closed'] = closed
uri += "?" + urllib.urlencode(params)
uri += "?" + urllib.parse.urlencode(params)
data = self._get(uri)

return self.ParseNotes(data)
Expand All @@ -1698,7 +1693,7 @@ def _NoteAction(self, path, comment=None, optionalAuth=True):
if comment is not None:
params = {}
params['text'] = comment
uri += "?" + urllib.urlencode(params)
uri += "?" + urllib.parse.urlencode(params)
result = self._post(uri, None, optionalAuth=optionalAuth)

# parse the result
Expand Down
7 changes: 2 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,10 @@
'Topic :: Scientific/Engineering :: GIS',
'Topic :: Software Development :: Libraries',
'Development Status :: 4 - Beta',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
],
)
9 changes: 9 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

[ ! -d pyenv ] && python -m venv pyenv
source pyenv/bin/activate

pip install --upgrade pip
pip install -r requirements.txt
pip install -r test-requirements.txt
pip install -e .
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py27,py34,py35,py36,py37
envlist = py36,py37,py38,py39
[testenv]
commands=nosetests --verbose
deps =
Expand Down