fiftyone-ipintelligence-shared 4.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
@@ -0,0 +1,52 @@
1
+ # *********************************************************************
2
+ # This Original Work is copyright of 51 Degrees Mobile Experts Limited.
3
+ # Copyright 2026 51 Degrees Mobile Experts Limited, Davidson House,
4
+ # Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
5
+ #
6
+ # This Original Work is licensed under the European Union Public Licence
7
+ # (EUPL) v.1.2 and is subject to its terms as set out below.
8
+ #
9
+ # If a copy of the EUPL was not distributed with this file, You can obtain
10
+ # one at https://opensource.org/licenses/EUPL-1.2.
11
+ #
12
+ # The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
13
+ # amended by the European Commission) shall be deemed incompatible for
14
+ # the purposes of the Work and the provisions of the compatibility
15
+ # clause in Article 5 of the EUPL shall not apply.
16
+ #
17
+ # If using the Work as, or as part of, a network application, by
18
+ # including the attribution notice(s) required under Article 5 of the EUPL
19
+ # in the end user terms of the application under an appropriate heading,
20
+ # such notice(s) shall fulfill the requirements of that article.
21
+ # *********************************************************************
22
+
23
+ from fiftyone_pipeline_cloudrequestengine.constants import Constants as CoreConstants
24
+
25
+ # Class containing values for commonly used evidence keys
26
+ class Constants:
27
+
28
+ # The suffix that is used to identify a client IP address in evidence.
29
+ EVIDENCE_CLIENT_IP_SUFFIX = "client-ip"
30
+
31
+ # The complete key for supplying a client IP address as query evidence.
32
+ EVIDENCE_QUERY_CLIENT_IP_KEY = (
33
+ CoreConstants.EVIDENCE_QUERY_PREFIX +
34
+ CoreConstants.EVIDENCE_SEPERATOR +
35
+ EVIDENCE_CLIENT_IP_SUFFIX)
36
+
37
+ # The complete key for supplying a client IP address as server evidence.
38
+ EVIDENCE_SERVER_CLIENT_IP_KEY = (
39
+ "server" +
40
+ CoreConstants.EVIDENCE_SEPERATOR +
41
+ EVIDENCE_CLIENT_IP_SUFFIX)
42
+
43
+ # The suffix that is used to supply a client IP address to the
44
+ # 51Degrees cloud service in evidence.
45
+ EVIDENCE_CLIENT_IP_51D_SUFFIX = "client-ip-51d"
46
+
47
+ # The complete key for supplying a client IP address as query
48
+ # evidence to the 51Degrees cloud service.
49
+ EVIDENCE_QUERY_CLIENT_IP_51D_KEY = (
50
+ CoreConstants.EVIDENCE_QUERY_PREFIX +
51
+ CoreConstants.EVIDENCE_SEPERATOR +
52
+ EVIDENCE_CLIENT_IP_51D_SUFFIX)
@@ -0,0 +1,49 @@
1
+ # *********************************************************************
2
+ # This Original Work is copyright of 51 Degrees Mobile Experts Limited.
3
+ # Copyright 2026 51 Degrees Mobile Experts Limited, Davidson House,
4
+ # Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
5
+ #
6
+ # This Original Work is licensed under the European Union Public Licence
7
+ # (EUPL) v.1.2 and is subject to its terms as set out below.
8
+ #
9
+ # If a copy of the EUPL was not distributed with this file, You can obtain
10
+ # one at https://opensource.org/licenses/EUPL-1.2.
11
+ #
12
+ # The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
13
+ # amended by the European Commission) shall be deemed incompatible for
14
+ # the purposes of the Work and the provisions of the compatibility
15
+ # clause in Article 5 of the EUPL shall not apply.
16
+ #
17
+ # If using the Work as, or as part of, a network application, by
18
+ # including the attribution notice(s) required under Article 5 of the EUPL
19
+ # in the end user terms of the application under an appropriate heading,
20
+ # such notice(s) shall fulfill the requirements of that article.
21
+ # *********************************************************************
22
+
23
+ # Example IP addresses to use as evidence. The cloud engine expects the
24
+ # address under "query.client-ip-51d", the on-premise engine accepts
25
+ # "query.client-ip" or "server.client-ip" (and other parseable evidence).
26
+ # These values mirror the .NET examples' ExampleUtils.EvidenceValues.
27
+ EVIDENCE_VALUES = [
28
+ # An IPv4 address.
29
+ { "query.client-ip": "116.154.188.222" },
30
+ # An IPv4 address.
31
+ { "query.client-ip": "1.3.32.31" },
32
+ # An IPv4 address.
33
+ { "query.client-ip": "45.236.48.61" },
34
+ # An IPv6 address.
35
+ { "query.client-ip": "2001:0db8:085a:0000:0000:8a2e:0370:7334" },
36
+ ]
37
+
38
+ # Note: the .NET examples' Constants.cs still uses the legacy name
39
+ # "51Degrees-EnterpriseIpiV41.ipi", but the published enterprise/ASN data
40
+ # files use the "IPIV4" infix (cf. 51Degrees-IPIV4AsnIpiV41.ipi in the
41
+ # ip-intelligence-data repo), so the current name is used here.
42
+ ENTERPRISE_DATAFILE_NAME = '51Degrees-IPIV4EnterpriseIpiV41.ipi'
43
+ LITE_DATAFILE_NAME = '51Degrees-LiteIpiV41.ipi'
44
+ # The ASN data file is the freely available data file committed
45
+ # to the ip-intelligence-data submodule. It only contains the network
46
+ # (ASN) properties, but is useful for testing the on-premise engine against
47
+ # the current data format without an enterprise data file.
48
+ ASN_DATAFILE_NAME = '51Degrees-IPIV4AsnIpiV41.ipi'
49
+ EVIDENCE_FILE_NAME = 'evidence.yml'
@@ -0,0 +1,31 @@
1
+ # *********************************************************************
2
+ # This Original Work is copyright of 51 Degrees Mobile Experts Limited.
3
+ # Copyright 2026 51 Degrees Mobile Experts Limited, Davidson House,
4
+ # Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
5
+ #
6
+ # This Original Work is licensed under the European Union Public Licence
7
+ # (EUPL) v.1.2 and is subject to its terms as set out below.
8
+ #
9
+ # If a copy of the EUPL was not distributed with this file, You can obtain
10
+ # one at https://opensource.org/licenses/EUPL-1.2.
11
+ #
12
+ # The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
13
+ # amended by the European Commission) shall be deemed incompatible for
14
+ # the purposes of the Work and the provisions of the compatibility
15
+ # clause in Article 5 of the EUPL shall not apply.
16
+ #
17
+ # If using the Work as, or as part of, a network application, by
18
+ # including the attribution notice(s) required under Article 5 of the EUPL
19
+ # in the end user terms of the application under an appropriate heading,
20
+ # such notice(s) shall fulfill the requirements of that article.
21
+ # *********************************************************************
22
+
23
+ import os
24
+
25
+
26
+ class KeyUtils:
27
+ # Obtain a key either from environment variable or from a property.
28
+ # Try resource key as env var, then as upper case env var, the system property
29
+ @staticmethod
30
+ def get_named_key(key_name):
31
+ return os.environ.get(key_name) or os.environ.get(key_name.upper())
@@ -0,0 +1,51 @@
1
+ # *********************************************************************
2
+ # This Original Work is copyright of 51 Degrees Mobile Experts Limited.
3
+ # Copyright 2026 51 Degrees Mobile Experts Limited, Davidson House,
4
+ # Forbury Square, Reading, Berkshire, United Kingdom RG1 3EU.
5
+ #
6
+ # This Original Work is licensed under the European Union Public Licence
7
+ # (EUPL) v.1.2 and is subject to its terms as set out below.
8
+ #
9
+ # If a copy of the EUPL was not distributed with this file, You can obtain
10
+ # one at https://opensource.org/licenses/EUPL-1.2.
11
+ #
12
+ # The 'Compatible Licences' set out in the Appendix to the EUPL (as may be
13
+ # amended by the European Commission) shall be deemed incompatible for
14
+ # the purposes of the Work and the provisions of the compatibility
15
+ # clause in Article 5 of the EUPL shall not apply.
16
+ #
17
+ # If using the Work as, or as part of, a network application, by
18
+ # including the attribution notice(s) required under Article 5 of the EUPL
19
+ # in the end user terms of the application under an appropriate heading,
20
+ # such notice(s) shall fulfill the requirements of that article.
21
+ # *********************************************************************
22
+ def merge_two_dicts(x, y):
23
+ z = x.copy()
24
+ z.update(y)
25
+ return z
26
+
27
+
28
+ def get_value_type(value):
29
+ if type(value) is bool:
30
+ value_type = "Boolean"
31
+ elif type(value) is int:
32
+ value_type = "Int32"
33
+ elif type(value) is str:
34
+ value_type = "String"
35
+ elif type(value) is float:
36
+ value_type = "Double"
37
+ elif type(value) is list:
38
+ value_type = "Array"
39
+ elif isinstance(type(value), list):
40
+ value_type = "String[]"
41
+ else:
42
+ value_type = ""
43
+ return value_type
44
+
45
+ def is_same_type(value, expected_type):
46
+ valueType = get_value_type(value)
47
+ valid = (valueType == expected_type)
48
+
49
+ if not valid:
50
+ valid = True if valueType == "String" and expected_type == "JavaScript" else False
51
+ return valid
@@ -0,0 +1,64 @@
1
+ Metadata-Version: 2.4
2
+ Name: fiftyone_ipintelligence_shared
3
+ Version: 4.5.0
4
+ Summary: Shared code used by the cloud and on-premise variants of the 51Degrees IP Intelligence engines for the 51Degrees Pipeline API.
5
+ Home-page: https://51degrees.com/?utm_source=pypi&utm_medium=package&utm_campaign=51degrees-python&utm_content=fiftyone_ipintelligence_shared-setup.py&utm_term=url
6
+ Author: 51Degrees Engineering
7
+ Author-email: engineering@51degrees.com
8
+ License: EUPL-1.2
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Programming Language :: Python
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: License :: OSI Approved :: European Union Public Licence 1.2 (EUPL 1.2)
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: fiftyone_pipeline_core
23
+ Requires-Dist: fiftyone_pipeline_engines
24
+ Requires-Dist: fiftyone_pipeline_cloudrequestengine
25
+ Requires-Dist: fiftyone_pipeline_engines_fiftyone
26
+ Dynamic: author
27
+ Dynamic: author-email
28
+ Dynamic: classifier
29
+ Dynamic: description
30
+ Dynamic: description-content-type
31
+ Dynamic: home-page
32
+ Dynamic: license
33
+ Dynamic: requires-dist
34
+ Dynamic: requires-python
35
+ Dynamic: summary
36
+
37
+ # 51Degrees IP Intelligence Engines - Shared
38
+
39
+ ![51Degrees](https://51degrees.com/img/logo.png?utm_source=github&utm_medium=readme&utm_campaign=51degrees-python&utm_content=fiftyone_ipintelligence_shared-readme.md&utm_term=51degrees-ip-intelligence-engines-shared "Data rewards the curious") **Python IP Intelligence**
40
+
41
+ [Developer Documentation](https://51degrees.com/ip-intelligence-python/index.html?utm_source=github&utm_medium=readme&utm_campaign=51degrees-python&utm_content=fiftyone_ipintelligence_shared-readme.md&utm_term=51degrees-ip-intelligence-engines-shared "developer documentation")
42
+
43
+ ## Introduction
44
+
45
+ This package contains shared code used by both the cloud and on-premise
46
+ variants of the 51Degrees IP intelligence engines for the
47
+ [51Degrees Pipeline API](https://51degrees.com/documentation/index.html?utm_source=github&utm_medium=readme&utm_campaign=51degrees-python&utm_content=fiftyone_ipintelligence_shared-readme.md&utm_term=introduction).
48
+
49
+ It is not intended to be used directly. See
50
+ [fiftyone_ipintelligence](https://pypi.org/project/fiftyone-ipintelligence/)
51
+ instead.
52
+
53
+ ## Folders
54
+
55
+ - `fiftyone_ipintelligence_shared` - contains evidence key constants, example
56
+ constants and utility functions shared by the IP intelligence packages.
57
+ - `tests` - unit tests.
58
+
59
+ ## Requirements
60
+
61
+ * Python 3.8+
62
+ * The `fiftyone_pipeline_core`, `fiftyone_pipeline_engines`,
63
+ `fiftyone_pipeline_cloudrequestengine` and
64
+ `fiftyone_pipeline_engines_fiftyone` packages
@@ -0,0 +1,9 @@
1
+ fiftyone_ipintelligence_shared/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ fiftyone_ipintelligence_shared/constants.py,sha256=u4o8CmtuC0UB3nQrW5gb5GnLzEZamX0ctUWnAJvrZNA,2336
3
+ fiftyone_ipintelligence_shared/example_constants.py,sha256=HFC8iMfiZFhZozKBoUqRCU66wC6VElVUQpymW4D6Zsw,2537
4
+ fiftyone_ipintelligence_shared/key_utils.py,sha256=AH2-Vp2Pgrc5oHqnCsySuG-2g-HCoAlSOTN1vT4UAfo,1449
5
+ fiftyone_ipintelligence_shared/utils.py,sha256=-gRgrU9zXOlSZ88wrWcCx7G4p80ZpTiwYgO0Fz20c5U,1929
6
+ fiftyone_ipintelligence_shared-4.5.0.dist-info/METADATA,sha256=FX4jKGxENv4bFPe4yD4lcik6DFqk2ksELKWjQaTOzhQ,3002
7
+ fiftyone_ipintelligence_shared-4.5.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
8
+ fiftyone_ipintelligence_shared-4.5.0.dist-info/top_level.txt,sha256=AAD-7d6OKL79p_YM0El2hu25QS8whv-pvPs0XuG7cAE,31
9
+ fiftyone_ipintelligence_shared-4.5.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ fiftyone_ipintelligence_shared