Exemplo n.º 1
0
    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)
Exemplo n.º 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'))
Exemplo n.º 3
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'))
Exemplo n.º 4
0
    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
        )
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
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)
Exemplo n.º 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)
Exemplo n.º 8
0
 def setUp(self):
     self.interface = GoogleAnalyticsInterface(property_id='UA-12573345-12',
                                               client_id='testing')
Exemplo n.º 9
0
 def setUp(self):
     self.interface = GoogleAnalyticsInterface(
         property_id='UA-12573345-12',
         client_id='testing'
     )
Exemplo n.º 10
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)