Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ensembledata-python

Package Overview
Dependencies
Maintainers
0
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ensembledata-python

Python bindings for the EnsembleData API

  • 0.1.0
  • PyPI
  • Socket score

Maintainers
0

EnsembleData Python API

Documentation

Check out the API docs to see which endpoints are available for each social media and for detailed descriptions of their parameters and functionality.

Installation

Install the package with pip as you would any other python package.

pip install ensembledata-python

Requirements

  • The package only supports Python 3.7 and above.

Usage

Register to get your free API token.

from ensembledata.api import EDClient


client = EDClient("API-TOKEN")
result = client.tiktok.user_info_from_username("daviddobrik")

print("Data: ", result.data)
print("Units charged:", result.units_charged)

# Other Examples:
#
# result = client.instagram.user_info(username="daviddobrik")
# result = client.youtube.channel_subscribers(channel_id="UCnQghMm3Z164JFhScQYFTBw")
TikTok Usage Docs

Explore the extensive usage documentation for the TikTok API.

Instagram Usage Docs

Explore the extensive usage documentation for the Instagram API.

Youtube Usage Docs

Explore more extensive usage documentation for the Youtube API.

 

Missing Endpoints / Parameters

If you find that one of the endpoints from our API docs is not yet available in this package, you can use the EDClient.request method to specify the endpoint manually in the meantime.

from ensembledata.api import EDClient

client = EDClient("API-TOKEN")
result = client.request("/instagram/[example]", params={"foo": "...", "bar": "..."})

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:

from ensembledata.api import EDClient

client = EDClient("API-TOKEN")
result = client.instagram.user_info(username="...", extra_params={"baz": "..."})

 

Handling Errors

In the API docs, each endpoint lists a handful of possible errors the API may respond with. You can handle these errors by catching the EDError exception.

from ensembledata.api import EDClient, EDError


client = EDClient("API-TOKEN")
try:
    result = client.tiktok.user_info_from_username("daviddobrik")
except EDError as e:

    # Rate limit exceeded...
    if e.status_code == 429:
        print(e.detail)

    # Subscription expired...
    if e.status_code == 493:
        print(e.detail)

except Exception as e:
    # Some other error occurred, unrelated to the EnsembleData API
    # E.g. httpx.RequestError, json.JSONDecodeError
    pass

    

 

Async

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.

import asyncio

from ensembledata.api import EDAsyncClient


async def main():
    client = EDAsyncClient("API-TOKEN")
    result = await client.tiktok.user_info_from_username("daviddobrik")

if __name__ == "__main__":
    asyncio.run(main())

Types

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.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc