- CentOS7+
- Python3.8+
- Install pyenv and Python 3.8.10
- Create venv environment
- Install requirements
Please refer https://github.com/pyenv/pyenv
$ pyenv install 3.8.10
Please refer https://docs.python.org/3/library/venv.html
$ python -m venv venv
$ . ./venv/bin/activate
(venv)$ pip install -r requirements.txt
This example sends a JPEG image file to PubNub service, and receive the data from the service and open it as a image.
I used PIL to process images.
- file_pub.py
- This sends a file
- file_sub.py
- This receives a file
- file_list.py
- This lists files stored in the PubNub service
Create the param.sh to register environmental variables for PubNub keys.
param.sh
is listed in .gitignore
file to prevent accidents.
export PUBNUB_PUBKEY=pub-xxxxxx
export PUBNUB_SUBKEY=sub-xxxxxx
Execute param.sh
(venv)$ . param.sh
(venv)$ python file_pub.py
(venv)$ python file_list.py
(venv)$ python file_sub.py
This sample code uses PIL to open JPG data.
This project includes sample codes: pub.py and sub.py
This are based on the official document's sample codes. Please refer the documents for use.