biocontext_kb.utils#

Functions#

execute_graphql_query(endpoint_url, query_string[, ...])

Make a generic GraphQL API call.

fetch_graphql_schema(endpoint_url)

Fetch the GraphQL schema from the given endpoint URL.

slugify(name)

Slugify a name by replacing spaces with underscores and converting to lowercase.

Package Contents#

biocontext_kb.utils.execute_graphql_query(endpoint_url, query_string, variables=None, headers=None)[source]#

Make a generic GraphQL API call.

Parameters:
  • endpoint_url (str) – The GraphQL endpoint URL

  • query_string (str) – The GraphQL query or mutation as a string

  • variables (dict, optional) – Variables for the GraphQL query

  • headers (dict, optional) – HTTP headers to include

Returns:

The response data from the GraphQL API

Return type:

dict

biocontext_kb.utils.fetch_graphql_schema(endpoint_url)[source]#

Fetch the GraphQL schema from the given endpoint URL.

Parameters:

endpoint_url (str) – The GraphQL endpoint URL.

Returns:

The fetched GraphQL schema.

Return type:

GraphQLSchema

biocontext_kb.utils.slugify(name)[source]#

Slugify a name by replacing spaces with underscores and converting to lowercase.

Allow only alphanumeric characters and underscores.

Parameters:

name (str)

Return type:

str