netmanchris / pyawair

python wrapper for Awair Air Quality Sensor
Apache License 2.0
16 stars 3 forks source link

Functions missing in pipy package #2

Closed danielsjf closed 6 years ago

danielsjf commented 6 years ago

@netmanchris I think that the init.py file might be missing in the pyawair folder. When I check with dir, it seems that there are no exported functions in your package on pipy. Have you tried to install the package already via pipy?

netmanchris commented 6 years ago

Hasn't tested the pypi. Looks like you're right. Just updated to 0.0.3 with the init file included. Did a quick test in a separate VENV and first glance looks ok. Didn't do involved testing though.

netmanchris commented 6 years ago

@danielsjf Look for 0.0.4. Quickly put in a bunch of PEP fixes as well. Need to setup a Jenkins job with coverage and Style testing as I start to do more clean up. Let me know if the 0.0.4 works for you so that I can close this out.

danielsjf commented 6 years ago

For some reason it's still not working with the functions. The .py files are included this time, but dir still isn't listing the functions. When I try to call one I get a message that it isn't included in the package. I haven't published something on pypi so I don't have a clue what it could be this time. Maybe something in the content of the init file?

netmanchris commented 6 years ago

@danielsjf Just hit the limit of the API for the data so I'm stuck. Try this

`

token = '''INSERT_YOUR_TOKEN_HERE''' from pyawair.auth import * auth = AwairAuth(token=token) ` To test this out you can try the following two commands to see that they auth object was created properly

`

auth.token auth.headers ` To get simple user data you should be able to do the following

from pyawair.data import * user_data = get_user_data(auth)

I'd print out the output for you but I've hit the API limit for the day. :)

I'm working on a full tutorial which I'll post to Github as well once it's done. Unfortunately, the API rate limit is holding me back right now.

danielsjf commented 6 years ago

Tried a few different ways from import pyawair to from pyawair import *. In all cases, dir(pyawair) or dir(pyawair.data) only lists the default functions. Tried it both on my cellphone (pydroid) and on my computer (pycharm). In both cases, I get results if I do the same for numpy.

netmanchris commented 6 years ago

Just tried this on a totally seperate machine after pip install pyawair. I can't do much right now because of the rate limit on the API, but you should be able to do the following

If you do a straight dir() you can see that the functions get imported into the main namespace and are available there. I'll dig into more later but wanted to see if this works for you.

Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] Type 'copyright', 'credits' or 'license' for more information IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help. PyDev console: using IPython 6.5.0 Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32 from pyawair.data import * dir() Out[3]: ['In', 'Out', '_', '__', '___', '__builtin__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__', '_dh', '_i', '_i1', '_i2', '_i3', '_ih', '_ii', '_iii', '_oh', 'exit', 'get_15_min_average', 'get_5_min_average', 'get_all_devices', 'get_current_air_data', 'get_dev_details', 'get_dev_display_mode', 'get_dev_led_mode', 'get_dev_power_status', 'get_dev_timezone', 'get_ipython', 'get_raw_data', 'get_user_data', 'json', 'quit', 'requests', 'set_device_led', 'set_device_preference', 'set_device_timezone', 'sys']

danielsjf commented 6 years ago

It works now. Cleared the package and did a fresh install. Don't know what was wrong. You can close this issue.

netmanchris commented 6 years ago

Awesome! Glad to hear it. I'll close the issue.