Client

The Client module serves as the entrypoint for all our interactions with the external LinkSight API. The main usage pattern requires us to instantiate a client, then use that to handle all requests to LinkSight.

Most of the return values are in the form of a linksight.resource, which inherits a dictionary type.

Note

Needless to say, interacting with the LinkSight API requires an internet connection.

class linksight.client.Client(token)[source]

Bases: requests.sessions.Session

An object for handling all requests

create_dataset(data)[source]

Create a dataset from a given file

In order to create a dataset, simply create a context from the given CSV file and pass it to this method:

from linksight import Client

API_TOKEN = <Insert your API_TOKEN here>

ls = Client(API_TOKEN)
with open('path/to/query/file.csv') as f:
    dataset = ls.create_dataset(f)
Parameters:data (_io.TextIOWrapper or pandas.DataFrame) – A file handler or a pandas DataFrame
Returns:The Dataset resource that can be used for matching
Return type:linksight.resource.resources.Dataset
get_user(id='me')[source]

Get the user creating the request

Parameters:id (str) – User ID initiating the request
Returns:The user information retrieved from the API
Return type:linksight.resource.resources.User