# ISDN-Python
[![PyPI version](https://badge.fury.io/py/isdn.svg)](https://badge.fury.io/py/isdn)
[![Test](https://github.com/Babibubebon/isdn-python/actions/workflows/test.yml/badge.svg)](https://github.com/Babibubebon/isdn-python/actions/workflows/test.yml)
[ISDN (International Standard Dojin Numbering)](https://isdn.jp/) のPythonライブラリとCLIツール
## Install
```
$ pip install isdn
```
## Example
ISDNを[番号の仕様](https://isdn.jp/about.html)に従って検証
```python
>>> from isdn import ISDN
>>> isdn = ISDN("2784702901978")
>>> isdn.validate()
True
>>> ISDN.calc_check_digit("2784702901978")
'8'
```
isdn.jp が提供している書誌情報を取得 ([Web からの情報取得](https://isdn.jp/about.html))
```python
>>> from isdn import ISDNClient
>>> client = ISDNClient()
>>> record = client.get("2784702901978")
>>> record.isdn
ISDN(code='2784702901978', prefix='278', group='4', registrant='702901', publication='97', check_digit='8')
>>> record.product_name
'みほん同人誌'
>>> record
ISDNRecord(
isdn=ISDN(
code='2784702901978',
prefix='278',
group='4',
registrant='702901',
publication='97',
check_digit='8'
),
region='日本',
class_='オリジナル',
type='同人誌',
rating_gender='区別なし',
rating_age='一般',
product_name='みほん同人誌',
product_yomi='みほんどうじんし',
publisher_code='14142139',
publisher_name='見本サークル',
publisher_yomi='みほんさーくる',
issue_date=datetime.date(2008, 3, 12),
genre_code='106',
genre_name='評論・情報',
genre_user=None,
c_code='C3055',
author='専門',
shape='単行本',
contents='電子通信',
price=Decimal('100'),
price_unit='JPY',
barcode2='2923055001007',
product_comment=None,
product_style=None,
product_size=None,
product_capacity=None,
product_capacity_unit=None,
sample_image_uri=HttpUrl('https://isdn.jp/images/thumbs/2784702901978.png', ),
useroptions=[
UserOption(property='執筆者', value='みほん執筆者1'),
UserOption(property='執筆者', value='みほん執筆者2'),
UserOption(property='執筆者', value='みほん執筆者3'),
UserOption(property='執筆者', value='みほん執筆者4'),
UserOption(property='執筆者', value='みほん執筆者5'),
UserOption(property='執筆者', value='みほん執筆者6')
],
external_links=[
ExternalLink(title='国際標準同人誌番号', uri=HttpUrl('http://isdn.jp/', )),
ExternalLink(
title='mixiコミュニティ',
uri=HttpUrl('http://mixi.jp/view_community.pl?id=3188828', )
)
]
)
```
## CLI
指定したISDNの形式を検証
```
$ isdn validate 2784702901978
```
指定したISDNの書誌情報を isdn.jp から取得
```
$ isdn get 2784702901978
$ isdn get 2784702901978 --format json
```
ISDNの一覧を isdn.jp から取得
```
$ isdn list
```
すべての書誌情報を isdn.jp から取得してファイルに保存
```
$ isdn bulk-download /path/to/download
$ isdn bulk-download /path/to/download --write-image
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Babibubebon/isdn-python",
"name": "isdn",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10,<4.0",
"maintainer_email": "",
"keywords": "book,doujinshi,identifier",
"author": "Babibubebon",
"author_email": "babibubebon@babibubebo.org",
"download_url": "https://files.pythonhosted.org/packages/ac/ae/ba681690baed2977d769420862c4136f35eb7c6be59a816cae454139cdef/isdn-1.1.0.tar.gz",
"platform": null,
"description": "# ISDN-Python\n\n[![PyPI version](https://badge.fury.io/py/isdn.svg)](https://badge.fury.io/py/isdn)\n[![Test](https://github.com/Babibubebon/isdn-python/actions/workflows/test.yml/badge.svg)](https://github.com/Babibubebon/isdn-python/actions/workflows/test.yml)\n\n[ISDN (International Standard Dojin Numbering)](https://isdn.jp/) \u306ePython\u30e9\u30a4\u30d6\u30e9\u30ea\u3068CLI\u30c4\u30fc\u30eb\n\n## Install\n\n```\n$ pip install isdn\n```\n\n## Example\n\nISDN\u3092[\u756a\u53f7\u306e\u4ed5\u69d8](https://isdn.jp/about.html)\u306b\u5f93\u3063\u3066\u691c\u8a3c\n\n```python\n>>> from isdn import ISDN\n>>> isdn = ISDN(\"2784702901978\")\n>>> isdn.validate()\nTrue\n>>> ISDN.calc_check_digit(\"2784702901978\")\n'8'\n```\n\nisdn.jp \u304c\u63d0\u4f9b\u3057\u3066\u3044\u308b\u66f8\u8a8c\u60c5\u5831\u3092\u53d6\u5f97 ([Web \u304b\u3089\u306e\u60c5\u5831\u53d6\u5f97](https://isdn.jp/about.html))\n\n```python\n>>> from isdn import ISDNClient\n>>> client = ISDNClient()\n>>> record = client.get(\"2784702901978\")\n>>> record.isdn\nISDN(code='2784702901978', prefix='278', group='4', registrant='702901', publication='97', check_digit='8')\n>>> record.product_name\n'\u307f\u307b\u3093\u540c\u4eba\u8a8c'\n>>> record\nISDNRecord(\n isdn=ISDN(\n code='2784702901978',\n prefix='278',\n group='4',\n registrant='702901',\n publication='97',\n check_digit='8'\n ),\n region='\u65e5\u672c',\n class_='\u30aa\u30ea\u30b8\u30ca\u30eb',\n type='\u540c\u4eba\u8a8c',\n rating_gender='\u533a\u5225\u306a\u3057',\n rating_age='\u4e00\u822c',\n product_name='\u307f\u307b\u3093\u540c\u4eba\u8a8c',\n product_yomi='\u307f\u307b\u3093\u3069\u3046\u3058\u3093\u3057',\n publisher_code='14142139',\n publisher_name='\u898b\u672c\u30b5\u30fc\u30af\u30eb',\n publisher_yomi='\u307f\u307b\u3093\u3055\u30fc\u304f\u308b',\n issue_date=datetime.date(2008, 3, 12),\n genre_code='106',\n genre_name='\u8a55\u8ad6\u30fb\u60c5\u5831',\n genre_user=None,\n c_code='C3055',\n author='\u5c02\u9580',\n shape='\u5358\u884c\u672c',\n contents='\u96fb\u5b50\u901a\u4fe1',\n price=Decimal('100'),\n price_unit='JPY',\n barcode2='2923055001007',\n product_comment=None,\n product_style=None,\n product_size=None,\n product_capacity=None,\n product_capacity_unit=None,\n sample_image_uri=HttpUrl('https://isdn.jp/images/thumbs/2784702901978.png', ),\n useroptions=[\n UserOption(property='\u57f7\u7b46\u8005', value='\u307f\u307b\u3093\u57f7\u7b46\u80051'),\n UserOption(property='\u57f7\u7b46\u8005', value='\u307f\u307b\u3093\u57f7\u7b46\u80052'),\n UserOption(property='\u57f7\u7b46\u8005', value='\u307f\u307b\u3093\u57f7\u7b46\u80053'),\n UserOption(property='\u57f7\u7b46\u8005', value='\u307f\u307b\u3093\u57f7\u7b46\u80054'),\n UserOption(property='\u57f7\u7b46\u8005', value='\u307f\u307b\u3093\u57f7\u7b46\u80055'),\n UserOption(property='\u57f7\u7b46\u8005', value='\u307f\u307b\u3093\u57f7\u7b46\u80056')\n ],\n external_links=[\n ExternalLink(title='\u56fd\u969b\u6a19\u6e96\u540c\u4eba\u8a8c\u756a\u53f7', uri=HttpUrl('http://isdn.jp/', )),\n ExternalLink(\n title='mixi\u30b3\u30df\u30e5\u30cb\u30c6\u30a3',\n uri=HttpUrl('http://mixi.jp/view_community.pl?id=3188828', )\n )\n ]\n)\n```\n\n## CLI\n\n\u6307\u5b9a\u3057\u305fISDN\u306e\u5f62\u5f0f\u3092\u691c\u8a3c\n\n```\n$ isdn validate 2784702901978\n```\n\n\u6307\u5b9a\u3057\u305fISDN\u306e\u66f8\u8a8c\u60c5\u5831\u3092 isdn.jp \u304b\u3089\u53d6\u5f97\n\n```\n$ isdn get 2784702901978\n$ isdn get 2784702901978 --format json\n```\n\nISDN\u306e\u4e00\u89a7\u3092 isdn.jp \u304b\u3089\u53d6\u5f97\n\n```\n$ isdn list\n```\n\n\u3059\u3079\u3066\u306e\u66f8\u8a8c\u60c5\u5831\u3092 isdn.jp \u304b\u3089\u53d6\u5f97\u3057\u3066\u30d5\u30a1\u30a4\u30eb\u306b\u4fdd\u5b58\n\n```\n$ isdn bulk-download /path/to/download\n$ isdn bulk-download /path/to/download --write-image\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Library for ISDN (International Standard Dojin Numbering)",
"version": "1.1.0",
"split_keywords": [
"book",
"doujinshi",
"identifier"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "017cefb5c4eb2fd564dd477ce3e54acd0dbfa03f0bc832f9340508bc2f7e1508",
"md5": "f74525d11649890ad70c203adbc6fe76",
"sha256": "79c67911330c5529e58802d117c6a0a18a53dad33bf9139b8f4b1dfcabf9dd11"
},
"downloads": -1,
"filename": "isdn-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f74525d11649890ad70c203adbc6fe76",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10,<4.0",
"size": 7997,
"upload_time": "2023-04-07T19:20:25",
"upload_time_iso_8601": "2023-04-07T19:20:25.735948Z",
"url": "https://files.pythonhosted.org/packages/01/7c/efb5c4eb2fd564dd477ce3e54acd0dbfa03f0bc832f9340508bc2f7e1508/isdn-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "acaeba681690baed2977d769420862c4136f35eb7c6be59a816cae454139cdef",
"md5": "3f26d29f91833b56e5c2b2846f73bf6f",
"sha256": "8cb17c02982e0e355aa7bec7b61a93c3ecc895a2eff845046c3cbaa4f2f73754"
},
"downloads": -1,
"filename": "isdn-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "3f26d29f91833b56e5c2b2846f73bf6f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10,<4.0",
"size": 6522,
"upload_time": "2023-04-07T19:20:27",
"upload_time_iso_8601": "2023-04-07T19:20:27.369374Z",
"url": "https://files.pythonhosted.org/packages/ac/ae/ba681690baed2977d769420862c4136f35eb7c6be59a816cae454139cdef/isdn-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-07 19:20:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "Babibubebon",
"github_project": "isdn-python",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "isdn"
}