Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6 from rccoleman/async
Browse files Browse the repository at this point in the history
Re-enable polling and switch to PyCryptodome
  • Loading branch information
rccoleman authored Dec 17, 2020
2 parents 2fe5e28 + ae8d8c2 commit 5cbef3e
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 33 deletions.
2 changes: 1 addition & 1 deletion lmdirect/aescipher.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import base64
from Cryptodome.Cipher import AES
from Crypto.Cipher import AES
from math import ceil

import logging
Expand Down
13 changes: 7 additions & 6 deletions parse.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import json
import codecs
import re
import logging
import json, codecs, re, logging
from lmdirect.aescipher import AESCipher

_LOGGER = logging.getLogger(__name__)
_LOGGER.setLevel(logging.DEBUG)

PHONE_IP = "192.168.1.150"
LM_IP = "192.168.1.215"
FILE = "config.json"

try:
with open("config.json") as config_file:
with open(FILE) as config_file:
data = json.load(config_file)

key = data["key"]
Expand All @@ -18,7 +19,7 @@

cipher = AESCipher(key)

SOURCE_MAP = {"192.168.1.150": "\nApp", "192.168.1.215": "Machine"}
SOURCE_MAP = {PHONE_IP: "\nApp", LM_IP: "Machine"}

# Opening JSON file
with open("version.json") as json_file:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cryptodomex>=3.9.9
pycryptodome>=3.9.9
40 changes: 20 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
from setuptools import setup

with open('README.md', 'r') as f:
with open("README.md", "r") as f:
readme = f.read()

setup(
name='lmdirect',
version='v0.1',
description='A Python implementation of the local La Marzocco API',
name="lmdirect",
version="v0.1",
description="A Python implementation of the local La Marzocco API",
long_description=readme,
url='https://github.com/rccoleman/lmdirect',
author='Rob Coleman',
author_email='[email protected]',
license='MIT',
url="https://github.com/rccoleman/lmdirect",
author="Rob Coleman",
author_email="[email protected]",
license="MIT",
classifiers=[
'Development Status :: 1 - Experimental',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: Implementation :: CPython',
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: Implementation :: CPython",
],
packages=['lmdirect'],
install_requires=[
'pycryptodomex>=3.9.9; python_version > "3.8"'
],
package_data={'license': ['LICENSE'],},
packages=["lmdirect"],
install_requires=["pycryptodome>=3.9.9"],
package_data={
"license": ["LICENSE"],
},
)
7 changes: 2 additions & 5 deletions test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import asyncio
from lmdirect import LMDirect
import json
import sys
import logging
import asyncio, json, sys, logging
from lmdirect.cmds import ON, OFF

logging.basicConfig(level=logging.DEBUG)
Expand Down Expand Up @@ -37,7 +34,7 @@ async def main():
lmdirect = LMDirect(key)
lmdirect.register_callback(update)
await lmdirect.connect(ip_addr)
# await lmdirect.create_polling_task()
await lmdirect.create_polling_task()

while True:
try:
Expand Down

0 comments on commit 5cbef3e

Please sign in to comment.