Hello community,
here is the log from the commit of package python3-SPARQLWrapper for
openSUSE:Factory checked in at 2015-11-02 12:55:43
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python3-SPARQLWrapper (Old)
and /work/SRC/openSUSE:Factory/.python3-SPARQLWrapper.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python3-SPARQLWrapper"
Changes:
--------
---
/work/SRC/openSUSE:Factory/python3-SPARQLWrapper/python3-SPARQLWrapper.changes
2015-01-25 21:14:57.000000000 +0100
+++
/work/SRC/openSUSE:Factory/.python3-SPARQLWrapper.new/python3-SPARQLWrapper.changes
2015-11-02 12:55:45.000000000 +0100
@@ -1,0 +2,12 @@
+Sun Nov 1 19:50:24 UTC 2015 - [email protected]
+
+- update to version 1.7.1:
+ * Fixed build in Python 3.x (issue #57)
+
+- changes from version 1.7.0:
+ * Added support to HTTP Digest Auth Support (issue #45)
+ * Improved print_results showing language tag (xml:lang) and
+ datatype
+ * Updated to RDFLib 4.x
+
+-------------------------------------------------------------------
Old:
----
SPARQLWrapper-1.6.4.tar.gz
New:
----
SPARQLWrapper-1.7.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python3-SPARQLWrapper.spec ++++++
--- /var/tmp/diff_new_pack.AAVfEG/_old 2015-11-02 12:55:45.000000000 +0100
+++ /var/tmp/diff_new_pack.AAVfEG/_new 2015-11-02 12:55:45.000000000 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python3-SPARQLWrapper
#
-# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: python3-SPARQLWrapper
-Version: 1.6.4
+Version: 1.7.1
Release: 0
Summary: SPARQL Endpoint interface to Python
License: W3C
++++++ SPARQLWrapper-1.6.4.tar.gz -> SPARQLWrapper-1.7.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SPARQLWrapper-1.6.4/AUTHORS.md
new/SPARQLWrapper-1.7.1/AUTHORS.md
--- old/SPARQLWrapper-1.6.4/AUTHORS.md 2014-08-26 13:44:16.000000000 +0200
+++ new/SPARQLWrapper-1.7.1/AUTHORS.md 2015-10-29 12:55:50.000000000 +0100
@@ -19,3 +19,6 @@
* Benjamin Cogrel ([@bcogrel](http://github.com/bcogrel)): standard query types
* Urs Holzer ([@uholzer](http://github.com/uholzer)): features, patches and
testing
* Alf Lervåg ([@alf](http://github.com/alf)): setup patch
+* Nolan Nichols ([@nicholsn](http://github.com/nicholsn)): http disgest auth
support
+* Kevin Turner ([@keturn](https://github.com/keturn)):
`SmartWrapper.Value.__repr__()` implementation
+* Marcelo Jorge Vieira ([@marcelometal](https://github.com/marcelometal)):
typos
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SPARQLWrapper-1.6.4/PKG-INFO
new/SPARQLWrapper-1.7.1/PKG-INFO
--- old/SPARQLWrapper-1.6.4/PKG-INFO 2014-08-26 14:55:08.000000000 +0200
+++ new/SPARQLWrapper-1.7.1/PKG-INFO 2015-10-30 09:01:34.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: SPARQLWrapper
-Version: 1.6.4
+Version: 1.7.1
Summary: SPARQL Endpoint interface to Python
Home-page: http://rdflib.github.io/sparqlwrapper
Author: Ivan Herman, Sergio Fernández, Carlos Tejo Alonso, Alexey Zakhlestin
@@ -17,3 +17,4 @@
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Requires: rdflib
+Requires: pycurl
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SPARQLWrapper-1.6.4/README.md
new/SPARQLWrapper-1.7.1/README.md
--- old/SPARQLWrapper-1.6.4/README.md 2014-08-26 11:07:11.000000000 +0200
+++ new/SPARQLWrapper-1.7.1/README.md 2015-10-29 12:55:50.000000000 +0100
@@ -4,11 +4,11 @@
The distribution contains:
-* `SPARQLWrapper`: the Python library. You should copy the directory somewhere
into your PYTHONPATH. Alternatively, you can also run the disutils scrips:
+* `SPARQLWrapper`: the Python library. You should copy the directory somewhere
into your PYTHONPATH. Alternatively, you can also run the distutils scripts:
python setup.py install
* `test`: some unit tests
-* `script`: some scripts to run the library against some SPARQL end-points.
+* `script`: some scripts to run the library against some SPARQL endpoints.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SPARQLWrapper-1.6.4/SPARQLWrapper/SmartWrapper.py
new/SPARQLWrapper-1.7.1/SPARQLWrapper/SmartWrapper.py
--- old/SPARQLWrapper-1.6.4/SPARQLWrapper/SmartWrapper.py 2014-08-26
11:07:11.000000000 +0200
+++ new/SPARQLWrapper-1.7.1/SPARQLWrapper/SmartWrapper.py 2015-10-29
12:55:50.000000000 +0100
@@ -61,6 +61,10 @@
except :
pass
+ def __repr__(self):
+ cls = self.__class__.__name__
+ return "%s(%s:%r)" % (cls, self.type, self.value)
+
######################################################################################
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SPARQLWrapper-1.6.4/SPARQLWrapper/Wrapper.py
new/SPARQLWrapper-1.7.1/SPARQLWrapper/Wrapper.py
--- old/SPARQLWrapper-1.6.4/SPARQLWrapper/Wrapper.py 2014-08-26
11:07:11.000000000 +0200
+++ new/SPARQLWrapper-1.7.1/SPARQLWrapper/Wrapper.py 2015-10-29
12:56:08.000000000 +0100
@@ -42,7 +42,7 @@
JSON = "json"
JSONLD = "json-ld"
XML = "xml"
-TURTLE = "n3"
+TURTLE = "turtle"
N3 = "n3"
RDF = "rdf"
_allowedFormats = [JSON, XML, TURTLE, N3, RDF]
@@ -52,6 +52,11 @@
GET = "GET"
_allowedRequests = [POST, GET]
+# Possible HTTP Authentication methods
+BASIC = "BASIC"
+DIGEST = "DIGEST"
+_allowedAuth = [BASIC, DIGEST]
+
# Possible SPARQL/SPARUL query type
SELECT = "SELECT"
CONSTRUCT = "CONSTRUCT"
@@ -155,6 +160,7 @@
self.agent = agent
self.user = None
self.passwd = None
+ self.http_auth = BASIC
self._defaultGraph = defaultGraph
if returnFormat in _allowedFormats:
@@ -314,6 +320,20 @@
self.user = user
self.passwd = passwd
+ def setHTTPAuth(self, auth):
+ """
+ Set the HTTP Authentication type (Basic or Digest)
+ @param auth: auth type
+ @type auth: string
+ """
+ if not isinstance(auth, str):
+ raise TypeError('setHTTPAuth takes a string')
+ elif auth.upper() in _allowedAuth:
+ self.http_auth = auth.upper()
+ else:
+ valid_types = ", ".join(_allowedAuth)
+ raise ValueError("Value should be one of {0}".format(valid_types))
+
def setQuery(self, query):
"""
Set the SPARQL query text. Note: no check is done on the validity
of the query
@@ -485,8 +505,20 @@
request.add_header("User-Agent", self.agent)
request.add_header("Accept", self._getAcceptHeader())
if self.user and self.passwd:
- credentials = "%s:%s" % (self.user, self.passwd)
- request.add_header("Authorization", "Basic %s" %
base64.encodestring(credentials.encode('utf-8')))
+ if self.http_auth == BASIC:
+ credentials = "%s:%s" % (self.user, self.passwd)
+ request.add_header("Authorization", "Basic %s" %
base64.b64encode(credentials.encode('utf-8')))
+ elif self.http_auth == DIGEST:
+ realm = "SPARQL"
+ pwd_mgr = urllib2.HTTPPasswordMgr()
+ pwd_mgr.add_password(realm, uri, self.user, self.passwd)
+ opener = urllib2.build_opener()
+ opener.add_handler(urllib2.HTTPDigestAuthHandler(pwd_mgr))
+ urllib2.install_opener(opener)
+ else:
+ valid_types = ", ".join(_allowedAuth)
+ raise NotImplementedError("Expecting one of: {0}, but
received: {1}".format(valid_types,
+
self.http_auth))
return request
@@ -725,7 +757,8 @@
for result in results["results"]["bindings"] :
index = 0
for var in results["head"]["vars"] :
- print result[var]["value"].ljust(width[index]),"|",
+ result =
self.__get_prettyprint_string_sparql_var_result(result[var])
+ print result.ljust(width[index]),"|",
index += 1
print
@@ -736,6 +769,17 @@
for result in results["results"]["bindings"] :
index = 0
for var in results["head"]["vars"] :
- width[index] = max(width[index], len(result[var]["value"]))
+ result =
self.__get_prettyprint_string_sparql_var_result(result[var])
+ width[index] = max(width[index], len(result))
index =+ 1
return width
+
+ def __get_prettyprint_string_sparql_var_result(self, result):
+ value = result["value"]
+ lang = result.get("xml:lang", None)
+ datatype = result.get("datatype",None)
+ if lang is not None:
+ value+="@"+lang
+ if datatype is not None:
+ value+=" ["+datatype+"]"
+ return value
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SPARQLWrapper-1.6.4/SPARQLWrapper/__init__.py
new/SPARQLWrapper-1.7.1/SPARQLWrapper/__init__.py
--- old/SPARQLWrapper-1.6.4/SPARQLWrapper/__init__.py 2014-08-26
14:53:58.000000000 +0200
+++ new/SPARQLWrapper-1.7.1/SPARQLWrapper/__init__.py 2015-10-30
09:00:37.000000000 +0100
@@ -163,7 +163,7 @@
@requires: U{RDFLib<http://rdflib.net>} package.
"""
-__version__ = "1.6.4"
+__version__ = "1.7.1"
"""The version of SPARQLWrapper"""
__authors__ = "Ivan Herman, Sergio Fernández, Carlos Tejo Alonso, Alexey
Zakhlestin"
@@ -178,7 +178,7 @@
__contact__ = "[email protected]"
"""Mail list to contact to other people RDFLib and SPARQLWrappers folks and
developers"""
-__date__ = "2014-08-26"
+__date__ = "2014-10-01"
"""Last update"""
__agent__ = "sparqlwrapper %s (rdflib.github.io/sparqlwrapper)" % __version__
@@ -189,6 +189,7 @@
from Wrapper import GET, POST
from Wrapper import SELECT, CONSTRUCT, ASK, DESCRIBE, INSERT, DELETE
from Wrapper import URLENCODED, POSTDIRECTLY
+from Wrapper import BASIC, DIGEST
from SmartWrapper import SPARQLWrapper2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SPARQLWrapper-1.6.4/SPARQLWrapper.egg-info/PKG-INFO
new/SPARQLWrapper-1.7.1/SPARQLWrapper.egg-info/PKG-INFO
--- old/SPARQLWrapper-1.6.4/SPARQLWrapper.egg-info/PKG-INFO 2014-08-26
14:54:57.000000000 +0200
+++ new/SPARQLWrapper-1.7.1/SPARQLWrapper.egg-info/PKG-INFO 2015-10-30
09:01:27.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: SPARQLWrapper
-Version: 1.6.4
+Version: 1.7.1
Summary: SPARQL Endpoint interface to Python
Home-page: http://rdflib.github.io/sparqlwrapper
Author: Ivan Herman, Sergio Fernández, Carlos Tejo Alonso, Alexey Zakhlestin
@@ -17,3 +17,4 @@
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 3
Requires: rdflib
+Requires: pycurl
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/SPARQLWrapper-1.6.4/SPARQLWrapper.egg-info/requires.txt
new/SPARQLWrapper-1.7.1/SPARQLWrapper.egg-info/requires.txt
--- old/SPARQLWrapper-1.6.4/SPARQLWrapper.egg-info/requires.txt 2014-08-26
14:54:57.000000000 +0200
+++ new/SPARQLWrapper-1.7.1/SPARQLWrapper.egg-info/requires.txt 2015-10-30
09:01:27.000000000 +0100
@@ -1 +1,2 @@
-rdflib >= 2.4.2
\ No newline at end of file
+rdflib >= 4.0
+pycurl >= 7.19.5.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SPARQLWrapper-1.6.4/setup.py
new/SPARQLWrapper-1.7.1/setup.py
--- old/SPARQLWrapper-1.6.4/setup.py 2014-08-26 13:43:26.000000000 +0200
+++ new/SPARQLWrapper-1.7.1/setup.py 2015-10-30 08:45:12.000000000 +0100
@@ -14,7 +14,7 @@
import six
py3 = six.PY3
except:
- py3 = sys.version_info[0] >= 3
+ py3 = sys.version_info[0] >= 3
# grouping requires
_requires = []
@@ -22,7 +22,11 @@
# rdflib
_requires.append('rdflib')
-_install_requires.append('rdflib >= 2.4.2')
+_install_requires.append('rdflib >= 4.0')
+
+# 7.19.5.1
+_requires.append('pycurl')
+_install_requires.append('pycurl >= 7.19.5.1')
# simplejson
if sys.version_info[0:2] < (2, 6):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/SPARQLWrapper-1.6.4/test/wrapper_test.py
new/SPARQLWrapper-1.7.1/test/wrapper_test.py
--- old/SPARQLWrapper-1.6.4/test/wrapper_test.py 2014-08-26
11:07:11.000000000 +0200
+++ new/SPARQLWrapper-1.7.1/test/wrapper_test.py 2015-10-29
12:55:50.000000000 +0100
@@ -7,6 +7,7 @@
logging.basicConfig()
import unittest
+import urllib2
from urlparse import urlparse
from urllib2 import Request
@@ -25,6 +26,7 @@
from SPARQLWrapper import SPARQLWrapper
from SPARQLWrapper import XML, GET, POST, JSON, JSONLD, N3, TURTLE, RDF,
SELECT, INSERT
from SPARQLWrapper import URLENCODED, POSTDIRECTLY
+from SPARQLWrapper import BASIC, DIGEST
from SPARQLWrapper.Wrapper import QueryResult, QueryBadFormed,
EndPointNotFound, EndPointInternalError
@@ -63,8 +65,28 @@
raise TypeError
# DONE
+class TestCase(unittest.TestCase):
-class SPARQLWrapper_Test(unittest.TestCase):
+ def assertIsInstance(self, obj, cls, msg=None, *args, **kwargs):
+ """Python < v2.7 compatibility. Assert 'obj' is instance of 'cls'"""
+ try:
+ f = super(TestCase, self).assertIsInstance
+ except AttributeError:
+ self.assertTrue(isinstance(obj, cls), *args, **kwargs)
+ else:
+ f(obj, cls, *args, **kwargs)
+
+ def assertIsNone(self, obj, msg=None, *args, **kwargs):
+ """Python < v2.7 compatibility. Assert 'obj' is None"""
+ try:
+ f = super(TestCase, self).assertIsNone
+ except AttributeError:
+ self.assertEqual(obj, None, *args, **kwargs)
+ else:
+ f(obj, *args, **kwargs)
+
+
+class SPARQLWrapper_Test(TestCase):
@staticmethod
def _get_request(wrapper):
@@ -208,7 +230,29 @@
self.wrapper.setCredentials('login', 'password')
request = self._get_request(self.wrapper)
self.assertTrue(request.has_header('Authorization'))
- # TODO: test for header-value using some external decoder
implementation
+
+ # expected header for login:password
+ self.assertEqual("Basic bG9naW46cGFzc3dvcmQ=",
request.get_header('Authorization'))
+
+ def testSetHTTPAuth(self):
+ self.assertRaises(TypeError, self.wrapper.setHTTPAuth, 123)
+
+ self.wrapper.setCredentials('login', 'password')
+ request = self._get_request(self.wrapper)
+ self.assertTrue(request.has_header('Authorization'))
+ self.assertIsNone(urllib2._opener)
+
+ self.wrapper.setHTTPAuth(DIGEST)
+ self.assertIsNone(urllib2._opener)
+ request = self._get_request(self.wrapper)
+ self.assertFalse(request.has_header('Authorization'))
+ self.assertEqual(self.wrapper.http_auth, DIGEST)
+ self.assertIsInstance(urllib2._opener, urllib2.OpenerDirector)
+
+ self.assertRaises(ValueError, self.wrapper.setHTTPAuth, 'OAuth')
+
+ self.wrapper.http_auth = "OAuth"
+ self.assertRaises(NotImplementedError, self._get_request, self.wrapper)
def testSetQuery(self):
self.wrapper.setQuery('PREFIX example: <http://example.org/INSERT/>
SELECT * WHERE {?s ?p ?v}')