Clone from GitHub.
git clone https://github.com/UNILORN/python-optimcios
Execute the following command.
$ cd python-optimcios
$ make
from python_optimcios.v1 import messaging
channel_id = ""
access_token = ""
cios = messaging.Messaging('ws://0.0.0.0:9999',channel_id,access_token)
cios.connection()
cios.sendMessage('Hello world')
mes = cios.receiveMessage()
print(mes)
from python_optimcios.v2 import authorization
auth = authorization.Authorization(
auth_uri="AUTH_URI",
client_id="CLIENT_ID",
client_secret="CLIENT_SECRET",
log=True
)
access_token = auth.getRefreshAccessToken(
scope="SCOPE",
refresh_token="REFRESH_TOKEN"
)
print(access_token)
from python_optimcios.v2 import authorization, datastore
auth = authorization.Authorization(
auth_uri="AUTH_URI",
client_id="CLIENT_ID",
client_secret="CLIENT_SECRET",
log=True
)
access_token = auth.getRefreshAccessToken(
scope="SCOPE",
refresh_token="REFRESH_TOKEN"
)
datastore = datastore.Datastore(
access_token=access_token,
api_uri="API_URI",
log=True
)
# Datastore Channel List
datastore.getListChannel()
# Datastore Channel Info
datastore.getChannel(channel_id="CHANNEL_ID")
# Datastore Object List
datastore.getListObjects(channel_id="CHANNEL_ID")
# Datastore Create Object
datastore.postObject(channel_id="CHANNEL_ID",data="POST_DATA_JSON")
# Datastore Object Info
datastore.getObject(channel_id="CHANNEL_ID",object_id="OBJECT_ID")
# Datastore Latest Object Info
datastore.getObject(channel_id="CHANNEL_ID")
# Datasotre Delete Object
datastore.deleteObject(channel_id="CHANNEL_ID",object_id="OBJECT_ID")
In Development
Python >= 3.6.0
pip >= 10.0.1
-
Please install with the following command.
$ make inst-dev
-
Change the .env file
-
Run the test and make sure there are no errors
$ python3 setup.py test