Simple and useful parser that helps you get actual All-Russian Classifier of Municipal Territories (OKTMO).
pip install oktmoparser
The parser is based on the following structure:
parser = OktmoParser()
start_keyword = ''
end_keyword = ''
parser.parse_oktmo(start_keyword, end_keyword)
Parser returns .json file with actual OKTMO from Federal State Statistics Service.
Using the library is as simple and convenient as possible:
- Import:
from OktmoParser import OktmoParser
- Create object:
parser = OktmoParser()
- Set
start_keyword
value andend_keyword
value.
Notice: for the first usage set it empty to get full .json file to see the structure and then you can set your values.
Examples:
start_keyword = 'ΠΡΠ½ΠΈΡΠΈΠΏΠ°Π»ΡΠ½ΡΠ΅ ΠΎΠ±ΡΠ°Π·ΠΎΠ²Π°Π½ΠΈΡ ΠΡΠΈΠΌΠΎΡΡΠΊΠΎΠ³ΠΎ ΠΊΡΠ°Ρ'
end_keyword = 'ΠΡΠ½ΠΈΡΠΈΠΏΠ°Π»ΡΠ½ΡΠ΅ ΠΎΠ±ΡΠ°Π·ΠΎΠ²Π°Π½ΠΈΡ Π‘ΡΠ°Π²ΡΠΎΠΏΠΎΠ»ΡΡΠΊΠΎΠ³ΠΎ ΠΊΡΠ°Ρ'
You will get all rows between this municipal territories.
- Parse and get .json file:
parser.parse_oktmo(start_keyword, end_keyword)
- That's it.