rtbnext 1.0.0__tar.gz

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.
Files changed (37) hide show
  1. rtbnext-1.0.0/.gitignore +3 -0
  2. rtbnext-1.0.0/LICENSE +21 -0
  3. rtbnext-1.0.0/PKG-INFO +161 -0
  4. rtbnext-1.0.0/README.md +128 -0
  5. rtbnext-1.0.0/pyproject.toml +103 -0
  6. rtbnext-1.0.0/src/rtbnext/__init__.py +26 -0
  7. rtbnext-1.0.0/src/rtbnext/_version.py +7 -0
  8. rtbnext-1.0.0/src/rtbnext/core/cache.py +102 -0
  9. rtbnext-1.0.0/src/rtbnext/core/http_client.py +153 -0
  10. rtbnext-1.0.0/src/rtbnext/core/loader.py +173 -0
  11. rtbnext-1.0.0/src/rtbnext/core/parser.py +84 -0
  12. rtbnext-1.0.0/src/rtbnext/core/rate_limiter.py +86 -0
  13. rtbnext-1.0.0/src/rtbnext/defaults.py +26 -0
  14. rtbnext-1.0.0/src/rtbnext/endpoint/base.py +80 -0
  15. rtbnext-1.0.0/src/rtbnext/endpoint/filter.py +112 -0
  16. rtbnext-1.0.0/src/rtbnext/endpoint/list.py +85 -0
  17. rtbnext-1.0.0/src/rtbnext/endpoint/mover.py +33 -0
  18. rtbnext-1.0.0/src/rtbnext/endpoint/profile.py +158 -0
  19. rtbnext-1.0.0/src/rtbnext/endpoint/stats.py +156 -0
  20. rtbnext-1.0.0/src/rtbnext/endpoint/system.py +25 -0
  21. rtbnext-1.0.0/src/rtbnext/py.typed +0 -0
  22. rtbnext-1.0.0/src/rtbnext/resource/base.py +206 -0
  23. rtbnext-1.0.0/src/rtbnext/resource/collectable.py +201 -0
  24. rtbnext-1.0.0/src/rtbnext/resource/collection.py +313 -0
  25. rtbnext-1.0.0/src/rtbnext/resource/dateable.py +59 -0
  26. rtbnext-1.0.0/src/rtbnext/resource/indexable.py +91 -0
  27. rtbnext-1.0.0/src/rtbnext/resource/series.py +266 -0
  28. rtbnext-1.0.0/src/rtbnext/rtbnext.py +107 -0
  29. rtbnext-1.0.0/src/rtbnext/schema/assets.py +101 -0
  30. rtbnext-1.0.0/src/rtbnext/schema/filter.py +35 -0
  31. rtbnext-1.0.0/src/rtbnext/schema/generic.py +105 -0
  32. rtbnext-1.0.0/src/rtbnext/schema/list.py +64 -0
  33. rtbnext-1.0.0/src/rtbnext/schema/mover.py +40 -0
  34. rtbnext-1.0.0/src/rtbnext/schema/profile.py +137 -0
  35. rtbnext-1.0.0/src/rtbnext/schema/stats.py +133 -0
  36. rtbnext-1.0.0/src/rtbnext/schema/system.py +15 -0
  37. rtbnext-1.0.0/src/rtbnext/utils.py +36 -0
