Ejemplo n.º 1
0
 def add_verification_stream(self, pipeline, data_type, options, data):
     """
     To add  verification data stream to a Pipeline
     :param eventbuffer: string
     :param data_type: string
     :param options: dict
     :param data: Stream
     """
     url = '/pipeline/' + pipeline + '/verification'
     form_data = {
         'files': {
             'data': (Utils.random_string(10) +
                      ('.json' if data_type is 'json' else '.csv'), data,
                      'text/plain;charset=UTF-8', {
                          'Expires': '0'
                      })
         }
     }
     response = self.http.upstream(url, form_data)
     return response
    def add_input_stream(self, datastream, data_type, options, data):
        """
        To add data stream to a Datastream
        :param datastream: string
        :param data_type: string
        :param options: dict
        :param data: Stream
        """

        url = self.get_add_input_data_url(datastream, options)
        form_data = {
            'files': {
                'data': (Utils.random_string(10) +
                         ('.json' if data_type == 'json' else '.csv'), data,
                         'text/plain;charset=UTF-8', {
                             'Expires': '0'
                         })
            }
        }
        response = self.http.upstream(url, form_data)
        return response
Ejemplo n.º 3
0
 def add_verification_stream(self, pipeline, data_type, options, data):
     """
     To add  verification data stream to a Pipeline
     :param eventbuffer: string
     :param data_type: string
     :param options: dict
     :param data: Stream
     """
     url = '/pipeline/' + pipeline + '/verification'
     form_data = {
         'files': {
             'data': (
                 Utils.random_string(10)+('.json' if data_type is 'json' else '.csv'),
                 data,
                 'text/plain;charset=UTF-8',
                 {'Expires': '0'}
             )
         }
     }
     response = self.http.upstream(url,form_data)
     return response
Ejemplo n.º 4
0
 def add_input_data(self, eventbuffer, data_type, options, data):
     """
     To add data to a Eventbuffer
     :param eventbuffer: string
     :param data_type: string
     :param options: dict
     :param data: string
     """
     url = '/Eventbuffer/' + str(eventbuffer) + \
           (('?subscriptionKey=' + options['subscription']) if 'subscription' in options else '')
     form_data = {
         'files': {
             'data': (Utils.random_string(10) +
                      ('.json' if data_type is 'json' else '.csv'),
                      StringIO(data), 'text/plain;charset=UTF-8', {
                          'Expires': '0'
                      })
         }
     }
     response = self.http.fpost(url, form_data)
     return response
Ejemplo n.º 5
0
 def add_input_data(self, eventbuffer, data_type, options, data):
     """
     To add data to a Eventbuffer
     :param eventbuffer: string
     :param data_type: string
     :param options: dict
     :param data: string
     """
     url = '/Eventbuffer/' + str(eventbuffer) + \
           (('?subscriptionKey=' + options['subscription']) if 'subscription' in options else '')
     form_data = {
         'files': {
             'data': (
                 Utils.random_string(10)+('.json' if data_type is 'json' else '.csv'),
                 StringIO(data),
                 'text/plain;charset=UTF-8',
                 {'Expires': '0'}
             )
         }
     }
     response = self.http.fpost(url, form_data)
     return response
Ejemplo n.º 6
0
    def add_input_stream(self, datastream, data_type, options, data):
        """
        To add data stream to a Datastream
        :param datastream: string
        :param data_type: string
        :param options: dict
        :param data: Stream
        """

        url = self.get_add_input_data_url(datastream, options)
        form_data = {
            'files': {
                'data': (
                    Utils.random_string(10)+('.json' if data_type == 'json' else '.csv'),
                    data,
                    'text/plain;charset=UTF-8',
                    {'Expires': '0'}
                )
            }
        }
        response = self.http.upstream(url, form_data)
        return response