pyreinfolib 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.0"
3
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "release-type": "python",
3
+ "bump-minor-pre-major": true,
4
+ "initial-version": "0.1.0",
5
+ "include-component-in-tag": false,
6
+ "packages": {
7
+ ".": {
8
+ "release-type": "python"
9
+ }
10
+ },
11
+ "pull-request-title-pattern": "chore: release ${version}",
12
+ "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
13
+ }
@@ -0,0 +1,53 @@
1
+ name: Publish Python distribution to PyPI
2
+
3
+ on:
4
+ workflow_call:
5
+
6
+ permissions:
7
+ contents: read
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - name: Set up Python
16
+ uses: actions/setup-python@v5
17
+ with:
18
+ python-version: '3.11'
19
+
20
+ - name: Install build dependencies
21
+ run: |
22
+ python -m pip install --upgrade pip
23
+ pip install hatch
24
+
25
+ - name: Build package
26
+ run: hatch build
27
+
28
+ - name: Store the distribution packages
29
+ uses: actions/upload-artifact@v4
30
+ with:
31
+ name: python-package-distributions
32
+ path: dist/
33
+
34
+ publish-to-pypi:
35
+ name: Publish distribution 📦 to PyPI
36
+ if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
37
+ needs:
38
+ - build
39
+ runs-on: ubuntu-latest
40
+ environment:
41
+ name: pypi
42
+ url: https://pypi.org/p/pyreinfolib
43
+ permissions:
44
+ id-token: write
45
+ steps:
46
+ - name: Download all the dists
47
+ uses: actions/download-artifact@v4
48
+ with:
49
+ name: python-package-distributions
50
+ path: dist/
51
+
52
+ - name: Publish distribution 📦 to PyPI
53
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,28 @@
1
+ name: release-please
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ permissions:
9
+ contents: write
10
+ pull-requests: write
11
+
12
+ jobs:
13
+ release-please:
14
+ runs-on: ubuntu-latest
15
+ outputs:
16
+ release_created: ${{ steps.release.outputs.release_created }}
17
+ steps:
18
+ - name: release-please
19
+ id: release
20
+ uses: googleapis/release-please-action@v4
21
+ with:
22
+ token: ${{ secrets.GITHUB_TOKEN }}
23
+ config-file: .github/release-please-config.json
24
+ manifest-file: .github/.release-please-manifest.json
25
+ publish:
26
+ needs: release-please
27
+ if: ${{ needs.release-please.outputs.release_created }}
28
+ uses: "./.github/workflows/publish.yml"
@@ -0,0 +1,161 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110
+ .pdm.toml
111
+ .pdm-python
112
+ .pdm-build/
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ .venv
127
+ env/
128
+ venv/
129
+ ENV/
130
+ env.bak/
131
+ venv.bak/
132
+
133
+ # Spyder project settings
134
+ .spyderproject
135
+ .spyproject
136
+
137
+ # Rope project settings
138
+ .ropeproject
139
+
140
+ # mkdocs documentation
141
+ /site
142
+
143
+ # mypy
144
+ .mypy_cache/
145
+ .dmypy.json
146
+ dmypy.json
147
+
148
+ # Pyre type checker
149
+ .pyre/
150
+
151
+ # pytype static type analyzer
152
+ .pytype/
153
+
154
+ # Cython debug symbols
155
+ cython_debug/
156
+
157
+ # InelliJ
158
+ .idea/
159
+
160
+ # MacOS
161
+ .DS_Store
@@ -0,0 +1 @@
1
+ 3.12.2
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+
3
+ ## [0.1.0](https://github.com/matsudan/pyreinfolib/compare/v0.1.0...v0.1.0) (2024-11-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * add client class ([989f0cb](https://github.com/matsudan/pyreinfolib/commit/989f0cb6b440fba08169b315a6e6db5ab95611fb))
9
+ * add get_appraisal_reports method ([4a246c3](https://github.com/matsudan/pyreinfolib/commit/4a246c3235db378451deaa2e7a4f7cd7284ac912))
10
+ * add get_land_price_public_notices_and_surveys_point method ([a1cae6a](https://github.com/matsudan/pyreinfolib/commit/a1cae6af60b180309f5aa59b49cd11c0a24f5d98))
11
+ * add get_real_estate_price_point method ([6bac4fa](https://github.com/matsudan/pyreinfolib/commit/6bac4fa101bbe00bca285a22045f804fd97787ab))
12
+ * add get_real_estate_prices method ([27b7894](https://github.com/matsudan/pyreinfolib/commit/27b78947fbcb5074d3ae70f2495b50e08b7504b4))
13
+ * add landTypeCode enum ([837d031](https://github.com/matsudan/pyreinfolib/commit/837d03158ff7960f91c892ce525119105eeece93))
14
+ * add UseDivision enum ([df1f213](https://github.com/matsudan/pyreinfolib/commit/df1f213e717fc7fd57906b201050d68b7f2b9107))
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * fix area argument type of get_municipalities method to str ([2594a17](https://github.com/matsudan/pyreinfolib/commit/2594a17eb1a0ecea271d865dee981788abdc27dd))
20
+ * fix get method name in each api method ([d6031b3](https://github.com/matsudan/pyreinfolib/commit/d6031b37f4467f06ff501ebaa38cc1a7a667a542))
21
+ * fix to add trailing slash to the end of base url ([350af78](https://github.com/matsudan/pyreinfolib/commit/350af789c65399e477b0075c1d77e49e6f9d1a1a))
22
+ * fix to use urljoin for api_url ([f8842b8](https://github.com/matsudan/pyreinfolib/commit/f8842b8999993d47401582c02167b762a615446f))
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 matsudan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,57 @@
1
+ Metadata-Version: 2.3
2
+ Name: pyreinfolib
3
+ Version: 0.1.0
4
+ Summary: Python client for Real Estate Information Library APIs
5
+ Project-URL: Homepage, https://github.com/matsudan/pyreinfolib
6
+ Author-email: matsudan <daaamatsun@gmail.com>
7
+ Keywords: api,client,real-estate
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Requires-Python: >=3.11
14
+ Requires-Dist: requests
15
+ Description-Content-Type: text/markdown
16
+
17
+ # pyreinfolib
18
+
19
+ 国土交通省[不動産情報ライブラリ](https://www.reinfolib.mlit.go.jp/)APIサービスのPythonクライアントです。API仕様についての詳細は[API操作説明ページ](https://www.reinfolib.mlit.go.jp/help/apiManual/)をご参照ください。
20
+
21
+ ## Installation
22
+
23
+ ```
24
+
25
+ ```
26
+
27
+ ### Supported Python Versions
28
+
29
+ Python >= 3.11
30
+
31
+ ## Usage
32
+
33
+ ```python
34
+ from pyreinfolib import Client
35
+
36
+ client = Client(api_key="<your api key>")
37
+ ```
38
+
39
+ ## Example
40
+
41
+ ### 不動産価格(取引価格・成約価格)情報
42
+
43
+ ```python
44
+ client.get_real_estate_prices(year=2024, quarter=1, price_classification="01", city="13109")
45
+ ```
46
+
47
+ ### 鑑定評価書情報
48
+
49
+ ```python
50
+ from pyreinfolib.enums import UseDivision
51
+
52
+ client.get_appraisal_reports(year=2024, area="13", division=UseDivision.INDUSTRIAL_LAND)
53
+ ```
54
+
55
+ ## Author
56
+
57
+ @matsudan (daaamatsun@gmail.com)
@@ -0,0 +1,41 @@
1
+ # pyreinfolib
2
+
3
+ 国土交通省[不動産情報ライブラリ](https://www.reinfolib.mlit.go.jp/)APIサービスのPythonクライアントです。API仕様についての詳細は[API操作説明ページ](https://www.reinfolib.mlit.go.jp/help/apiManual/)をご参照ください。
4
+
5
+ ## Installation
6
+
7
+ ```
8
+
9
+ ```
10
+
11
+ ### Supported Python Versions
12
+
13
+ Python >= 3.11
14
+
15
+ ## Usage
16
+
17
+ ```python
18
+ from pyreinfolib import Client
19
+
20
+ client = Client(api_key="<your api key>")
21
+ ```
22
+
23
+ ## Example
24
+
25
+ ### 不動産価格(取引価格・成約価格)情報
26
+
27
+ ```python
28
+ client.get_real_estate_prices(year=2024, quarter=1, price_classification="01", city="13109")
29
+ ```
30
+
31
+ ### 鑑定評価書情報
32
+
33
+ ```python
34
+ from pyreinfolib.enums import UseDivision
35
+
36
+ client.get_appraisal_reports(year=2024, area="13", division=UseDivision.INDUSTRIAL_LAND)
37
+ ```
38
+
39
+ ## Author
40
+
41
+ @matsudan (daaamatsun@gmail.com)
@@ -0,0 +1,58 @@
1
+ [project]
2
+ name = "pyreinfolib"
3
+ description = "Python client for Real Estate Information Library APIs"
4
+ authors = [
5
+ { name = "matsudan", email = "daaamatsun@gmail.com" }
6
+ ]
7
+ dynamic = ["version"]
8
+ dependencies = [
9
+ "requests",
10
+ ]
11
+ readme = "README.md"
12
+ requires-python = ">= 3.11"
13
+ classifiers = [
14
+ "License :: OSI Approved :: MIT License",
15
+ "Operating System :: OS Independent",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ ]
20
+ keywords = ["real-estate", "api", "client"]
21
+
22
+ [project.urls]
23
+ Homepage = "https://github.com/matsudan/pyreinfolib"
24
+
25
+ [build-system]
26
+ requires = ["hatchling"]
27
+ build-backend = "hatchling.build"
28
+
29
+ [tool.rye]
30
+ managed = true
31
+ dev-dependencies = [
32
+ "ruff>=0.7.4",
33
+ "pytest>=8.3.3",
34
+ ]
35
+
36
+ [tool.hatch.metadata]
37
+ allow-direct-references = true
38
+
39
+ [tool.hatch.build.targets.wheel]
40
+ packages = ["pyreinfolib"]
41
+
42
+ [tool.hatch.version]
43
+ path = "pyreinfolib/__init__.py"
44
+
45
+ [tool.ruff]
46
+ line-length = 120
47
+ indent-width = 4
48
+ target-version = "py312"
49
+
50
+ [tool.ruff.lint]
51
+ select = ["F", "E", "W", "I", "Q"]
52
+ fixable = ["ALL"]
53
+
54
+ [tool.ruff.format]
55
+ quote-style = "double"
56
+ indent-style = "space"
57
+ skip-magic-trailing-comma = false
58
+ line-ending = "auto"
@@ -0,0 +1,3 @@
1
+ from .client import Client # noqa
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,150 @@
1
+ import logging
2
+ from typing import Literal
3
+ from urllib.parse import urljoin
4
+
5
+ import requests
6
+
7
+ from pyreinfolib import enums
8
+
9
+ logger = logging.getLogger(__name__)
10
+
11
+ class Client:
12
+ def __init__(self, api_key: str):
13
+ self.api_key = api_key
14
+ self.base_url = "https://www.reinfolib.mlit.go.jp/ex-api/external/"
15
+
16
+ def _get(self, endpoint: str, params: dict = None) -> dict:
17
+
18
+ api_url = urljoin(self.base_url, endpoint)
19
+ headers = {"Ocp-Apim-Subscription-Key": self.api_key}
20
+ try:
21
+ r = requests.get(api_url, headers=headers, params=params)
22
+ r.raise_for_status()
23
+ return r.json()
24
+ except requests.RequestException as e:
25
+ logger.error(f"Request failed for {api_url} with error: {e.response.text}")
26
+ raise
27
+
28
+ def get_real_estate_prices(
29
+ self,
30
+ year: int,
31
+ price_classification: Literal["01", "02"] = None,
32
+ quarter: Literal[1, 2, 3, 4] = None,
33
+ area: str = None,
34
+ city: str = None,
35
+ station: str = None,
36
+ language: Literal["ja", "en"] = None
37
+ ) -> dict:
38
+ """Get real estate prices. See https://www.reinfolib.mlit.go.jp/help/apiManual/#titleApi4 for details.
39
+ :param price_classification: Price classification code.
40
+ 01: Real estate transaction price information, 02: Contract price information,
41
+ Unspecified: Both transaction price information and contract price information.
42
+ :param year: Transaction period (Year).
43
+ :param quarter: Transaction period (Quarter). 1: Jan.~Mar. 2: Apr.~Jun. 3: Jul.~Sep. 4: Oct.~Dec.
44
+ :param area: Prefecture code. See https://nlftp.mlit.go.jp/ksj/gml/codelist/PrefCd.html
45
+ :param city: Municipality code.
46
+ :param station: Station code. See https://nlftp.mlit.go.jp/ksj/gml/datalist/KsjTmplt-N02-v3_1.html
47
+ :param language: `ja` or `en`. If not specified, `ja`.
48
+ :return: Real estate prices.
49
+ """
50
+ params = {"year": year}
51
+ if price_classification:
52
+ params["priceClassification"] = price_classification
53
+ if quarter:
54
+ params["quarter"] = quarter
55
+ if area:
56
+ params["area"] = area
57
+ if city:
58
+ params["city"] = city
59
+ if station:
60
+ params["station"] = station
61
+ if language:
62
+ params["language"] = language
63
+
64
+ return self._get("XIT001", params)
65
+
66
+ def get_municipalities(self, area: str, language: Literal["ja", "en"] = None) -> dict:
67
+ """Get municipality (city/ward/town/village) list.
68
+ See https://www.reinfolib.mlit.go.jp/help/apiManual/#titleApi5 for details.
69
+ :param area: Prefecture code. See https://nlftp.mlit.go.jp/ksj/gml/codelist/PrefCd.html
70
+ :param language: `ja` or `en`. If not specified, `ja`.
71
+ :return: Municipality list.
72
+ """
73
+ params = {"area": area}
74
+ if language:
75
+ params.update(language=language)
76
+
77
+ return self._get("XIT002", params)
78
+
79
+ def get_appraisal_reports(self, year: int, area: str, division: enums.UseDivision):
80
+ """Get real estate appraisal reports.
81
+ See https://www.reinfolib.mlit.go.jp/help/apiManual/#titleApi6 for details.
82
+ :param year: Date of value.
83
+ :param area: Prefecture code.
84
+ :param division: Use division.
85
+ :return: Real estate appraisal reports.
86
+ """
87
+ params = {"year": year, "area": area, "division": division}
88
+
89
+ return self._get("XCT001", params)
90
+
91
+ def get_real_estate_prices_point(
92
+ self,
93
+ z: int,
94
+ x: int,
95
+ y: int,
96
+ period_from: int,
97
+ period_to: int,
98
+ price_classification: Literal["01", "02"] = None,
99
+ land_type_code: list[enums.LandTypeCode] = None,
100
+ ) -> dict:
101
+ """Get real estate prices point.
102
+ See https://www.reinfolib.mlit.go.jp/help/apiManual/#titleApi7 for details.
103
+ :param z: Zoom level (scale). 11 (city) ~ 15 (detail)
104
+ :param x: x value of tile coordinates.
105
+ :param y: y value of tile coordinates.
106
+ :param period_from: Transaction period from. Format: YYYYN. e.g. 20241
107
+ :param period_to: Transaction period to. Format: YYYYN. e.g. 20242
108
+ :param price_classification: Price classification code.
109
+ 01: Real estate transaction price information, 02: Contract price information,
110
+ Unspecified: Both transaction price information and contract price information.
111
+ :param land_type_code: Land type code. See https://www.reinfolib.mlit.go.jp/help/apiManual/#titleApi7
112
+ :return: Real estate prices point. (Response format: GeoJson)
113
+ """
114
+ params = {"response_format": "geojson", "z": z, "x": x, "y": y, "from": period_from, "to": period_to}
115
+ if price_classification:
116
+ params["priceClassification"] = price_classification
117
+ if land_type_code:
118
+ params["landTypeCode"] = ",".join(land_type_code)
119
+
120
+ return self._get("XPT001", params)
121
+
122
+ def get_land_price_public_notices_and_surveys_point(
123
+ self,
124
+ z: Literal[13,14,15],
125
+ x: int,
126
+ y: int,
127
+ year: int,
128
+ price_classification: Literal["0", "1"] = None,
129
+ use_category_code: list[enums.UseDivision] = None,
130
+ ) -> dict:
131
+ """Get land price public notices (standard land prices) and
132
+ prefectural land price surveys (benchmark land prices) point.
133
+ See https://www.reinfolib.mlit.go.jp/help/apiManual/#titleApi8 for details.
134
+ :param z: Zoom level (scale). 13 ~ 15 (detail)
135
+ :param x: x value of tile coordinates.
136
+ :param y: y value of tile coordinates.
137
+ :param year: target year.
138
+ :param price_classification: Land price classification code.
139
+ 0: Land price public notices, 1: Prefectural land price surveys, Unspecified: Both 0 and 1.
140
+ :param use_category_code: Use division code. See https://www.reinfolib.mlit.go.jp/help/apiManual/#titleApi8
141
+ :return: land price public notices (standard land prices) and
142
+ prefectural land price surveys (benchmark land prices) point. (Response format: GeoJson)
143
+ """
144
+ params = {"response_format": "geojson", "z": z, "x": x, "y": y, "year": year}
145
+ if price_classification:
146
+ params["priceClassification"] = price_classification
147
+ if use_category_code:
148
+ params["useCategoryCode"] = ",".join(use_category_code)
149
+
150
+ return self._get("XPT002", params)
@@ -0,0 +1,45 @@
1
+ from enum import StrEnum, unique
2
+
3
+
4
+ @unique
5
+ class UseDivision(StrEnum):
6
+ # 住宅地
7
+ RESIDENTIAL_LAND = "00"
8
+
9
+ # 宅地見込地
10
+ BUILDING_SITE_WITH_AN_INTERIM_USE = "03"
11
+
12
+ # 商業地
13
+ COMMERCIAL_LAND = "05"
14
+
15
+ # 準工業地
16
+ QUASI_INDUSTRIAL_LAND = "07"
17
+
18
+ # 工業地
19
+ INDUSTRIAL_LAND = "09"
20
+
21
+ # 調整区域内宅地
22
+ BUILDING_SITE_WITHIN_URBANIZATION_CONTROL_AREA = "10"
23
+
24
+ # 現況林地
25
+ CURRENT_FOREST_LAND = "13"
26
+
27
+ # 林地(都道府県地価調査)
28
+ FOREST_LAND = "20"
29
+
30
+ @unique
31
+ class LandTypeCode(StrEnum):
32
+ # 宅地(土地)
33
+ LAND = "01"
34
+
35
+ # 宅地(土地と建物)
36
+ LAND_AND_BUILDING = "02"
37
+
38
+ # 中古マンション等
39
+ PRE_OWNED_CONDOMINIUMS_ETC = "07"
40
+
41
+ # 農地
42
+ AGRICULTURAL_LAND = "10"
43
+
44
+ # 林地
45
+ FOREST_LAND = "11"
@@ -0,0 +1,26 @@
1
+ from pyreinfolib import Client
2
+ from pyreinfolib.enums import UseDivision, LandTypeCode
3
+
4
+ c = Client("5d1cf2e03da64b6db532b25f366d8a49")
5
+ # res1 = c.get_municipalities(area=13)
6
+ # print(res1)
7
+
8
+ #res2 = c.get_real_estate_prices(year=2024, quarter=5, price_classification="01", city="13109")
9
+ # print(res2)
10
+
11
+ # res3 = c.get_appraisal_reports(year=2024, area="13", division=UseDivision.INDUSTRIAL_LAND)
12
+ # print(res3)
13
+
14
+ res4 = c.get_real_estate_prices_point(
15
+ z=11, x=1819, y=806, period_from=20241, period_to=20241,price_classification="01",
16
+ land_type_code=[
17
+ LandTypeCode.LAND,
18
+ LandTypeCode.FOREST_LAND,
19
+ ]
20
+ )
21
+ #print(res4)
22
+
23
+ # res5 = c.get_land_price_public_notices_and_surveys_point(
24
+ # z=13, x=7312, y=3008,year=2020,price_classification="0",use_category_code=[UseDivision.RESIDENTIAL_LAND]
25
+ # )
26
+ # print(res5)
@@ -0,0 +1,30 @@
1
+ # generated by rye
2
+ # use `rye lock` or `rye sync` to update this lockfile
3
+ #
4
+ # last locked with the following flags:
5
+ # pre: false
6
+ # features: []
7
+ # all-features: false
8
+ # with-sources: false
9
+ # generate-hashes: false
10
+ # universal: false
11
+
12
+ -e file:.
13
+ certifi==2024.8.30
14
+ # via requests
15
+ charset-normalizer==3.4.0
16
+ # via requests
17
+ idna==3.10
18
+ # via requests
19
+ iniconfig==2.0.0
20
+ # via pytest
21
+ packaging==24.2
22
+ # via pytest
23
+ pluggy==1.5.0
24
+ # via pytest
25
+ pytest==8.3.3
26
+ requests==2.32.3
27
+ # via pyreinfolib
28
+ ruff==0.7.4
29
+ urllib3==2.2.3
30
+ # via requests
@@ -0,0 +1,22 @@
1
+ # generated by rye
2
+ # use `rye lock` or `rye sync` to update this lockfile
3
+ #
4
+ # last locked with the following flags:
5
+ # pre: false
6
+ # features: []
7
+ # all-features: false
8
+ # with-sources: false
9
+ # generate-hashes: false
10
+ # universal: false
11
+
12
+ -e file:.
13
+ certifi==2024.8.30
14
+ # via requests
15
+ charset-normalizer==3.4.0
16
+ # via requests
17
+ idna==3.10
18
+ # via requests
19
+ requests==2.32.3
20
+ # via pyreinfolib
21
+ urllib3==2.2.3
22
+ # via requests
@@ -0,0 +1,38 @@
1
+ from dataclasses import dataclass
2
+ import pytest
3
+ from unittest.mock import patch
4
+
5
+ from pyreinfolib import Client
6
+
7
+ @dataclass
8
+ class GetMunicipalitiesArgs:
9
+ area: int
10
+ language: str
11
+
12
+ @dataclass
13
+ class GetMunicipalitiesTestCase:
14
+ args: GetMunicipalitiesArgs
15
+ expected: dict
16
+ error: Exception | None
17
+
18
+ @pytest.mark.parametrize(
19
+ ["test_case"],
20
+ [
21
+ pytest.param(
22
+ GetMunicipalitiesTestCase(
23
+ args=GetMunicipalitiesArgs(
24
+ area=13,
25
+ language="ja",
26
+ ),
27
+ expected={"status": "OK", "data": [{"id": "13101", "name": "千代田区"}]},
28
+ error=None,
29
+ ),
30
+ id="normal"
31
+ )
32
+ ]
33
+ )
34
+ @patch('pyreinfolib.Client')
35
+ def get_municipalities():
36
+ client = Client(api_key="dummy")
37
+
38
+