urchintai-client Package
This is a simple client for UR Chintai API (UR都市機構) written in Python.
Please see my blog post at the link below for more information regarding the API.
https://duongnt.com/urchintai-api
Install
You can install urchintai-client using pip, just run the following command in the command line.
pip install urchintai-client
Usage
Note: all calls to remote API are executed asynchronously.
Create client object
from urchintai_client.request_sender import RequestSender
# Create your aiohttp session object, we will call it sess
sender = RequestSender(sess) # this object is used to send request to and receive response from API
client = UrClient(sender)
You can choose to create and use your own aiohttp session, or you can use this helper class to create and manager session.
from urchintai_client.session_manager import SessionManager
sess = SessionManager.GetSession()
In this case you can call the following method to close the session and release resource.
await SessionManager.CloseSession()
Check if a property has vacant room(s)
Call is_property_vacant method and pass the URL of the property you want to check.
url = 'https://www.ur-net.go.jp/chintai/kanto/kanagawa/40_2460.html'
is_vacant = await client.is_property_vacant(url)
If you know the property code, you can use it to check for vacancy.
property_code = {
'store_code': '40',
'house_code': '246',
'type': '0'
}
is_vacant = await client.is_property_vacant(property_code)
Find the name of a property
Call get_property_name method and pass the URL of the property.
url = 'https://www.ur-net.go.jp/chintai/kanto/kanagawa/40_2460.html'
name = await client.get_property_name(url)
Check if a room is vacant
Call is_room_vacant method and pass the URL of the room you want to check.
url = 'https://www.ur-net.go.jp/chintai/kanto/kanagawa/40_2460_room.html?JKSS=000020654'
is_vacant = await client.is_room_vacant(url)
If you know the room code, you can use it to check for vacancy.
room_code = {
'store_code': '40',
'house_code': '246',
'type': '0',
'room_id': '000020654'
}
is_vacant = await client.is_room_vacant(room_code)
Run test from terminal
Below is how we run get_property_name from python terminal. It should work as is as long as all dependencies are installed.
import asyncio
from urchintai_client.session_manager import SessionManager
from urchintai_client.request_sender import RequestSender
from urchintai_client.ur_client import UrClient
sender = RequestSender(SessionManager.GetSession())
client = UrClient(sender)
url = 'https://www.ur-net.go.jp/chintai/kanto/kanagawa/40_2460.html'
loop = asyncio.get_event_loop()
name = loop.run_until_complete(client.get_property_name(url))
print(f'Property name: {name}')
loop.run_until_complete(SessionManager.CloseSession()) # Don't forgot to close the session
This should print the following message to console.
Property name: 西久保町公園ハイツ
Metadata
Release files for urchintai-client 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| urchintai-client-1.0.0.tar.gz | 5.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| urchintai_client-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.2 kB
Release files / urchintai-client-1.0.0.tar.gz
| Download URL | urchintai-client-1.0.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1199f9cbbfc5e979cd1cd0a4eb87fb8f617533d69ab4c2d530ef0b6748badf8e
|
|
BLAKE2b-256 checksum How to use checksums |
61de11f3604ae9264f6750525763442d531735882a20ec8cd26587cd605359c8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.2
|
Release files / urchintai_client-1.0.0-py3-none-any.whl
| Download URL | urchintai_client-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7655177836b6006f65be0f3491e4b8714d920060f0e3e52718c1c795b84a4878
|
|
BLAKE2b-256 checksum How to use checksums |
e116ffc26fc3393220d1c6ee2120f83377c3e586912b218189ca68a26bc87abe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.2
|
Security for urchintai-client 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.