• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

snowplow / snowplow-python-tracker / 3956992538

pending completion
3956992538

Pull #312

github

GitHub
Merge bbb276e87 into ecca49d70
Pull Request #312: Release/0.13.0

511 of 582 new or added lines in 15 files covered. (87.8%)

2 existing lines in 1 file now uncovered.

2391 of 2522 relevant lines covered (94.81%)

11.33 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.0
/snowplow_tracker/tracker_configuration.py
1
# """
2
#     tracker_configuration.py
3

4
#     Copyright (c) 2013-2022 Snowplow Analytics Ltd. All rights reserved.
5

6
#     This program is licensed to you under the Apache License Version 2.0,
7
#     and you may not use this file except in compliance with the Apache License
8
#     Version 2.0. You may obtain a copy of the Apache License Version 2.0 at
9
#     http://www.apache.org/licenses/LICENSE-2.0.
10

11
#     Unless required by applicable law or agreed to in writing,
12
#     software distributed under the Apache License Version 2.0 is distributed on
13
#     an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
#     express or implied. See the Apache License Version 2.0 for the specific
15
#     language governing permissions and limitations there under.
16

17
#     Authors: Jack Keene, Anuj More, Alex Dean, Fred Blundun, Paul Boocock
18
#     Copyright: Copyright (c) 2013-2022 Snowplow Analytics Ltd
19
#     License: Apache License Version 2.0
20
# """
21

22
from typing import Optional
12✔
23
from snowplow_tracker.typing import JsonEncoderFunction
12✔
24

25

26
class TrackerConfiguration(object):
12✔
27
    def __init__(
12✔
28
        self,
29
        encode_base64: Optional[bool] = None,
30
        json_encoder: Optional[JsonEncoderFunction] = None,
31
    ) -> None:
32
        """
33
        Configuration for additional tracker configuration options.
34
        :param encode_base64:     Whether JSONs in the payload should be base-64 encoded. Default is True.
35
        :type  encode_base64:     bool
36
        :param json_encoder:      Custom JSON serializer that gets called on non-serializable object.
37
        :type  json_encoder:      function | None
38
        """
39

40
        self.encode_base64 = encode_base64
12✔
41
        self.json_encoder = json_encoder
12✔
42

43
    @property
12✔
44
    def encode_base64(self) -> Optional[bool]:
12✔
45
        """
46
        Whether JSONs in the payload should be base-64 encoded. Default is True.
47
        """
NEW
48
        return self._encode_base64
×
49

50
    @encode_base64.setter
12✔
51
    def encode_base64(self, value: Optional[bool]):
12✔
52
        if isinstance(value, bool) or value is None:
12✔
53
            self._encode_base64 = value
12✔
54
        else:
NEW
55
            raise ValueError("encode_base64 must be True or False")
×
56

57
    @property
12✔
58
    def json_encoder(self) -> Optional[JsonEncoderFunction]:
12✔
59
        """
60
        Custom JSON serializer that gets called on non-serializable object.
61
        """
NEW
62
        return self._json_encoder
×
63

64
    @json_encoder.setter
12✔
65
    def json_encoder(self, value: Optional[JsonEncoderFunction]):
12✔
66
        self._json_encoder = value
12✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc