ensembledata 0.1.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.
@@ -0,0 +1,165 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110
+ .pdm.toml
111
+ .pdm-python
112
+ .pdm-build/
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ .venv
127
+ .venv*
128
+ env/
129
+ venv/
130
+ ENV/
131
+ env.bak/
132
+ venv.bak/
133
+
134
+ # Spyder project settings
135
+ .spyderproject
136
+ .spyproject
137
+
138
+ # Rope project settings
139
+ .ropeproject
140
+
141
+ # mkdocs documentation
142
+ /site
143
+
144
+ # mypy
145
+ .mypy_cache/
146
+ .dmypy.json
147
+ dmypy.json
148
+
149
+ # Pyre type checker
150
+ .pyre/
151
+
152
+ # pytype static type analyzer
153
+ .pytype/
154
+
155
+ # Cython debug symbols
156
+ cython_debug/
157
+
158
+ # PyCharm
159
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
160
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
161
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
162
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
163
+ #.idea/
164
+
165
+ .python-version
@@ -0,0 +1,9 @@
1
+ The MIT Licence
2
+
3
+ Copyright (c) 2024 EnsembleData
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,155 @@
1
+ Metadata-Version: 2.1
2
+ Name: ensembledata
3
+ Version: 0.1.0
4
+ Summary: Python bindings for the EnsembleData API
5
+ Author-email: EnsembleData <hello@ensembledata.com>, Fayd Speare <fayd@ensembledata.com>
6
+ License: LICENCE
7
+ Project-URL: Homepage, https://ensembledata.com
8
+ Project-URL: Documenation, https://ensembledata.com/apis/docs
9
+ Project-URL: Repository, https://github.com/ensembledata/ensembledata-python
10
+ Keywords: ensembledata api,tiktok api,instagram api,youtube api,reddit api
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Typing :: Typed
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.7
19
+ Classifier: Programming Language :: Python :: 3.8
20
+ Classifier: Programming Language :: Python :: 3.9
21
+ Classifier: Programming Language :: Python :: 3.10
22
+ Classifier: Programming Language :: Python :: 3.11
23
+ Classifier: Programming Language :: Python :: 3.12
24
+ Requires-Python: >=3.7
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENCE
27
+ Requires-Dist: httpx
28
+ Requires-Dist: typing-extensions; python_version == "3.7"
29
+
30
+ # EnsembleData Python API
31
+
32
+ [![pypi](https://img.shields.io/pypi/v/ensembledata-python?color=%2334D058&label=pypi%20package)](https://pypi.org/project/ensembledata-python/)
33
+
34
+ ## Documentation
35
+
36
+ Check out the [API docs](https://ensembledata.com/apis/docs) to see which endpoints are available for each social media and for detailed descriptions of their parameters and functionality.
37
+
38
+ ## Installation
39
+
40
+ Install the package with pip as you would any other python package.
41
+
42
+ ```bash
43
+ pip install ensembledata-python
44
+ ```
45
+
46
+ ### Requirements
47
+
48
+ - The package only supports Python 3.7 and above.
49
+
50
+ ## Usage
51
+
52
+ [Register](https://dashboard.ensembledata.com/register) to get your free API token.
53
+
54
+ ```python
55
+ from ensembledata.api import EDClient
56
+
57
+
58
+ client = EDClient("API-TOKEN")
59
+ result = client.tiktok.user_info_from_username("daviddobrik")
60
+
61
+ print("Data: ", result.data)
62
+ print("Units charged:", result.units_charged)
63
+
64
+ # Other Examples:
65
+ #
66
+ # result = client.instagram.user_info(username="daviddobrik")
67
+ # result = client.youtube.channel_subscribers(channel_id="UCnQghMm3Z164JFhScQYFTBw")
68
+ ```
69
+
70
+ #### TikTok Usage Docs
71
+ Explore the extensive [usage documentation for the TikTok API](https://github.com/ensembledata/tiktok-scraper).
72
+
73
+ #### Instagram Usage Docs
74
+ Explore the extensive [usage documentation for the Instagram API](https://github.com/ensembledata/instagram-scraper).
75
+
76
+ #### Youtube Usage Docs
77
+ Explore more extensive [usage documentation for the Youtube API](https://github.com/ensembledata/youtube-scraper).
78
+
79
+
80
+ &nbsp;
81
+
82
+ ### Missing Endpoints / Parameters
83
+
84
+ If you find that one of the endpoints from our [API docs](https://ensembledata.com/apis/docs) is not yet available in this package, you can use the `EDClient.request` method to specify the endpoint manually in the meantime.
85
+
86
+ ```python
87
+ from ensembledata.api import EDClient
88
+
89
+ client = EDClient("API-TOKEN")
90
+ result = client.request("/instagram/[example]", params={"foo": "...", "bar": "..."})
91
+ ```
92
+
93
+ If you find that one the parameters to an existing endpoint is missing, you can still send this parameter via the `extra_params` dictionary which is available on all endpoint methods. See the example below:
94
+ ```python
95
+ from ensembledata.api import EDClient
96
+
97
+ client = EDClient("API-TOKEN")
98
+ result = client.instagram.user_info(username="...", extra_params={"baz": "..."})
99
+ ```
100
+
101
+ &nbsp;
102
+
103
+ ### Handling Errors
104
+
105
+ In the [API docs](https://ensembledata.com/apis/docs), each endpoint lists a handful of possible errors the API may respond with. You can handle these errors by catching the `EDError` exception.
106
+
107
+ ```python
108
+ from ensembledata.api import EDClient, EDError
109
+
110
+
111
+ client = EDClient("API-TOKEN")
112
+ try:
113
+ result = client.tiktok.user_info_from_username("daviddobrik")
114
+ except EDError as e:
115
+
116
+ # Rate limit exceeded...
117
+ if e.status_code == 429:
118
+ print(e.detail)
119
+
120
+ # Subscription expired...
121
+ if e.status_code == 493:
122
+ print(e.detail)
123
+
124
+ except Exception as e:
125
+ # Some other error occurred, unrelated to the EnsembleData API
126
+ # E.g. httpx.RequestError, json.JSONDecodeError
127
+ pass
128
+
129
+
130
+ ```
131
+
132
+ &nbsp;
133
+
134
+
135
+ ### Async
136
+
137
+ This package provides an asynchronous client, `EDAsyncClient`, which will give you access to async versions of all the same methods that can be found on the `EDClient`.
138
+
139
+ ```python
140
+ import asyncio
141
+
142
+ from ensembledata.api import EDAsyncClient
143
+
144
+
145
+ async def main():
146
+ client = EDAsyncClient("API-TOKEN")
147
+ result = await client.tiktok.user_info_from_username("daviddobrik")
148
+
149
+ if __name__ == "__main__":
150
+ asyncio.run(main())
151
+ ```
152
+
153
+ ### Types
154
+
155
+ The package uses type hints, and is type checked with the latest version of `mypy`. If you experience any type checking related issues with the package, please let us know by creating an issue.
@@ -0,0 +1,126 @@
1
+ # EnsembleData Python API
2
+
3
+ [![pypi](https://img.shields.io/pypi/v/ensembledata-python?color=%2334D058&label=pypi%20package)](https://pypi.org/project/ensembledata-python/)
4
+
5
+ ## Documentation
6
+
7
+ Check out the [API docs](https://ensembledata.com/apis/docs) to see which endpoints are available for each social media and for detailed descriptions of their parameters and functionality.
8
+
9
+ ## Installation
10
+
11
+ Install the package with pip as you would any other python package.
12
+
13
+ ```bash
14
+ pip install ensembledata-python
15
+ ```
16
+
17
+ ### Requirements
18
+
19
+ - The package only supports Python 3.7 and above.
20
+
21
+ ## Usage
22
+
23
+ [Register](https://dashboard.ensembledata.com/register) to get your free API token.
24
+
25
+ ```python
26
+ from ensembledata.api import EDClient
27
+
28
+
29
+ client = EDClient("API-TOKEN")
30
+ result = client.tiktok.user_info_from_username("daviddobrik")
31
+
32
+ print("Data: ", result.data)
33
+ print("Units charged:", result.units_charged)
34
+
35
+ # Other Examples:
36
+ #
37
+ # result = client.instagram.user_info(username="daviddobrik")
38
+ # result = client.youtube.channel_subscribers(channel_id="UCnQghMm3Z164JFhScQYFTBw")
39
+ ```
40
+
41
+ #### TikTok Usage Docs
42
+ Explore the extensive [usage documentation for the TikTok API](https://github.com/ensembledata/tiktok-scraper).
43
+
44
+ #### Instagram Usage Docs
45
+ Explore the extensive [usage documentation for the Instagram API](https://github.com/ensembledata/instagram-scraper).
46
+
47
+ #### Youtube Usage Docs
48
+ Explore more extensive [usage documentation for the Youtube API](https://github.com/ensembledata/youtube-scraper).
49
+
50
+
51
+ &nbsp;
52
+
53
+ ### Missing Endpoints / Parameters
54
+
55
+ If you find that one of the endpoints from our [API docs](https://ensembledata.com/apis/docs) is not yet available in this package, you can use the `EDClient.request` method to specify the endpoint manually in the meantime.
56
+
57
+ ```python
58
+ from ensembledata.api import EDClient
59
+
60
+ client = EDClient("API-TOKEN")
61
+ result = client.request("/instagram/[example]", params={"foo": "...", "bar": "..."})
62
+ ```
63
+
64
+ If you find that one the parameters to an existing endpoint is missing, you can still send this parameter via the `extra_params` dictionary which is available on all endpoint methods. See the example below:
65
+ ```python
66
+ from ensembledata.api import EDClient
67
+
68
+ client = EDClient("API-TOKEN")
69
+ result = client.instagram.user_info(username="...", extra_params={"baz": "..."})
70
+ ```
71
+
72
+ &nbsp;
73
+
74
+ ### Handling Errors
75
+
76
+ In the [API docs](https://ensembledata.com/apis/docs), each endpoint lists a handful of possible errors the API may respond with. You can handle these errors by catching the `EDError` exception.
77
+
78
+ ```python
79
+ from ensembledata.api import EDClient, EDError
80
+
81
+
82
+ client = EDClient("API-TOKEN")
83
+ try:
84
+ result = client.tiktok.user_info_from_username("daviddobrik")
85
+ except EDError as e:
86
+
87
+ # Rate limit exceeded...
88
+ if e.status_code == 429:
89
+ print(e.detail)
90
+
91
+ # Subscription expired...
92
+ if e.status_code == 493:
93
+ print(e.detail)
94
+
95
+ except Exception as e:
96
+ # Some other error occurred, unrelated to the EnsembleData API
97
+ # E.g. httpx.RequestError, json.JSONDecodeError
98
+ pass
99
+
100
+
101
+ ```
102
+
103
+ &nbsp;
104
+
105
+
106
+ ### Async
107
+
108
+ This package provides an asynchronous client, `EDAsyncClient`, which will give you access to async versions of all the same methods that can be found on the `EDClient`.
109
+
110
+ ```python
111
+ import asyncio
112
+
113
+ from ensembledata.api import EDAsyncClient
114
+
115
+
116
+ async def main():
117
+ client = EDAsyncClient("API-TOKEN")
118
+ result = await client.tiktok.user_info_from_username("daviddobrik")
119
+
120
+ if __name__ == "__main__":
121
+ asyncio.run(main())
122
+ ```
123
+
124
+ ### Types
125
+
126
+ The package uses type hints, and is type checked with the latest version of `mypy`. If you experience any type checking related issues with the package, please let us know by creating an issue.
@@ -0,0 +1,6 @@
1
+ from ._async_client import EDAsyncClient
2
+ from ._client import EDClient
3
+ from ._errors import EDError
4
+ from ._response import EDResponse
5
+
6
+ __all__ = ["EDClient", "EDAsyncClient", "EDResponse", "EDError"]