@@ -0,0 +1,1003 @@
+import json%0Aimport csv%0Aimport requests%0A%0AURL = %22https://ewib.nbp.pl/plewibnra?dokNazwa=plewibnra.txt%22%0A%0A%0Adef process():%0A    registry = %5B%5D%0A    with requests.get(URL, stream=True) as txtfile:%0A        for row in txtfile.iter_lines():%0A            if len(row.decode(%22latin1%22).split(%22%5Ct%22)) != 33:%0A                continue%0A            else:%0A                registry.append(%0A                    %7B%0A                        %22country_code%22: %22PL%22,%0A                        %22primary%22: True,%0A                        %22bic%22: row.decode(%22latin1%22).split(%22%5Ct%22)%5B19%5D.strip().upper(),%0A                        %22bank_code%22: row.decode(%22latin1%22).split(%22%5Ct%22)%5B4%5D.strip(),%0A                        %22name%22: row.decode(%22latin1%22).split(%22%5Ct%22)%5B1%5D.strip(),%0A                        %22short_name%22: row.decode(%22latin1%22).split(%22%5Ct%22)%5B1%5D.strip(),%0A                    %7D%0A                )%0A    return registry%0A%0A%0Aif __name__ == %22__main__%22:%0A    with open(%22schwifty/bank_registry/generated_pl.json%22, %22w%22) as fp:%0A        json.dump(process(), fp, indent=2)%0A

Create script to generate PL bank registry