From 32a742d055a331cd132618e3657b58d0d2eb3691 Mon Sep 17 00:00:00 2001 From: Andra Waagmeester Date: Sun, 3 Oct 2021 01:34:58 +0200 Subject: [PATCH] Urleconding on commons URL --- setup.py | 2 +- wikidataintegrator/wdi_rdf.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index d10da5f..eba50fa 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = "0.9.12" +VERSION = "0.9.13" setup( name='wikidataintegrator', diff --git a/wikidataintegrator/wdi_rdf.py b/wikidataintegrator/wdi_rdf.py index 5bb4a4d..062d041 100644 --- a/wikidataintegrator/wdi_rdf.py +++ b/wikidataintegrator/wdi_rdf.py @@ -4,6 +4,7 @@ import uuid import requests import json +import urllib.parse """ Authors: @@ -97,7 +98,7 @@ def triplify(self): def parseSnak(self, statement): value = statement["datavalue"]["value"] if statement["datatype"] == "commonsMedia": - return URIRef("http://commons.wikimedia.org/wiki/Special:FilePath/" + value.replace(" ", "_")) + return URIRef("http://commons.wikimedia.org/wiki/Special:FilePath/" + urllib.parse.quote_plus(value.replace(" ", "_"))) elif statement["datatype"] == "string": return Literal(value) elif statement["datatype"] == "external-id":