Skip to main content

No project description provided

Project description

Japan Search Gallery Tools

Install

pip install jps_gallery_tools

How to use

See the documentation for full details of the Japan Search Gallery API Client.

from jps_gallery_tools.api import JPSGalleryClient
gallery = JPSGalleryClient()
gallery.setMetadata('title', 'ja', '日本語タイトル')
gallery.setMetadata('summary', 'ja', '日本語の概要')
gallery.setMetadata("responsibility", "ja", "中村覚")
gallery.addTag("はじめてのタグ")
gallery.addTag("二つ目のタグ")

トップ画像

original_url = "https://blogger.googleusercontent.com/img/a/AVvXsEiTjjaWkCHeCslxeKujaQotjuR_HvhOHen7Ql7rQV8nmQl4ivLRF_CSabMY-JLJHNL-xHMe3VDyA9F-iv1RtQ2jFTk1Vnjck-veKLUZPdYqCcjzHkc8SGKb1fyZ_x8W66aTrSXQ78UN3CnyBakwwmmH_hmPKeEsTzq8J3e2zzUMylmDjCZ0LClPByBRRw=s400"
thumbnail_url = "https://blogger.googleusercontent.com/img/a/AVvXsEiTjjaWkCHeCslxeKujaQotjuR_HvhOHen7Ql7rQV8nmQl4ivLRF_CSabMY-JLJHNL-xHMe3VDyA9F-iv1RtQ2jFTk1Vnjck-veKLUZPdYqCcjzHkc8SGKb1fyZ_x8W66aTrSXQ78UN3CnyBakwwmmH_hmPKeEsTzq8J3e2zzUMylmDjCZ0LClPByBRRw=s180-c"
title = "初日の出のキャラクター"
source = "いらすとや"
top_image = UrlImage(original_url, title, source, thumbnail_url)
gallery.setImage(top_image)
# part = ListPart("tile")
part = ListPart("tile")
part.setMetadata("title", "ja", "リストのタイトル")
part.setMetadata("title", "en", "List Title")
gallery.addPart(part)
# item = ListExternalLinkPart()
# item.setUrl("https://www.irasutoya.com/2021/11/blog-post_91.html")
# part.addPart(item)
# part.addPart(top_image)
item = ListExternalLinkPart()
part.addPart(item)
item.setMetadata("title", "ja", "外部リンクのタイトル")

item.setImage(top_image)
from pprint import pprint
pprint(gallery.export())
{'curationType': 'GALLERY',
 'edit': {'action': 'CREATE',
          'date': 1675830770680,
          'orgId': 'jpsws',
          'userId': 'system'},
 'id': 'aaa',
 'image': {'contentsRightsType': 'various',
           'cover': None,
           'imgType': 'URL',
           'source': {'ja': 'いらすとや'},
           'sourceUrl': None,
           'thumbnailUrl': 'https://blogger.googleusercontent.com/img/a/AVvXsEiTjjaWkCHeCslxeKujaQotjuR_HvhOHen7Ql7rQV8nmQl4ivLRF_CSabMY-JLJHNL-xHMe3VDyA9F-iv1RtQ2jFTk1Vnjck-veKLUZPdYqCcjzHkc8SGKb1fyZ_x8W66aTrSXQ78UN3CnyBakwwmmH_hmPKeEsTzq8J3e2zzUMylmDjCZ0LClPByBRRw=s180-c',
           'title': {'ja': '初日の出のキャラクター'},
           'url': 'https://blogger.googleusercontent.com/img/a/AVvXsEiTjjaWkCHeCslxeKujaQotjuR_HvhOHen7Ql7rQV8nmQl4ivLRF_CSabMY-JLJHNL-xHMe3VDyA9F-iv1RtQ2jFTk1Vnjck-veKLUZPdYqCcjzHkc8SGKb1fyZ_x8W66aTrSXQ78UN3CnyBakwwmmH_hmPKeEsTzq8J3e2zzUMylmDjCZ0LClPByBRRw=s400'},
 'parts': [{'cpid': 'a',
            'parts': [{'cpid': 'a',
                       'image': {'contentsRightsType': 'various',
                                 'cover': None,
                                 'imgType': 'URL',
                                 'source': {'ja': 'いらすとや'},
                                 'sourceUrl': None,
                                 'thumbnailUrl': 'https://blogger.googleusercontent.com/img/a/AVvXsEiTjjaWkCHeCslxeKujaQotjuR_HvhOHen7Ql7rQV8nmQl4ivLRF_CSabMY-JLJHNL-xHMe3VDyA9F-iv1RtQ2jFTk1Vnjck-veKLUZPdYqCcjzHkc8SGKb1fyZ_x8W66aTrSXQ78UN3CnyBakwwmmH_hmPKeEsTzq8J3e2zzUMylmDjCZ0LClPByBRRw=s180-c',
                                 'title': {'ja': '初日の出のキャラクター'},
                                 'url': 'https://blogger.googleusercontent.com/img/a/AVvXsEiTjjaWkCHeCslxeKujaQotjuR_HvhOHen7Ql7rQV8nmQl4ivLRF_CSabMY-JLJHNL-xHMe3VDyA9F-iv1RtQ2jFTk1Vnjck-veKLUZPdYqCcjzHkc8SGKb1fyZ_x8W66aTrSXQ78UN3CnyBakwwmmH_hmPKeEsTzq8J3e2zzUMylmDjCZ0LClPByBRRw=s400'},
                       'title': {'ja': '外部リンクのタイトル'},
                       'type': 'jps-curation-list-external-link'}],
            'title': {'en': 'List Title', 'ja': 'リストのタイトル'},
            'type': 'jps-curation-list',
            'viewType': 'tile'}],
 'permission': {'level': 'ADMIN', 'publicationLevel': 'WORKSPACE'},
 'primaryTerm': 1,
 'responsibility': {'ja': '中村覚'},
 'rights': {},
 'rightsType': 'ccby',
 'seqNo': 0,
 'summary': {'ja': '日本語の概要'},
 'title': {'ja': '日本語タイトル'},
 'version': 1,
 'workspace': 'abc',
 'workspaceTags': ['はじめてのタグ', '二つ目のタグ']}
