summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-06-20 06:31:10 +0000
committerCoprDistGit <infra@openeuler.org>2023-06-20 06:31:10 +0000
commit264511df47f785543fd1a180b1844f7128289d72 (patch)
tree72dd5514dba313e9fc35f1c1b3c3040741fcafc5
parent8c9315e3a23049263b0de289bd0ceafba9755c14 (diff)
automatic import of python-pullkinopeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-pullkin.spec371
-rw-r--r--sources1
3 files changed, 373 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..2e6db83 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/pullkin-0.12.0.tar.gz
diff --git a/python-pullkin.spec b/python-pullkin.spec
new file mode 100644
index 0000000..d4b553f
--- /dev/null
+++ b/python-pullkin.spec
@@ -0,0 +1,371 @@
+%global _empty_manifest_terminate_build 0
+Name: python-pullkin
+Version: 0.12.0
+Release: 1
+Summary: Subscribe to GCM/FCM and receive notifications like an android app
+License: Mozilla Public License 2.0
+URL: https://github.com/WhiteApfel/pullkin
+Source0: https://mirrors.aliyun.com/pypi/web/packages/98/d4/139d9a096229d59df047424446bc15c09e69efddd1bd3798cec7596f2f6b/pullkin-0.12.0.tar.gz
+BuildArch: noarch
+
+Requires: python3-http-ece
+Requires: python3-asyncio
+Requires: python3-betterproto
+Requires: python3-cryptography
+Requires: python3-httpx
+Requires: python3-loguru
+Requires: python3-oscrypto
+Requires: python3-dotenv
+
+%description
+# Pullkin
+
+[![CodeFactor](https://www.codefactor.io/repository/github/whiteapfel/pullkin/badge/master)](https://www.codefactor.io/repository/github/whiteapfel/pullkin/overview/master)
+[![Build Status](https://app.travis-ci.com/WhiteApfel/Pullkin.svg?branch=master)](https://app.travis-ci.com/WhiteApfel/Pullkin)
+![PyPI - Downloads](https://img.shields.io/pypi/dm/pullkin)
+![GitHub](https://img.shields.io/github/license/whiteapfel/pullkin)
+![GitHub last commit](https://img.shields.io/github/last-commit/whiteapfel/pullkin)
+![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pullkin)
+
+Like Pushkin, but subscribe to FCM (GCM) and receive notifications
+
+My alternative implementation
+of [python implementation](https://github.com/Francesco149/push_receiver)
+of [JS implementation](https://github.com/MatthieuLemoine/push-receiver)
+
+Tested on python (3.6, 3.8, 3.10, pypy3.7-7.3.5)
+
+I almost didn't write anything to consider it my intellectual property,
+just wrapped the code already written by Franc[e]sco in a design convenient for my own use
+
+Note that for the listening part Franc[e]sco has to pull in http-ece which depends
+on a full-blown native crypto library rather than just oscrypto. it is
+an optional dependency, so you'll have to install it explicitly by depending
+on `pullkin[listen]`
+
+## Differences
+
+* Add async listener
+* Add async listener-coroutine
+* Replace functions with class of listener
+
+## Usage
+
+### Installation
+
+```shell
+pip install pullkin
+```
+
+### How to use
+
+```python
+import json
+import os.path
+import asyncio
+
+from pullkin import Pullkin
+from pullkin.models import Message, AppCredentials
+
+SENDER_ID = '<<SENDER_ID>>' # '1234567890'
+APP_ID = '<<APP_ID>>' # '1:1234567890:android:abcdef1234567890'
+API_ID = '<<API_ID>>' # 'AIzaSyDce4zFw4CqLqW2eCOqTbXfDx9a8mRnLpI'
+FIREBASE_NAME = '<<FIREBASE_NAME' # 'pullkin-example'
+APP_NAME = '<<APP_NAME>>' # 'cc.pullkin.example'
+
+#
+ANDROID_CERT = 'da39a3ee5e6b4b0d3255bfef95601890afd80709'
+# 'da39a3ee5e6b4b0d3255bfef95601890afd80709' is default hash
+
+pullkin = Pullkin()
+
+if not os.path.exists('.persistent_ids.txt'):
+ with open('.persistent_ids.txt', 'w+') as f:
+ ...
+
+with open(".persistent_ids.txt", "r") as f:
+ received_persistent_ids = [x.strip() for x in f]
+
+
+@pullkin.on_notification()
+async def on_notification(message: Message, data_message):
+ idstr = data_message.persistent_id + "\n"
+ with open(".persistent_ids.txt", "r") as f:
+ if idstr in f:
+ return
+ with open(".persistent_ids.txt", "a") as f:
+ f.write(idstr)
+ print(message.notification)
+
+
+async def main():
+ if not os.path.exists('.pullkin_app_credentials'):
+ with open('.pullkin_app_credentials', 'w+') as f:
+ credentials = await pullkin.register(SENDER_ID, APP_ID, API_ID, FIREBASE_NAME, ANDROID_CERT, APP_NAME)
+ f.write(json.dumps(credentials.dict()))
+ else:
+ with open('.pullkin_app_credentials', 'r') as f:
+ credentials = AppCredentials(**json.loads(f.read()))
+ await pullkin.run(
+ sender_id=SENDER_ID,
+ credentials=credentials,
+ persistent_ids=received_persistent_ids,
+ )
+
+
+asyncio.run(main())
+```
+
+
+%package -n python3-pullkin
+Summary: Subscribe to GCM/FCM and receive notifications like an android app
+Provides: python-pullkin
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-pullkin
+# Pullkin
+
+[![CodeFactor](https://www.codefactor.io/repository/github/whiteapfel/pullkin/badge/master)](https://www.codefactor.io/repository/github/whiteapfel/pullkin/overview/master)
+[![Build Status](https://app.travis-ci.com/WhiteApfel/Pullkin.svg?branch=master)](https://app.travis-ci.com/WhiteApfel/Pullkin)
+![PyPI - Downloads](https://img.shields.io/pypi/dm/pullkin)
+![GitHub](https://img.shields.io/github/license/whiteapfel/pullkin)
+![GitHub last commit](https://img.shields.io/github/last-commit/whiteapfel/pullkin)
+![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pullkin)
+
+Like Pushkin, but subscribe to FCM (GCM) and receive notifications
+
+My alternative implementation
+of [python implementation](https://github.com/Francesco149/push_receiver)
+of [JS implementation](https://github.com/MatthieuLemoine/push-receiver)
+
+Tested on python (3.6, 3.8, 3.10, pypy3.7-7.3.5)
+
+I almost didn't write anything to consider it my intellectual property,
+just wrapped the code already written by Franc[e]sco in a design convenient for my own use
+
+Note that for the listening part Franc[e]sco has to pull in http-ece which depends
+on a full-blown native crypto library rather than just oscrypto. it is
+an optional dependency, so you'll have to install it explicitly by depending
+on `pullkin[listen]`
+
+## Differences
+
+* Add async listener
+* Add async listener-coroutine
+* Replace functions with class of listener
+
+## Usage
+
+### Installation
+
+```shell
+pip install pullkin
+```
+
+### How to use
+
+```python
+import json
+import os.path
+import asyncio
+
+from pullkin import Pullkin
+from pullkin.models import Message, AppCredentials
+
+SENDER_ID = '<<SENDER_ID>>' # '1234567890'
+APP_ID = '<<APP_ID>>' # '1:1234567890:android:abcdef1234567890'
+API_ID = '<<API_ID>>' # 'AIzaSyDce4zFw4CqLqW2eCOqTbXfDx9a8mRnLpI'
+FIREBASE_NAME = '<<FIREBASE_NAME' # 'pullkin-example'
+APP_NAME = '<<APP_NAME>>' # 'cc.pullkin.example'
+
+#
+ANDROID_CERT = 'da39a3ee5e6b4b0d3255bfef95601890afd80709'
+# 'da39a3ee5e6b4b0d3255bfef95601890afd80709' is default hash
+
+pullkin = Pullkin()
+
+if not os.path.exists('.persistent_ids.txt'):
+ with open('.persistent_ids.txt', 'w+') as f:
+ ...
+
+with open(".persistent_ids.txt", "r") as f:
+ received_persistent_ids = [x.strip() for x in f]
+
+
+@pullkin.on_notification()
+async def on_notification(message: Message, data_message):
+ idstr = data_message.persistent_id + "\n"
+ with open(".persistent_ids.txt", "r") as f:
+ if idstr in f:
+ return
+ with open(".persistent_ids.txt", "a") as f:
+ f.write(idstr)
+ print(message.notification)
+
+
+async def main():
+ if not os.path.exists('.pullkin_app_credentials'):
+ with open('.pullkin_app_credentials', 'w+') as f:
+ credentials = await pullkin.register(SENDER_ID, APP_ID, API_ID, FIREBASE_NAME, ANDROID_CERT, APP_NAME)
+ f.write(json.dumps(credentials.dict()))
+ else:
+ with open('.pullkin_app_credentials', 'r') as f:
+ credentials = AppCredentials(**json.loads(f.read()))
+ await pullkin.run(
+ sender_id=SENDER_ID,
+ credentials=credentials,
+ persistent_ids=received_persistent_ids,
+ )
+
+
+asyncio.run(main())
+```
+
+
+%package help
+Summary: Development documents and examples for pullkin
+Provides: python3-pullkin-doc
+%description help
+# Pullkin
+
+[![CodeFactor](https://www.codefactor.io/repository/github/whiteapfel/pullkin/badge/master)](https://www.codefactor.io/repository/github/whiteapfel/pullkin/overview/master)
+[![Build Status](https://app.travis-ci.com/WhiteApfel/Pullkin.svg?branch=master)](https://app.travis-ci.com/WhiteApfel/Pullkin)
+![PyPI - Downloads](https://img.shields.io/pypi/dm/pullkin)
+![GitHub](https://img.shields.io/github/license/whiteapfel/pullkin)
+![GitHub last commit](https://img.shields.io/github/last-commit/whiteapfel/pullkin)
+![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pullkin)
+
+Like Pushkin, but subscribe to FCM (GCM) and receive notifications
+
+My alternative implementation
+of [python implementation](https://github.com/Francesco149/push_receiver)
+of [JS implementation](https://github.com/MatthieuLemoine/push-receiver)
+
+Tested on python (3.6, 3.8, 3.10, pypy3.7-7.3.5)
+
+I almost didn't write anything to consider it my intellectual property,
+just wrapped the code already written by Franc[e]sco in a design convenient for my own use
+
+Note that for the listening part Franc[e]sco has to pull in http-ece which depends
+on a full-blown native crypto library rather than just oscrypto. it is
+an optional dependency, so you'll have to install it explicitly by depending
+on `pullkin[listen]`
+
+## Differences
+
+* Add async listener
+* Add async listener-coroutine
+* Replace functions with class of listener
+
+## Usage
+
+### Installation
+
+```shell
+pip install pullkin
+```
+
+### How to use
+
+```python
+import json
+import os.path
+import asyncio
+
+from pullkin import Pullkin
+from pullkin.models import Message, AppCredentials
+
+SENDER_ID = '<<SENDER_ID>>' # '1234567890'
+APP_ID = '<<APP_ID>>' # '1:1234567890:android:abcdef1234567890'
+API_ID = '<<API_ID>>' # 'AIzaSyDce4zFw4CqLqW2eCOqTbXfDx9a8mRnLpI'
+FIREBASE_NAME = '<<FIREBASE_NAME' # 'pullkin-example'
+APP_NAME = '<<APP_NAME>>' # 'cc.pullkin.example'
+
+#
+ANDROID_CERT = 'da39a3ee5e6b4b0d3255bfef95601890afd80709'
+# 'da39a3ee5e6b4b0d3255bfef95601890afd80709' is default hash
+
+pullkin = Pullkin()
+
+if not os.path.exists('.persistent_ids.txt'):
+ with open('.persistent_ids.txt', 'w+') as f:
+ ...
+
+with open(".persistent_ids.txt", "r") as f:
+ received_persistent_ids = [x.strip() for x in f]
+
+
+@pullkin.on_notification()
+async def on_notification(message: Message, data_message):
+ idstr = data_message.persistent_id + "\n"
+ with open(".persistent_ids.txt", "r") as f:
+ if idstr in f:
+ return
+ with open(".persistent_ids.txt", "a") as f:
+ f.write(idstr)
+ print(message.notification)
+
+
+async def main():
+ if not os.path.exists('.pullkin_app_credentials'):
+ with open('.pullkin_app_credentials', 'w+') as f:
+ credentials = await pullkin.register(SENDER_ID, APP_ID, API_ID, FIREBASE_NAME, ANDROID_CERT, APP_NAME)
+ f.write(json.dumps(credentials.dict()))
+ else:
+ with open('.pullkin_app_credentials', 'r') as f:
+ credentials = AppCredentials(**json.loads(f.read()))
+ await pullkin.run(
+ sender_id=SENDER_ID,
+ credentials=credentials,
+ persistent_ids=received_persistent_ids,
+ )
+
+
+asyncio.run(main())
+```
+
+
+%prep
+%autosetup -n pullkin-0.12.0
+
+%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-pullkin -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 0.12.0-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..8ed3bbd
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+fa8b54b20aa51a93ef75838a49deceb5 pullkin-0.12.0.tar.gz