summaryrefslogtreecommitdiff
path: root/kafka/protocol/api.py
blob: 0c2343740bf3e84d07ba5851b7af74f81bef9646 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from .struct import Struct
from .types import Int16, Int32, String, Schema


class RequestHeader(Struct):
    SCHEMA = Schema(
        ('api_key', Int16),
        ('api_version', Int16),
        ('correlation_id', Int32),
        ('client_id', String('utf-8'))
    )

    def __init__(self, request, correlation_id=0, client_id='kafka-python'):
        super(RequestHeader, self).__init__(
            request.API_KEY, request.API_VERSION, correlation_id, client_id
        )