diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e2cae22 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/build/ +/dist/ diff --git a/MANIFEST b/MANIFEST index b960ac4..f281bdd 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,21 +1,22 @@ -# file GENERATED by distutils, do NOT edit -setup.py -arcrest\__init__.py -arcrest\ago.py -arcrest\compat.py -arcrest\geometry.py -arcrest\gptypes.py -arcrest\projections.py -arcrest\server.py -arcrest\utils.py -arcrest\admin\__init__.py -arcrest\admin\admin_objects.py -arcrest\admin\cmdline.py -cmdline\convertcachestorageformat.py -cmdline\createcacheschema.py -cmdline\createservice.py -cmdline\deletecache.py -cmdline\managecachetiles.py -cmdline\manageservice.py -cmdline\managesite.py -cmdline\reportcachestatus.py +# file GENERATED by distutils, do NOT edit +setup.py +arcrest/__init__.py +arcrest/ago.py +arcrest/compat.py +arcrest/geometry.py +arcrest/gptypes.py +arcrest/portal.py +arcrest/projections.py +arcrest/server.py +arcrest/utils.py +arcrest/admin/__init__.py +arcrest/admin/admin_objects.py +arcrest/admin/cmdline.py +cmdline/convertcachestorageformat.py +cmdline/createcacheschema.py +cmdline/createservice.py +cmdline/deletecache.py +cmdline/managecachetiles.py +cmdline/manageservice.py +cmdline/managesite.py +cmdline/reportcachestatus.py diff --git a/arcrest/admin/admin_objects.py b/arcrest/admin/admin_objects.py index 7a90edf..37361d7 100644 --- a/arcrest/admin/admin_objects.py +++ b/arcrest/admin/admin_objects.py @@ -13,6 +13,12 @@ 'Directory', 'Directories', 'Clusters', 'Cluster'] +try: + long, unicode, basestring +except NameError: + long, unicode, basestring = int, str, str + + class Admin(server.RestURL): """Represents the top level URL resource of the ArcGIS Server Administration API""" diff --git a/arcrest/admin/cmdline.py b/arcrest/admin/cmdline.py index c72a123..c807d06 100644 --- a/arcrest/admin/cmdline.py +++ b/arcrest/admin/cmdline.py @@ -230,7 +230,7 @@ def manageservice(action): service = services[args.name] operation = (args.operation or '').lower() if operation == 'status': - for key, item in sorted(service.status.iteritems()): + for key, item in sorted(service.status.items()): print("{0}: {1}".format(key, item)) elif operation == 'start': with action("starting service"): diff --git a/arcrest/compat.py b/arcrest/compat.py index 030ff8c..2a855fd 100644 --- a/arcrest/compat.py +++ b/arcrest/compat.py @@ -7,6 +7,11 @@ 'urljoin', 'urlunsplit', 'urlencode', 'quote', 'string_type', 'ensure_string', 'ensure_bytes', 'get_headers'] +try: + long, unicode, basestring +except NameError: + long, unicode, basestring = int, str, str + try: import cookielib except ImportError: @@ -43,9 +48,15 @@ string_type = str def ensure_string(payload_bytes): - if isinstance(payload_bytes, bytes): - return payload_bytes.decode("utf-8") - return payload_bytes + import re + _payload = payload_bytes + try: + _payload = payload_bytes.decode("utf-8") + except: + pass + if re.match(r'b\'(.*)\'', _payload): + _payload = re.match(r'b\'(.*)\'', _payload).groups()[0] + return _payload def ensure_bytes(payload_string): if isinstance(payload_string, unicode): diff --git a/arcrest/geometry.py b/arcrest/geometry.py index 1bc88fc..73d31ea 100644 --- a/arcrest/geometry.py +++ b/arcrest/geometry.py @@ -7,6 +7,11 @@ from .projections import projected, geographic +try: + long, unicode, basestring +except NameError: + long, unicode, basestring = int, str, str + def pointlist(points, sr): """Convert a list of the form [[x, y] ...] to a list of Point instances with the given x, y coordinates.""" @@ -587,14 +592,14 @@ def fromJson(struct, attributes=None): return Envelope(*map(float, struct.split(','))) # Look for telltale attributes in the dict if isinstance(struct, dict): - for key, cls in indicative_attributes.iteritems(): + for key, cls in indicative_attributes.items(): if key in struct: ret = cls.fromJson(dict((str(key), value) - for (key, value) in struct.iteritems())) + for (key, value) in struct.items())) if attributes: ret.attributes = dict((str(key.lower()), val) for (key, val) - in attributes.iteritems()) + in attributes.items()) return ret raise ValueError("Unconvertible to geometry") @@ -638,7 +643,7 @@ def fromGeoJson(struct, attributes=None): if attributes: if not hasattr(instance, 'attributes'): instance.attributes = {} - for k, v in attributes.iteritems(): + for k, v in attributes.items(): instance.attributes[k] = v i.append(instance) if i: diff --git a/setup.py b/setup.py index b767a50..1670fff 100644 --- a/setup.py +++ b/setup.py @@ -5,8 +5,8 @@ import os setup( - name='arcrest', - version='10.3', + name='gn-arcrest', + version='10.5', summary="ArcGIS for Server REST API wrapper", description="""Wrapper to the ArcGIS REST API, and a Python analogue to the Javascript APIs""", author="Esri",