No project description provided
Project description
インストール
pip install politylink
使い方
GraphQLClient
PolityLinkのGraphQLエンドポイントにアクセスするためのGraphQLClientが用意されています。
from politylink.graphql.client import GraphQLClient
client = GraphQLClient()
exec
メソッドを使えば任意のGraphQLクエリを実行することができます。
query = """
query {
Bill(filter: {submittedDate: {year: 2020, month: 1, day: 20}}) {
name
}
}
"""
client.exec(query)
2020年1月20日に提出された3つの法律案の名前が得られるはずです。
{'data': {'Bill': [{'name': '特定複合観光施設区域の整備の推進に関する法律及び特定複合観光施設区域整備法を廃止する法律案'},
{'name': '地方交付税法及び特別会計に関する法律の一部を改正する法律案'},
{'name': '平成三十年度歳入歳出の決算上の剰余金の処理の特例に関する法律案'}]}}
GraphQLClientはsgglcのラッパークラスであり、クエリをコードで組み立てることも可能です。例えば上のクエリを組み立てると以下のようになります。
from politylink.graphql.schema import Query, _BillFilter, _Neo4jDateTimeInput
from sgqlc.operation import Operation
op = Operation(Query)
bill_filter = _BillFilter(None)
bill_filter.submitted_date = _Neo4jDateTimeInput(year=2020, month=1, day=20)
bills = op.bill(filter=bill_filter)
bills.name()
client.exec(op)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
politylink-0.1.24.tar.gz
(22.7 kB
view hashes)
Built Distribution
Close
Hashes for politylink-0.1.24-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f41d82b570eacf05ed411e043ef98389a8dcd91fd9778acda8fb40332b06fba |
|
MD5 | 674d89c378fe11a3101cea0d667f0a6f |
|
BLAKE2b-256 | 29cea9891a19a07fb884bd18a3305d20d51ee2febd7b913d8ed001e80b60f76a |