You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from stathat import StatHat
stathat.ez_post_value('some@email', 'sign in - age of user', 27.0)
If followed faithfully, this example fails for two reasons:
StatHat class is capitalized, and module not imported -- the second line doesn't resolve symbol properly
If I assume I ought to have capitalized the class in 2nd line (that's what I imported), I'd find that non-instance class members should be decorated with @classmethod or @staticmethod in python -- calling ex_post_value on the class directly rather than an instance of the class will fail
I'd recommend wrapping these in a class that you can initialize with an API key so you don't have to pass the API key to every method call, and amending the instructions to instantiate the class. Or you could use static/class methods, or skip the class entirely.
In your example you provide the following sample:
If followed faithfully, this example fails for two reasons:
StatHat
class is capitalized, and module not imported -- the second line doesn't resolve symbol properly@classmethod
or@staticmethod
in python -- callingex_post_value
on the class directly rather than an instance of the class will failI'd recommend wrapping these in a class that you can initialize with an API key so you don't have to pass the API key to every method call, and amending the instructions to instantiate the class. Or you could use static/class methods, or skip the class entirely.
Additionally, I noticed you provide a ruby gem. It's easy to do similar packaging with pypi for python: https://packaging.python.org/en/latest/distributing/#uploading-your-project-to-pypi
The text was updated successfully, but these errors were encountered: