sortinghat.cli.client package

Submodules

sortinghat.cli.client.client module

class sortinghat.cli.client.client.SortingHatClient(host, port=9314, path=None, user=None, password=None, ssl=True)[source]

Bases: object

SortingHat client.

This client allows to run operations in the SortingHat server that listens in host and port.

After initializing an instance, call to connect to establish a communication with the server. The method execute allows to run queries and mutations defined by the server.

Parameters
  • host – host of the server

  • port – port number used in the connection

  • path – path to the API endpoint; by default the endpoint is in ‘/’

  • user – user name to use when authentication is required

  • password – password to use when authentication is required

  • ssl – use SSL/TSL connection; this is the default behaviour

Raises

ValueError – when any of the given parameters is invalid

connect()[source]

Establish a connection to the server.

disconnect()[source]

Disconnect the client from the server.

execute(operation)[source]

Execute operations in the server.

This method allows to run GraphQL operations: queries and mutations. To run an operation, use sgqlc.operation.Operation object and a valid SortingHat schema.

Parameters

operation – GraphQL operation to execute

Returns

a dict that maps the JSON result returned by the server

Raises

SortingHatClient – raised when either the client is not connected or when an error is returned while running the operation

exception sortinghat.cli.client.client.SortingHatClientError(msg, errors=None)[source]

Bases: Exception

SortingHat client error.

Generic exception raised by the client when an error is found either with connection problems or with GraphQL queries.

Parameters
  • msg – message error

  • errors – list of GraphQL errors; None when the error is not related to GraphQL queries

sortinghat.cli.client.schema module

SortingHat client schema.

Automatically generated using sgqlc tools.

class sortinghat.cli.client.schema.AddDomain(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.AddIdentity(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.AddOrganization(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.Affiliate(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.AffiliationRecommendationType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.AffiliationResultType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.CountryFilterType(_json_obj=None, _selection_list=None, **kwargs)[source]

Bases: sgqlc.types.Input

class sortinghat.cli.client.schema.CountryPaginatedType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.CountryType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.DeleteDomain(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.DeleteIdentity(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.DeleteOrganization(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.DomainType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.Enroll(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.EnrollmentType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.GenericScalar(json_data, selection_list=None)[source]

Bases: sgqlc.types.Scalar

class sortinghat.cli.client.schema.IdentityFilterType(_json_obj=None, _selection_list=None, **kwargs)[source]

Bases: sgqlc.types.Input

class sortinghat.cli.client.schema.IdentityPaginatedType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.IdentityType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.IndividualType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.JobPaginatedType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.JobResultType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Union

class sortinghat.cli.client.schema.JobType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.Lock(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.MatchesRecommendationType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.Merge(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.MoveIdentity(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.ObtainJSONWebToken(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.OperationArgsType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Scalar

class sortinghat.cli.client.schema.OperationFilterType(_json_obj=None, _selection_list=None, **kwargs)[source]

Bases: sgqlc.types.Input

class sortinghat.cli.client.schema.OperationOpType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Enum

ADD = 'ADD'
DELETE = 'DELETE'
UPDATE = 'UPDATE'
class sortinghat.cli.client.schema.OperationPaginatedType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.OperationType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.OrganizationFilterType(_json_obj=None, _selection_list=None, **kwargs)[source]

Bases: sgqlc.types.Input

class sortinghat.cli.client.schema.OrganizationPaginatedType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.OrganizationType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.PaginationType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.ProfileInputType(_json_obj=None, _selection_list=None, **kwargs)[source]

Bases: sgqlc.types.Input

class sortinghat.cli.client.schema.ProfileType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.Query(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.RecommendAffiliations(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.RecommendMatches(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.Refresh(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.SortingHatMutation(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.TransactionFilterType(_json_obj=None, _selection_list=None, **kwargs)[source]

Bases: sgqlc.types.Input

class sortinghat.cli.client.schema.TransactionPaginatedType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.TransactionType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.Unify(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.UnifyResultType(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.Unlock(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.UnmergeIdentities(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.UpdateEnrollment(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.UpdateProfile(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.Verify(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

class sortinghat.cli.client.schema.Withdraw(json_data, selection_list=None)[source]

Bases: sgqlc.types.Type

Module contents

class sortinghat.cli.client.SortingHatClient(host, port=9314, path=None, user=None, password=None, ssl=True)[source]

Bases: object

SortingHat client.

This client allows to run operations in the SortingHat server that listens in host and port.

After initializing an instance, call to connect to establish a communication with the server. The method execute allows to run queries and mutations defined by the server.

Parameters
  • host – host of the server

  • port – port number used in the connection

  • path – path to the API endpoint; by default the endpoint is in ‘/’

  • user – user name to use when authentication is required

  • password – password to use when authentication is required

  • ssl – use SSL/TSL connection; this is the default behaviour

Raises

ValueError – when any of the given parameters is invalid

connect()[source]

Establish a connection to the server.

disconnect()[source]

Disconnect the client from the server.

execute(operation)[source]

Execute operations in the server.

This method allows to run GraphQL operations: queries and mutations. To run an operation, use sgqlc.operation.Operation object and a valid SortingHat schema.

Parameters

operation – GraphQL operation to execute

Returns

a dict that maps the JSON result returned by the server

Raises

SortingHatClient – raised when either the client is not connected or when an error is returned while running the operation

exception sortinghat.cli.client.SortingHatClientError(msg, errors=None)[source]

Bases: Exception

SortingHat client error.

Generic exception raised by the client when an error is found either with connection problems or with GraphQL queries.

Parameters
  • msg – message error

  • errors – list of GraphQL errors; None when the error is not related to GraphQL queries