@@ -0,0 +1,3 @@
1
+ .venv/
2
+ __pycache__/
3
+ dist/
rtbnext-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 RTBNext by Paul Köhler (komed3)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
rtbnext-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,161 @@
1
+ Metadata-Version: 2.4
2
+ Name: rtbnext
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for the RTBNext API.
5
+ Project-URL: Homepage, https://rtbnext.de
6
+ Project-URL: Documentation, https://sdk.rtbnext.de
7
+ Project-URL: Repository, https://github.com/rtbnext/sdk-python
8
+ Project-URL: Bug Tracker, https://github.com/rtbnext/sdk-python/issues
9
+ Author-email: "Paul Köhler (komed3)" <webmaster@komed3.de>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: api,billionaires,rtbnext,sdk
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.12
24
+ Requires-Dist: httpx>=0.28
25
+ Provides-Extra: dev
26
+ Requires-Dist: build>=1.5; extra == 'dev'
27
+ Requires-Dist: hatchling>=1.27; extra == 'dev'
28
+ Requires-Dist: isort>=8.0; extra == 'dev'
29
+ Requires-Dist: pre-commit>=4.6; extra == 'dev'
30
+ Requires-Dist: pylint>=4.0; extra == 'dev'
31
+ Requires-Dist: twine>=7.0; extra == 'dev'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # rtbnext
35
+
36
+ **Official Python SDK for the RTBNext API.**
37
+
38
+ The RTBNext SDK provides a typed, asynchronous interface for accessing billionaire profiles, lists, filters, statistics, historical data and system information from the [RTBNext API](https://api.rtbnext.de).
39
+
40
+ The SDK follows a consistent resource-oriented design: resources are loaded lazily, cached according to the configured cache mode, and expose typed helper methods for collections, time series and indexed data.
41
+
42
+ The package includes Python type information and is compatible with static type checkers such as Pyright, Pylance and mypy.
43
+
44
+ To find a list of all available API endpoints, please refer to the [API Documentation](https://docs.rtbnext.de). Also visit the [API endpoint](https://api.rtbnext.de) or review the [SDK Documentation](https://sdk.rtbnext.de) for additional details. For updates on current issues or maintenance, please refer to the [System Status](https://status.rtbnext.de).
45
+
46
+ ## Installation
47
+
48
+ Install the package using pip:
49
+
50
+ ```bash
51
+ pip install rtbnext
52
+ ```
53
+
54
+ ## First usage
55
+
56
+ Every client application **must identify** itself when creating an SDK instance. This information is sent with API requests and helps to provide transparency about API consumers.
57
+
58
+ ```py
59
+ import asyncio
60
+
61
+ from rtbnext import ClientIdentity, rtbnext
62
+
63
+
64
+ async def main() -> None:
65
+ async with rtbnext(
66
+ client= ClientIdentity(
67
+ name= "my-application",
68
+ version= "1.0.0",
69
+ contact= "https://example.com/contact"
70
+ )
71
+ ) as client:
72
+
73
+ stats = await client.stats.global_.data()
74
+ print( stats["count"] )
75
+
76
+
77
+ asyncio.run( main() )
78
+ ```
79
+
80
+ The client identity consists of:
81
+
82
+ - `name` — application or project name
83
+ - `version` — application version
84
+ - `contact` — optional contact URL
85
+ - `email` — optional contact email address
86
+
87
+ ## Core concepts
88
+
89
+ ### Lazy resources
90
+
91
+ Resources are not downloaded when they are created. Data is loaded only when it is requested.
92
+
93
+ ```py
94
+ profile = client.profile.get( "bill-gates" )
95
+
96
+ # No request has been made yet.
97
+
98
+ data = await profile.meta.data()
99
+ ```
100
+
101
+ ### Collections
102
+
103
+ Collection resources provide filtering, searching, sorting and paging helpers.
104
+
105
+ ```py
106
+ profiles = await client.profile.index.collection()
107
+
108
+ for profile in profiles.search( "bill" ).order_by( "networth", descending= True ).take( 5 ):
109
+ print( item.raw["name"], item.raw["uri"] )
110
+ ```
111
+
112
+ ### Time series
113
+
114
+ Historical data can be accessed through typed time-series resources.
115
+
116
+ ```py
117
+ history = await client.profile.get( "bill-gates" ).history.series()
118
+ print( history.latest )
119
+ ```
120
+
121
+ Time series collections support date-based navigation and cursor operations:
122
+
123
+ ```py
124
+ history.seek( "2026-01-01" )
125
+
126
+ while ( point := history.next ) is not None:
127
+ print( point["date"], point["networth"] )
128
+ ```
129
+
130
+ ## Cache behavior
131
+
132
+ The SDK includes a configurable resource cache layer that follows HTTP cache semantics. Resources are cached according to the selected cache mode and server-provided cache headers.
133
+
134
+ Supported cache modes:
135
+
136
+ - `ttl` — uses the server-defined cache lifetime (`Cache-Control`)
137
+ - `revalidate` — performs conditional requests using validators such as `ETag` and `Last-Modified`
138
+ - `session` — keeps resources during the lifetime of the SDK instance
139
+
140
+ The SDK does not bypass HTTP cache validation. Expired resources are refreshed according to the configured mode to prevent serving outdated data indefinitely.
141
+
142
+ A custom cache implementation can be provided by implementing the `Cache` protocol. This allows applications to integrate their own storage solutions, such as databases, filesystem caches or distributed cache systems.
143
+
144
+ The cache interface requires the following operations:
145
+
146
+ - retrieve a cached resource state
147
+ - store a resource state
148
+ - delete a resource
149
+ - clear the cache
150
+ - report the current cache size
151
+
152
+ ## Requirements
153
+
154
+ - Python 3.12+
155
+ - httpx 0.28+
156
+
157
+ ## License
158
+
159
+ **Copyright © 2026 RTBNext**
160
+ Created and maintained by [Paul Köhler](https://komed3.de) (komed3).
161
+ Licensed under the [MIT License](./LICENSE).
@@ -0,0 +1,128 @@
1
+ # rtbnext
2
+
3
+ **Official Python SDK for the RTBNext API.**
4
+
5
+ The RTBNext SDK provides a typed, asynchronous interface for accessing billionaire profiles, lists, filters, statistics, historical data and system information from the [RTBNext API](https://api.rtbnext.de).
6
+
7
+ The SDK follows a consistent resource-oriented design: resources are loaded lazily, cached according to the configured cache mode, and expose typed helper methods for collections, time series and indexed data.
8
+
9
+ The package includes Python type information and is compatible with static type checkers such as Pyright, Pylance and mypy.
10
+
11
+ To find a list of all available API endpoints, please refer to the [API Documentation](https://docs.rtbnext.de). Also visit the [API endpoint](https://api.rtbnext.de) or review the [SDK Documentation](https://sdk.rtbnext.de) for additional details. For updates on current issues or maintenance, please refer to the [System Status](https://status.rtbnext.de).
12
+
13
+ ## Installation
14
+
15
+ Install the package using pip:
16
+
17
+ ```bash
18
+ pip install rtbnext
19
+ ```
20
+
21
+ ## First usage
22
+
23
+ Every client application **must identify** itself when creating an SDK instance. This information is sent with API requests and helps to provide transparency about API consumers.
24
+
25
+ ```py
26
+ import asyncio
27
+
28
+ from rtbnext import ClientIdentity, rtbnext
29
+
30
+
31
+ async def main() -> None:
32
+ async with rtbnext(
33
+ client= ClientIdentity(
34
+ name= "my-application",
35
+ version= "1.0.0",
36
+ contact= "https://example.com/contact"
37
+ )
38
+ ) as client:
39
+
40
+ stats = await client.stats.global_.data()
41
+ print( stats["count"] )
42
+
43
+
44
+ asyncio.run( main() )
45
+ ```
46
+
47
+ The client identity consists of:
48
+
49
+ - `name` — application or project name
50
+ - `version` — application version
51
+ - `contact` — optional contact URL
52
+ - `email` — optional contact email address
53
+
54
+ ## Core concepts
55
+
56
+ ### Lazy resources
57
+
58
+ Resources are not downloaded when they are created. Data is loaded only when it is requested.
59
+
60
+ ```py
61
+ profile = client.profile.get( "bill-gates" )
62
+
63
+ # No request has been made yet.
64
+
65
+ data = await profile.meta.data()
66
+ ```
67
+
68
+ ### Collections
69
+
70
+ Collection resources provide filtering, searching, sorting and paging helpers.
71
+
72
+ ```py
73
+ profiles = await client.profile.index.collection()
74
+
75
+ for profile in profiles.search( "bill" ).order_by( "networth", descending= True ).take( 5 ):
76
+ print( item.raw["name"], item.raw["uri"] )
77
+ ```
78
+
79
+ ### Time series
80
+
81
+ Historical data can be accessed through typed time-series resources.
82
+
83
+ ```py
84
+ history = await client.profile.get( "bill-gates" ).history.series()
85
+ print( history.latest )
86
+ ```
87
+
88
+ Time series collections support date-based navigation and cursor operations:
89
+
90
+ ```py
91
+ history.seek( "2026-01-01" )
92
+
93
+ while ( point := history.next ) is not None:
94
+ print( point["date"], point["networth"] )
95
+ ```
96
+
97
+ ## Cache behavior
98
+
99
+ The SDK includes a configurable resource cache layer that follows HTTP cache semantics. Resources are cached according to the selected cache mode and server-provided cache headers.
100
+
101
+ Supported cache modes:
102
+
103
+ - `ttl` — uses the server-defined cache lifetime (`Cache-Control`)
104
+ - `revalidate` — performs conditional requests using validators such as `ETag` and `Last-Modified`
105
+ - `session` — keeps resources during the lifetime of the SDK instance
106
+
107
+ The SDK does not bypass HTTP cache validation. Expired resources are refreshed according to the configured mode to prevent serving outdated data indefinitely.
108
+
109
+ A custom cache implementation can be provided by implementing the `Cache` protocol. This allows applications to integrate their own storage solutions, such as databases, filesystem caches or distributed cache systems.
110
+
111
+ The cache interface requires the following operations:
112
+
113
+ - retrieve a cached resource state
114
+ - store a resource state
115
+ - delete a resource
116
+ - clear the cache
117
+ - report the current cache size
118
+
119
+ ## Requirements
120
+
121
+ - Python 3.12+
122
+ - httpx 0.28+
123
+
124
+ ## License
125
+
126
+ **Copyright © 2026 RTBNext**
127
+ Created and maintained by [Paul Köhler](https://komed3.de) (komed3).
128
+ Licensed under the [MIT License](./LICENSE).
@@ -0,0 +1,103 @@
1
+ [build-system]
2
+ build-backend = "hatchling.build"
3
+ requires = [
4
+ "hatchling >= 1.27"
5
+ ]
6
+
7
+ [project]
8
+ name = "rtbnext"
9
+ version = "1.0.0"
10
+ description = "Official Python SDK for the RTBNext API."
11
+ readme = "README.md"
12
+ license = "MIT"
13
+ requires-python = ">= 3.12"
14
+
15
+ authors = [
16
+ { name = "Paul Köhler (komed3)", email = "webmaster@komed3.de" }
17
+ ]
18
+
19
+ keywords = [
20
+ "rtbnext",
21
+ "billionaires",
22
+ "api",
23
+ "sdk"
24
+ ]
25
+
26
+ classifiers = [
27
+ "Development Status :: 5 - Production/Stable",
28
+ "Intended Audience :: Developers",
29
+ "License :: OSI Approved :: MIT License",
30
+ "Programming Language :: Python :: 3 :: Only",
31
+ "Programming Language :: Python :: 3",
32
+ "Programming Language :: Python :: 3.12",
33
+ "Programming Language :: Python :: 3.13",
34
+ "Programming Language :: Python :: 3.14",
35
+ "Operating System :: OS Independent",
36
+ "Typing :: Typed"
37
+ ]
38
+
39
+ dependencies = [
40
+ "httpx >= 0.28"
41
+ ]
42
+
43
+ [project.urls]
44
+ Homepage = "https://rtbnext.de"
45
+ Documentation = "https://sdk.rtbnext.de"
46
+ Repository = "https://github.com/rtbnext/sdk-python"
47
+ "Bug Tracker" = "https://github.com/rtbnext/sdk-python/issues"
48
+
49
+ [project.optional-dependencies]
50
+ dev = [
51
+ "build >= 1.5",
52
+ "hatchling >= 1.27",
53
+ "twine >= 7.0",
54
+ "pylint >= 4.0",
55
+ "isort >= 8.0",
56
+ "pre-commit >= 4.6"
57
+ ]
58
+
59
+ [tool.hatch.build.targets.wheel]
60
+ packages = [
61
+ "src/rtbnext"
62
+ ]
63
+
64
+ [tool.hatch.build.targets.sdist]
65
+ include = [
66
+ "src/rtbnext",
67
+ "LICENSE",
68
+ "README.md"
69
+ ]
70
+
71
+ [tool.hatch.build.targets.wheel.force-include]
72
+ "src/rtbnext/py.typed" = "rtbnext/py.typed"
73
+
74
+ [tool.pylint]
75
+ ignore = [
76
+ "examples",
77
+ ".venv",
78
+ "node_modules",
79
+ "__pycache__"
80
+ ]
81
+
82
+ [tool.pylint.design]
83
+ min-public-methods = 0
84
+ max-attributes = 12
85
+ max-args = 12
86
+
87
+ [tool.pylint.messages_control]
88
+ disable = [
89
+ "duplicate-code",
90
+ "unnecessary-ellipsis"
91
+ ]
92
+
93
+ [tool.isort]
94
+ profile = "black"
95
+ multi_line_output = 5
96
+ include_trailing_comma = false
97
+ line_length = 100
98
+ skip = [
99
+ "examples",
100
+ ".venv",
101
+ "node_modules",
102
+ "__pycache__"
103
+ ]
@@ -0,0 +1,26 @@
1
+ """
2
+ RTBNext Python SDK
3
+
4
+ Official Python SDK for the RTBNext API.
5
+
6
+ Provides access to all RTBNext API endpoints, resources, and data models.
7
+ The SDK offers lazy loading, transparent caching, automatic revalidation,
8
+ and a resource-oriented API for working with lists, profiles, filters,
9
+ statistics, and time series data.
10
+
11
+ Author: Paul Köhler (komed3)
12
+ License: MIT
13
+ """
14
+
15
+ from rtbnext._version import __version__
16
+ from rtbnext.core.http_client import ClientIdentity
17
+ from rtbnext.core.loader import CacheMode, CacheType
18
+ from rtbnext.rtbnext import RTBNext, rtbnext
19
+
20
+ __all__ = [
21
+ "RTBNext",
22
+ "rtbnext",
23
+ "ClientIdentity",
24
+ "CacheType",
25
+ "CacheMode"
26
+ ]
@@ -0,0 +1,7 @@
1
+ """
2
+ Version
3
+
4
+ Declares the RTBNext Python SDK version.
5
+ """
6
+
7
+ __version__ = "1.0.0"
@@ -0,0 +1,102 @@
1
+ """
2
+ Cache
3
+
4
+ Implements a cache interface for storing and retrieving resource states.
5
+
6
+ The cache protocol can be used to implement different storage backends,
7
+ such as in-memory caches or external databases.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ from typing import TYPE_CHECKING, Protocol, runtime_checkable
13
+
14
+ if TYPE_CHECKING:
15
+ from rtbnext.core.loader import ResourceState
16
+
17
+
18
+ @runtime_checkable
19
+ class Cache( Protocol ):
20
+ """
21
+ Interface for cache implementations.
22
+
23
+ A cache stores and retrieves resource states using string keys.
24
+ Implementations may choose any storage backend, such as memory,
25
+ the filesystem or an external database.
26
+ """
27
+
28
+ @property
29
+ def size( self ) -> int:
30
+ """Returns the number of cached resource states."""
31
+ ...
32
+
33
+ async def get( self, key: str ) -> ResourceState | None:
34
+ """Retrieves a cached resource state."""
35
+ ...
36
+
37
+ async def set( self, key: str, value: ResourceState ) -> None:
38
+ """Stores a resource state."""
39
+ ...
40
+
41
+ async def delete( self, key: str ) -> None:
42
+ """Removes a resource state from the cache."""
43
+ ...
44
+
45
+ async def clear( self ) -> None:
46
+ """Removes all resource states from the cache."""
47
+ ...
48
+
49
+
50
+ class EmptyCache( Cache ):
51
+ """
52
+ Cache implementation that never stores any data.
53
+
54
+ All read operations return `None`, while write operations are ignored.
55
+ This implementation can be used to disable caching without changing the
56
+ SDK's cache interface.
57
+ """
58
+
59
+ @property
60
+ def size( self ) -> int:
61
+ return 0
62
+
63
+ async def get( self, _key: str ) -> ResourceState | None:
64
+ return None
65
+
66
+ async def set( self, _key: str, _value: ResourceState ) -> None:
67
+ pass
68
+
69
+ async def delete( self, _key: str ) -> None:
70
+ pass
71
+
72
+ async def clear( self ) -> None:
73
+ pass
74
+
75
+
76
+ class MemoryCache ( Cache ):
77
+ """
78
+ Simple in-memory cache backed by a dictionary.
79
+
80
+ Suitable for short-lived applications where persistence is not required.
81
+ Cached entries remain until they are explicitly removed or the cache is
82
+ cleared.
83
+ """
84
+
85
+ def __init__( self ) -> None:
86
+ self._store: dict[ str, ResourceState ] = {}
87
+
88
+ @property
89
+ def size( self ) -> int:
90
+ return len( self._store )
91
+
92
+ async def get( self, key: str ) -> ResourceState | None:
93
+ return self._store.get( key )
94
+
95
+ async def set( self, key: str, value: ResourceState ) -> None:
96
+ self._store[ key ] = value
97
+
98
+ async def delete( self, key: str ) -> None:
99
+ self._store.pop( key, None )
100
+
101
+ async def clear( self ) -> None:
102
+ self._store.clear()