Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2023-08-20 13:32:45 +0200
committerArthur de Jong <arthur@arthurdejong.org>2023-08-20 13:34:36 +0200
commit3126f96b5309ae5fb2e26489a8caea2e6a4d6ae9 (patch)
treecf8f0e90d4a8fdabf044500ed0a00dada9501a81
parent88d1dca7707cd6c237a3b5ef5ddde19fd388069a (diff)
Update Belarusian UNP online check
The API for the online check for Belarusian UNP numbers at https://www.portal.nalog.gov.by/grp/getData has changed some small details of the API.
-rw-r--r--stdnum/by/unp.py4
-rw-r--r--tests/test_by_unp.py26
2 files changed, 15 insertions, 15 deletions
diff --git a/stdnum/by/unp.py b/stdnum/by/unp.py
index 5b9c324..1ea519c 100644
--- a/stdnum/by/unp.py
+++ b/stdnum/by/unp.py
@@ -125,5 +125,5 @@ def check_nalog(number, timeout=30): # pragma: no cover (not part of normal tes
'type': 'json'},
timeout=timeout,
verify=certificate)
- if response.ok:
- return response.json()['ROW']
+ if response.ok and response.content:
+ return response.json()['row']
diff --git a/tests/test_by_unp.py b/tests/test_by_unp.py
index 229b034..6a375ce 100644
--- a/tests/test_by_unp.py
+++ b/tests/test_by_unp.py
@@ -42,22 +42,22 @@ class TestNalog(unittest.TestCase):
self.assertDictEqual(
result,
{
- 'CKODSOST': '1',
- 'DLIKV': None,
- 'DREG': '08.07.2011',
- 'NMNS': '104',
- 'VKODS': 'Действующий',
- 'VLIKV': None,
- 'VMNS': 'Инспекция МНС по Московскому району г.Минска ',
- 'VNAIMK': 'Частное предприятие "КРИОС ГРУПП"',
- 'VNAIMP': 'Частное производственное унитарное предприятие "КРИОС ГРУПП"',
- 'VPADRES': 'г. Минск,ул. Уманская, д.54, пом. 152',
- 'VUNP': '191682495',
+ 'ckodsost': '1',
+ 'dlikv': None,
+ 'dreg': '2011-07-08',
+ 'nmns': '104',
+ 'vkods': 'Действующий',
+ 'vlikv': None,
+ 'vmns': 'Инспекция МНС по Московскому району г.Минска ',
+ 'vnaimk': 'Частное предприятие "КРИОС ГРУПП"',
+ 'vnaimp': 'Частное производственное унитарное предприятие "КРИОС ГРУПП"',
+ 'vpadres': 'г. Минск,ул. Уманская, д.54, пом. 152',
+ 'vunp': '191682495',
})
# Check that result has at least these keys
- keys = ['VUNP', 'VNAIMP', 'VNAIMK', 'DREG', 'CKODSOST', 'VKODS']
+ keys = ['vunp', 'vnaimp', 'vnaimk', 'dreg', 'ckodsost', 'vkods']
self.assertEqual([key for key in keys if key in result], keys)
- self.assertEqual(result['VUNP'], '191682495')
+ self.assertEqual(result['vunp'], '191682495')
# Test invalid number
result = unp.check_nalog('771681495')
self.assertIsNone(result)