summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-10 06:01:50 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-10 06:01:50 +0000
commitbc360444737a1fe5e0eeff42e46868cc644e7fe1 (patch)
tree4b781ae60c2296350adc5e8d4f26a94dd45c9378
parentf514888ea2f462f52dfa122334e3103238e08b60 (diff)
automatic import of python-py-graphql-clientopeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-py-graphql-client.spec334
-rw-r--r--sources1
3 files changed, 336 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..46370a8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/py-graphql-client-0.1.1.tar.gz
diff --git a/python-py-graphql-client.spec b/python-py-graphql-client.spec
new file mode 100644
index 0000000..e70efc9
--- /dev/null
+++ b/python-py-graphql-client.spec
@@ -0,0 +1,334 @@
+%global _empty_manifest_terminate_build 0
+Name: python-py-graphql-client
+Version: 0.1.1
+Release: 1
+Summary: A dead-simple GraphQL client that supports subscriptions over websockets
+License: BSD3
+URL: https://github.com/ecthiender/py-graphql-client
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/ed/7b/82dd4408dca40b545641d5024171a436e265bc1a8d17a81fe1f7725e65e9/py-graphql-client-0.1.1.tar.gz
+BuildArch: noarch
+
+Requires: python3-websocket-client
+
+%description
+# py-graphql-client
+Dead-simple to use GraphQL client over websocket. Using the
+[apollo-transport-ws](https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md)
+protocol.
+
+## Install
+
+```bash
+pip install py-graphql-client
+```
+
+## Examples
+
+### Setup subscriptions super easily
+
+```python
+from graphql_client import GraphQLClient
+
+ws = GraphQLClient('ws://localhost:8080/graphql')
+def callback(_id, data):
+ print("got new data..")
+ print(f"msg id: {_id}. data: {data}")
+
+query = """
+ subscription {
+ notifications {
+ id
+ title
+ content
+ }
+ }
+"""
+sub_id = ws.subscribe(query, callback=callback)
+...
+# later stop the subscription
+ws.stop_subscribe(sub_id)
+ws.close()
+```
+
+### Variables can be passed
+
+```python
+from graphql_client import GraphQLClient
+
+ws = GraphQLClient('ws://localhost:8080/graphql')
+def callback(_id, data):
+ print("got new data..")
+ print(f"msg id: {_id}. data: {data}")
+
+query = """
+ subscription ($limit: Int!) {
+ notifications (order_by: {created: "desc"}, limit: $limit) {
+ id
+ title
+ content
+ }
+ }
+"""
+sub_id = ws.subscribe(query, variables={'limit': 10}, callback=callback)
+```
+
+### Normal queries and mutations work too
+
+```python
+from graphql_client import GraphQLClient
+
+ws = GraphQLClient('ws://localhost:8080/graphql')
+query = """
+ query ($limit: Int!) {
+ notifications (order_by: {created: "desc"}, limit: $limit) {
+ id
+ title
+ content
+ }
+ }
+"""
+res = ws.query(query, variables={'limit': 10})
+print(res)
+ws.close()
+```
+
+
+## TODO
+- support http as well
+- should use asyncio websocket library?
+
+
+
+
+%package -n python3-py-graphql-client
+Summary: A dead-simple GraphQL client that supports subscriptions over websockets
+Provides: python-py-graphql-client
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-py-graphql-client
+# py-graphql-client
+Dead-simple to use GraphQL client over websocket. Using the
+[apollo-transport-ws](https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md)
+protocol.
+
+## Install
+
+```bash
+pip install py-graphql-client
+```
+
+## Examples
+
+### Setup subscriptions super easily
+
+```python
+from graphql_client import GraphQLClient
+
+ws = GraphQLClient('ws://localhost:8080/graphql')
+def callback(_id, data):
+ print("got new data..")
+ print(f"msg id: {_id}. data: {data}")
+
+query = """
+ subscription {
+ notifications {
+ id
+ title
+ content
+ }
+ }
+"""
+sub_id = ws.subscribe(query, callback=callback)
+...
+# later stop the subscription
+ws.stop_subscribe(sub_id)
+ws.close()
+```
+
+### Variables can be passed
+
+```python
+from graphql_client import GraphQLClient
+
+ws = GraphQLClient('ws://localhost:8080/graphql')
+def callback(_id, data):
+ print("got new data..")
+ print(f"msg id: {_id}. data: {data}")
+
+query = """
+ subscription ($limit: Int!) {
+ notifications (order_by: {created: "desc"}, limit: $limit) {
+ id
+ title
+ content
+ }
+ }
+"""
+sub_id = ws.subscribe(query, variables={'limit': 10}, callback=callback)
+```
+
+### Normal queries and mutations work too
+
+```python
+from graphql_client import GraphQLClient
+
+ws = GraphQLClient('ws://localhost:8080/graphql')
+query = """
+ query ($limit: Int!) {
+ notifications (order_by: {created: "desc"}, limit: $limit) {
+ id
+ title
+ content
+ }
+ }
+"""
+res = ws.query(query, variables={'limit': 10})
+print(res)
+ws.close()
+```
+
+
+## TODO
+- support http as well
+- should use asyncio websocket library?
+
+
+
+
+%package help
+Summary: Development documents and examples for py-graphql-client
+Provides: python3-py-graphql-client-doc
+%description help
+# py-graphql-client
+Dead-simple to use GraphQL client over websocket. Using the
+[apollo-transport-ws](https://github.com/apollographql/subscriptions-transport-ws/blob/master/PROTOCOL.md)
+protocol.
+
+## Install
+
+```bash
+pip install py-graphql-client
+```
+
+## Examples
+
+### Setup subscriptions super easily
+
+```python
+from graphql_client import GraphQLClient
+
+ws = GraphQLClient('ws://localhost:8080/graphql')
+def callback(_id, data):
+ print("got new data..")
+ print(f"msg id: {_id}. data: {data}")
+
+query = """
+ subscription {
+ notifications {
+ id
+ title
+ content
+ }
+ }
+"""
+sub_id = ws.subscribe(query, callback=callback)
+...
+# later stop the subscription
+ws.stop_subscribe(sub_id)
+ws.close()
+```
+
+### Variables can be passed
+
+```python
+from graphql_client import GraphQLClient
+
+ws = GraphQLClient('ws://localhost:8080/graphql')
+def callback(_id, data):
+ print("got new data..")
+ print(f"msg id: {_id}. data: {data}")
+
+query = """
+ subscription ($limit: Int!) {
+ notifications (order_by: {created: "desc"}, limit: $limit) {
+ id
+ title
+ content
+ }
+ }
+"""
+sub_id = ws.subscribe(query, variables={'limit': 10}, callback=callback)
+```
+
+### Normal queries and mutations work too
+
+```python
+from graphql_client import GraphQLClient
+
+ws = GraphQLClient('ws://localhost:8080/graphql')
+query = """
+ query ($limit: Int!) {
+ notifications (order_by: {created: "desc"}, limit: $limit) {
+ id
+ title
+ content
+ }
+ }
+"""
+res = ws.query(query, variables={'limit': 10})
+print(res)
+ws.close()
+```
+
+
+## TODO
+- support http as well
+- should use asyncio websocket library?
+
+
+
+
+%prep
+%autosetup -n py-graphql-client-0.1.1
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-py-graphql-client -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.1-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..6702a13
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+d68f67db0baa7ddf08ca2c392daff7bf py-graphql-client-0.1.1.tar.gz