gallery.save("tmp/gallery.json")
b = gallery.encode()
print(b)
eyJ2ZXJzaW9uIjogMSwgInNlcU5vIjogMCwgInByaW1hcnlUZXJtIjogMSwgInRpdGxlIjogeyJqYSI6ICJcdTY1ZTVcdTY3MmNcdThhOWVcdTMwYmZcdTMwYTRcdTMwYzhcdTMwZWIifSwgInN1bW1hcnkiOiB7ImphIjogIlx1NjVlNVx1NjcyY1x1OGE5ZVx1MzA2ZVx1Njk4Mlx1ODk4MSJ9LCAicmVzcG9uc2liaWxpdHkiOiB7ImphIjogIlx1NGUyZFx1Njc1MVx1ODk5YSJ9LCAid29ya3NwYWNlIjogImFiYyIsICJ3b3Jrc3BhY2VUYWdzIjogWyJcdTMwNmZcdTMwNThcdTMwODFcdTMwNjZcdTMwNmVcdTMwYmZcdTMwYjAiLCAiXHU0ZThjXHUzMDY0XHU3NmVlXHUzMDZlXHUzMGJmXHUzMGIwIl0sICJwZXJtaXNzaW9uIjogeyJwdWJsaWNhdGlvbkxldmVsIjogIldPUktTUEFDRSIsICJsZXZlbCI6ICJBRE1JTiJ9LCAiZWRpdCI6IHsidXNlcklkIjogInN5c3RlbSIsICJvcmdJZCI6IC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R0tiMWZ5Wl94OFc2NmFUclNYUTc4VU4zQ255QmFrd3dtbUhfaG1QS2VFc1R6cThKM2UyenpVTXlsbURqQ1owTENsUEJ5QlJSdz1zNDAwIiwgInRodW1ibmFpbFVybCI6ICJodHRwczovL2Jsb2dnZXIuZ29vZ2xldXNlcmNvbnRlbnQuY29tL2ltZy9hL0FWdlhzRWlUamphV2tDSGVDc2x4ZUt1amFRb3RqdVJfSHZoT0hlbjdRbDdyUVY4bm1RbDRpdkxSRl9DU2FiTVktSkxKSE5MLXhITWUzVkR5QTlGLWl2MVJ0UTJqRlRrMVZuamNrLXZlS0xVWlBkWXFDY2p6SGtjOFNHS2IxZnlaX3g4VzY2YVRyU1hRNzhVTjNDbnlCYWt3d21tSF9obVBLZUVzVHpxOEozZTJ6elVNeWxtRGpDWjBMQ2xQQnlCUlJ3PXMxODAtYyJ9fQ==

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jps_gallery_tools-0.0.2.tar.gz (13.2 kB view hashes)

Uploaded Source

Built Distribution

jps_gallery_tools-0.0.2-py3-none-any.whl (12.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page