访问波兰regon数据库的api
litex.regon的Python项目详细描述
litex.regon-波兰regon数据库的前端
regon数据库的简单pythonic包装器(可以在 https://wyszukiwarkaregon.stat.gov.pl/appBIR/index.aspx)。访问它的soap api,需要regon管理员发布的用户密钥,可在 Regon_Bir@stat.gov.pl。
使用示例如下:
>>> from litex.regon import REGONAPI
regonapi接受一个参数:service url(由regon管理员提供)。
>>> api = REGONAPI(SERVICE_URL)
首先,需要登录(使用提供的用户密钥)
>>> api.login(USER_KEY)
登录后,可以开始查询数据库。搜索方法 接受以下参数:
- regon - single REGON number (either 9 or 14 digits long)
- krs - single 10 digit KRS number
- nip - single NIP (10 digits string)
- regons - a collection of REGONs (all of them have to be either 14 or 9 digits long)
- krss - a collection of KRSs
- nips - a collection of NIPs
查询中只使用一个参数。如果多个通过,首先 从上面的列表中得到考虑。
另外,还可以传递“detailed”参数:detailed=true使搜索方法 获取默认的详细报告。
>>> entities = api.search(nip='9999999999')
实体是包装搜索结果的lxml objectify对象列表(最多100个)。 如果使用detailed=true调用搜索,则完整报告可用作“detailed”属性。
如果知道业务实体的regon和详细的报表名称,就可以获取完整的报表。 直接:
>>> detailed_report = api.full_report('99999999', 'PublDaneRaportFizycznaOsoba')
报告名称可以在regon admins提供的文档中找到。
更改
1.0.3
- Python 3.6 compatibility (thanks to Mariusz Witek)
1.0.2
- CAPTCHA removal – no longer needed in current API
1.0.1
- detailed report fetching logic reworked
1.0.0
- initial release