55
66from future .utils import raise_from
77
8- from splitio .api import APIException
8+ from splitio .api import APIException , headers_from_metadata
99from splitio .api .client import HttpClientException
1010
1111
1515class SegmentsAPI (object ): # pylint: disable=too-few-public-methods
1616 """Class that uses an httpClient to communicate with the segments API."""
1717
18- def __init__ (self , http_client , apikey ):
18+ def __init__ (self , http_client , apikey , sdk_metadata ):
1919 """
2020 Class constructor.
2121
2222 :param client: HTTP Client responsble for issuing calls to the backend.
2323 :type client: client.HttpClient
2424 :param apikey: User apikey token.
2525 :type apikey: string
26+ :param sdk_metadata: SDK version & machine name & IP.
27+ :type sdk_metadata: splitio.client.util.SdkMetadata
28+
2629 """
2730 self ._client = http_client
2831 self ._apikey = apikey
32+ self ._metadata = headers_from_metadata (sdk_metadata )
2933
3034 def fetch_segment (self , segment_name , change_number ):
3135 """
@@ -44,7 +48,8 @@ def fetch_segment(self, segment_name, change_number):
4448 'sdk' ,
4549 '/segmentChanges/{segment_name}' .format (segment_name = segment_name ),
4650 self ._apikey ,
47- {'since' : change_number }
51+ extra_headers = self ._metadata ,
52+ query = {'since' : change_number }
4853 )
4954
5055 if 200 <= response .status_code < 300 :
0 commit comments