Metadata-Version: 2.4
Name: rosreestr-api
Version: 2.0.0
Summary: Toolset to work with lk.rosreestr.ru and nspd.gov.ru
Home-page: https://github.com/GregEremeev/rosreestr-api
Author: Greg Eremeev
Author-email: gregory.eremeev@gmail.com
License: BSD-3-Clause
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENCE.txt
Requires-Dist: requests>=2.32.3
Requires-Dist: fake-useragent>=1.5.0
Provides-Extra: dev
Requires-Dist: ipdb>=0.13.2; extra == "dev"
Requires-Dist: pytest>=5.4.1; extra == "dev"
Requires-Dist: httpretty>=1.0.2; extra == "dev"
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

## rosreestr-api

#### `rosreestr-api` is an BSD licensed library written in Python. It will be helpful for you if you need to work with lk.rosreestr.ru or nspd.gov.ru (formerly rosreestr.ru/api and pkk.rosreestr.ru) to obtain info related to realty objects.

### Quick start

1 install the library:
```bash
pip install rosreestr-api
```

2 Different ways how to get basic info about realty objects:
```python
from rosreestr_api.clients.rosreestr import RosreestrAPIClient

api_client = RosreestrAPIClient()

# get objects by address: returns up to 100 objects with `cadnum`, `full_name`,
# `actual` and `type` (OKS, PARCEL or FLAT), near matches included
api_client.get_objects_by_address('Москва, ул Красного Маяка, д 22, к 2, кв 187')
```

3 Different ways how to get geo info about realty objects:
```python
from rosreestr_api.clients.rosreestr import NSPDAPIClient

api_client = NSPDAPIClient()

# get object details by its full cadastral id (e.g. `cadnum` returned by
# RosreestrAPIClient.get_objects_by_address): parcels, buildings and premises
api_client.get_object('77:05:0007007:4926')

# get building by cadastral id
api_client.get_building_by_cadastral_id('16:50:110108:2815')

# get parcel by cadastral id
api_client.get_parcel_by_cadastral_id('72:17:1502001:499')

# get parcel by coordinates
api_client.get_parcel_by_coordinates(lat=55.542, long=37.483)

# get building by coordinates
api_client.get_building_by_coordinates(lat=55.828952, long=49.097076)
```

4 Errors: both clients raise `requests.HTTPError` for responses with status >= 400.
For `NSPDAPIClient` it also means "not found": a cadastral id lookup with no match
raises with status 404, while a coordinates lookup with nothing there returns an empty `features` list:
```python
import requests

try:
    api_client.get_object('77:17:0000000:11471')
except requests.HTTPError as e:
    if e.response.status_code == 404:
        ...  # no object with this cadastral id
    else:
        raise
```
