Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9, pypy-3.8, pypy-3.9, pypy-3.10, '3.10', '3.11' , '3.12.0-beta.4']
python-version: [3.8, 3.9, pypy-3.8, pypy-3.9, pypy-3.10, '3.10', '3.11' , '3.12.0-rc.1']
os: [
ubuntu-latest,
windows-latest,
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The library can be used in these ways:
from json2xml.utils import readfromurl, readfromstring, readfromjson

# get the xml from an URL that return json
data = readfromurl("https://coderwall.com/vinitcool76.json")
data = readfromurl("https://api.publicapis.org/entries")
print(json2xml.Json2xml(data).to_xml())

# get the xml from a json string like this:
Expand Down
2 changes: 1 addition & 1 deletion json2xml/dicttoxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def dict2xml_str(
val_attr: dict[str, str] = item.pop("@attrs", attr) # update attr with custom @attr if exists
rawitem = item["@val"] if "@val" in item else item
if is_primitive_type(rawitem):
if type(rawitem) == str:
if isinstance(rawitem , str):
subtree = escape_xml(rawitem)
else:
subtree = rawitem
Expand Down
4 changes: 2 additions & 2 deletions tests/test_json2xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ def test_read_from_invalid_json2(self):
assert pytest_wrapped_e.type == JSONReadError

def test_read_from_url(self):
data = readfromurl("https://coderwall.com/vinitcool76.json")
data = readfromurl("https://api.publicapis.org/entries")
assert type(data) is dict

def test_read_from_wrong_url(self):
with pytest.raises(URLReadError) as pytest_wrapped_e:
readfromurl("https://coderwall.com/vinitcool76.jsoni")
readfromurl("https://api.publicapis.org/entriesi")
assert pytest_wrapped_e.type == URLReadError

def test_read_from_jsonstring(self):
Expand Down
Loading