diff --git a/.travis.yml b/.travis.yml index f4beaa1..568e8d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ python: - '2.7' - '3.2' - '3.3' +- '3.4' before_install: - sudo apt-get update -qq diff --git a/osmapi/OsmApi.py b/osmapi/OsmApi.py index 74affbb..d72223d 100644 --- a/osmapi/OsmApi.py +++ b/osmapi/OsmApi.py @@ -39,12 +39,12 @@ import urllib from datetime import datetime +from osmapi import __version__ + # Python 3.x if getattr(urllib, 'urlencode', None) is None: urllib.urlencode = urllib.parse.urlencode -from osmapi import __version__ - class UsernamePasswordMissingError(Exception): """ @@ -95,7 +95,7 @@ def __init__( passwordfile=None, appid="", created_by="osmapi/"+__version__, - api="www.openstreetmap.org", + api="https://www.openstreetmap.org", changesetauto=False, changesetautotags={}, changesetautosize=500, @@ -1773,7 +1773,12 @@ def _http(self, cmd, path, auth, send): # noqa self._conn = self._get_http_connection() def _get_http_connection(self): - return httplib.HTTPConnection(self._api, 80) + if self._api.lower().startswith('https://'): + return httplib.HTTPSConnection(self._api[8:], 443) + elif self._api.lower().startswith('http://'): + return httplib.HTTPConnection(self._api[7:], 80) + else: + return httplib.HTTPConnection(self._api, 80) def _sleep(self): time.sleep(5) diff --git a/setup.py b/setup.py index dd70272..19dbba4 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import codecs +from distutils.core import setup version = __import__('osmapi').__version__ @@ -13,7 +14,6 @@ except (IOError, ImportError): description = 'Python wrapper for the OSM API' -from distutils.core import setup setup( name='osmapi', packages=['osmapi'],