def __init__(self, options):
        super(GoogleAnalytics, self).__init__(options)

        # Required parameters for each payload
        property_id = options.get("property_id", "UA-XXXX-Y")
        client_id = options.get("client_id", '555')

        self.google_analytics = GoogleAnalyticsInterface(
            property_id=property_id, client_id=client_id)
Exemple #2
0
class TestGoogleAnalyticsInterface(TestCase):
    def setUp(self):
        self.interface = GoogleAnalyticsInterface(property_id='UA-12573345-12',
                                                  client_id='testing')

    def test_can_write(self):
        self.assertTrue(self.interface.can('write'))

    def test_can_read(self):
        self.assertFalse(self.interface.can('read'))
class TestGoogleAnalyticsInterface(TestCase):

    def setUp(self):
        self.interface = GoogleAnalyticsInterface(
            property_id='UA-12573345-12',
            client_id='testing'
        )

    def test_can_write(self):
        self.assertTrue(self.interface.can('write'))

    def test_can_read(self):
        self.assertFalse(self.interface.can('read'))
    def __init__(self, options):
        super(GoogleAnalytics, self).__init__(options)

        # Required parameters for each payload
        property_id = options.get("property_id", "UA-XXXX-Y")
        client_id = options.get("client_id", '555')

        self.google_analytics = GoogleAnalyticsInterface(
            property_id=property_id,
            client_id=client_id
        )
class GoogleAnalytics(Adaptor):
    def __init__(self, options):
        super(GoogleAnalytics, self).__init__(options)

        # Required parameters for each payload
        property_id = options.get("property_id", "UA-XXXX-Y")
        client_id = options.get("client_id", '555')

        self.google_analytics = GoogleAnalyticsInterface(
            property_id=property_id, client_id=client_id)

    def http_send(self, event):
        """
        Sends a data payload to the data connection.
        """
        return self.google_analytics.add(event)
class GoogleAnalytics(Adaptor):

    def __init__(self, options):
        super(GoogleAnalytics, self).__init__(options)

        # Required parameters for each payload
        property_id = options.get("property_id", "UA-XXXX-Y")
        client_id = options.get("client_id", '555')

        self.google_analytics = GoogleAnalyticsInterface(
            property_id=property_id,
            client_id=client_id
        )

    def http_send(self, event):
        """
        Sends a data payload to the data connection.
        """
        return self.google_analytics.add(event)
Exemple #7
0
from iot_analytics.interfaces import GoogleAnalyticsInterface
from iot_analytics.models import Event
'''
This is an example for how to use the python iot_analytics
package to record data to a self hosted database.
'''

# Create a new interface
interface = GoogleAnalyticsInterface()

# Create an event object
event = Event("ROBOT1-ID", {
    'category': 'button',
    'action': 'pressed',
    'label': 'momentary',
    'value': 10
})

# Add the event via the interface
interface.add(event)
Exemple #8
0
 def setUp(self):
     self.interface = GoogleAnalyticsInterface(property_id='UA-12573345-12',
                                               client_id='testing')
 def setUp(self):
     self.interface = GoogleAnalyticsInterface(
         property_id='UA-12573345-12',
         client_id='testing'
     )
from iot_analytics.interfaces import GoogleAnalyticsInterface
from iot_analytics.models import Event


'''
This is an example for how to use the python iot_analytics
package to record data to a self hosted database.
'''

# Create a new interface
interface = GoogleAnalyticsInterface()

# Create an event object
event = Event("ROBOT1-ID", {
    'category': 'button',
    'action': 'pressed',
    'label': 'momentary',
    'value': 10
})

# Add the event via the interface
interface.add(event)