repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
joestump/django-ajax | ajax/decorators.py | json_response | def json_response(f, *args, **kwargs):
"""Wrap a view in JSON.
This decorator runs the given function and looks out for ajax.AJAXError's,
which it encodes into a proper HttpResponse object. If an unknown error
is thrown it's encoded as a 500.
All errors are then packaged up with an appropriate Con... | python | def json_response(f, *args, **kwargs):
"""Wrap a view in JSON.
This decorator runs the given function and looks out for ajax.AJAXError's,
which it encodes into a proper HttpResponse object. If an unknown error
is thrown it's encoded as a 500.
All errors are then packaged up with an appropriate Con... | [
"def",
"json_response",
"(",
"f",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"result",
"=",
"f",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"if",
"isinstance",
"(",
"result",
",",
"AJAXError",
")",
":",
"raise",
"result... | Wrap a view in JSON.
This decorator runs the given function and looks out for ajax.AJAXError's,
which it encodes into a proper HttpResponse object. If an unknown error
is thrown it's encoded as a 500.
All errors are then packaged up with an appropriate Content-Type and a JSON
body that you can ins... | [
"Wrap",
"a",
"view",
"in",
"JSON",
"."
] | b71619d5c00d8e0bb990ddbea2c93cf303dc2c80 | https://github.com/joestump/django-ajax/blob/b71619d5c00d8e0bb990ddbea2c93cf303dc2c80/ajax/decorators.py#L43-L100 | train |
joestump/django-ajax | ajax/utils.py | import_by_path | def import_by_path(dotted_path, error_prefix=''):
"""
Import a dotted module path and return the attribute/class designated by
the last name in the path. Raise ImproperlyConfigured if something goes
wrong. This has come straight from Django 1.6
"""
try:
module_path, class_name = dotted_p... | python | def import_by_path(dotted_path, error_prefix=''):
"""
Import a dotted module path and return the attribute/class designated by
the last name in the path. Raise ImproperlyConfigured if something goes
wrong. This has come straight from Django 1.6
"""
try:
module_path, class_name = dotted_p... | [
"def",
"import_by_path",
"(",
"dotted_path",
",",
"error_prefix",
"=",
"''",
")",
":",
"try",
":",
"module_path",
",",
"class_name",
"=",
"dotted_path",
".",
"rsplit",
"(",
"'.'",
",",
"1",
")",
"except",
"ValueError",
":",
"raise",
"ImproperlyConfigured",
"... | Import a dotted module path and return the attribute/class designated by
the last name in the path. Raise ImproperlyConfigured if something goes
wrong. This has come straight from Django 1.6 | [
"Import",
"a",
"dotted",
"module",
"path",
"and",
"return",
"the",
"attribute",
"/",
"class",
"designated",
"by",
"the",
"last",
"name",
"in",
"the",
"path",
".",
"Raise",
"ImproperlyConfigured",
"if",
"something",
"goes",
"wrong",
".",
"This",
"has",
"come"... | b71619d5c00d8e0bb990ddbea2c93cf303dc2c80 | https://github.com/joestump/django-ajax/blob/b71619d5c00d8e0bb990ddbea2c93cf303dc2c80/ajax/utils.py#L8-L32 | train |
joestump/django-ajax | ajax/views.py | endpoint_loader | def endpoint_loader(request, application, model, **kwargs):
"""Load an AJAX endpoint.
This will load either an ad-hoc endpoint or it will load up a model
endpoint depending on what it finds. It first attempts to load ``model``
as if it were an ad-hoc endpoint. Alternatively, it will attempt to see if
... | python | def endpoint_loader(request, application, model, **kwargs):
"""Load an AJAX endpoint.
This will load either an ad-hoc endpoint or it will load up a model
endpoint depending on what it finds. It first attempts to load ``model``
as if it were an ad-hoc endpoint. Alternatively, it will attempt to see if
... | [
"def",
"endpoint_loader",
"(",
"request",
",",
"application",
",",
"model",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"request",
".",
"method",
"!=",
"\"POST\"",
":",
"raise",
"AJAXError",
"(",
"400",
",",
"_",
"(",
"'Invalid HTTP method used.'",
")",
")",
... | Load an AJAX endpoint.
This will load either an ad-hoc endpoint or it will load up a model
endpoint depending on what it finds. It first attempts to load ``model``
as if it were an ad-hoc endpoint. Alternatively, it will attempt to see if
there is a ``ModelEndpoint`` for the given ``model``. | [
"Load",
"an",
"AJAX",
"endpoint",
"."
] | b71619d5c00d8e0bb990ddbea2c93cf303dc2c80 | https://github.com/joestump/django-ajax/blob/b71619d5c00d8e0bb990ddbea2c93cf303dc2c80/ajax/views.py#L32-L92 | train |
joestump/django-ajax | ajax/endpoints.py | ModelEndpoint.list | def list(self, request):
"""
List objects of a model. By default will show page 1 with 20 objects on it.
**Usage**::
params = {"items_per_page":10,"page":2} //all params are optional
$.post("/ajax/{app}/{model}/list.json"),params)
"""
max_items_per_pag... | python | def list(self, request):
"""
List objects of a model. By default will show page 1 with 20 objects on it.
**Usage**::
params = {"items_per_page":10,"page":2} //all params are optional
$.post("/ajax/{app}/{model}/list.json"),params)
"""
max_items_per_pag... | [
"def",
"list",
"(",
"self",
",",
"request",
")",
":",
"max_items_per_page",
"=",
"getattr",
"(",
"self",
",",
"'max_per_page'",
",",
"getattr",
"(",
"settings",
",",
"'AJAX_MAX_PER_PAGE'",
",",
"100",
")",
")",
"requested_items_per_page",
"=",
"request",
".",
... | List objects of a model. By default will show page 1 with 20 objects on it.
**Usage**::
params = {"items_per_page":10,"page":2} //all params are optional
$.post("/ajax/{app}/{model}/list.json"),params) | [
"List",
"objects",
"of",
"a",
"model",
".",
"By",
"default",
"will",
"show",
"page",
"1",
"with",
"20",
"objects",
"on",
"it",
"."
] | b71619d5c00d8e0bb990ddbea2c93cf303dc2c80 | https://github.com/joestump/django-ajax/blob/b71619d5c00d8e0bb990ddbea2c93cf303dc2c80/ajax/endpoints.py#L84-L118 | train |
joestump/django-ajax | ajax/endpoints.py | ModelEndpoint._extract_data | def _extract_data(self, request):
"""Extract data from POST.
Handles extracting a vanilla Python dict of values that are present
in the given model. This also handles instances of ``ForeignKey`` and
will convert those to the appropriate object instances from the
database. In oth... | python | def _extract_data(self, request):
"""Extract data from POST.
Handles extracting a vanilla Python dict of values that are present
in the given model. This also handles instances of ``ForeignKey`` and
will convert those to the appropriate object instances from the
database. In oth... | [
"def",
"_extract_data",
"(",
"self",
",",
"request",
")",
":",
"data",
"=",
"{",
"}",
"for",
"field",
",",
"val",
"in",
"six",
".",
"iteritems",
"(",
"request",
".",
"POST",
")",
":",
"if",
"field",
"in",
"self",
".",
"immutable_fields",
":",
"contin... | Extract data from POST.
Handles extracting a vanilla Python dict of values that are present
in the given model. This also handles instances of ``ForeignKey`` and
will convert those to the appropriate object instances from the
database. In other words, it will see that user is a ``Foreig... | [
"Extract",
"data",
"from",
"POST",
"."
] | b71619d5c00d8e0bb990ddbea2c93cf303dc2c80 | https://github.com/joestump/django-ajax/blob/b71619d5c00d8e0bb990ddbea2c93cf303dc2c80/ajax/endpoints.py#L202-L229 | train |
joestump/django-ajax | ajax/endpoints.py | ModelEndpoint._extract_value | def _extract_value(self, value):
"""If the value is true/false/null replace with Python equivalent."""
return ModelEndpoint._value_map.get(smart_str(value).lower(), value) | python | def _extract_value(self, value):
"""If the value is true/false/null replace with Python equivalent."""
return ModelEndpoint._value_map.get(smart_str(value).lower(), value) | [
"def",
"_extract_value",
"(",
"self",
",",
"value",
")",
":",
"return",
"ModelEndpoint",
".",
"_value_map",
".",
"get",
"(",
"smart_str",
"(",
"value",
")",
".",
"lower",
"(",
")",
",",
"value",
")"
] | If the value is true/false/null replace with Python equivalent. | [
"If",
"the",
"value",
"is",
"true",
"/",
"false",
"/",
"null",
"replace",
"with",
"Python",
"equivalent",
"."
] | b71619d5c00d8e0bb990ddbea2c93cf303dc2c80 | https://github.com/joestump/django-ajax/blob/b71619d5c00d8e0bb990ddbea2c93cf303dc2c80/ajax/endpoints.py#L231-L233 | train |
joestump/django-ajax | ajax/endpoints.py | ModelEndpoint._get_record | def _get_record(self):
"""Fetch a given record.
Handles fetching a record from the database along with throwing an
appropriate instance of ``AJAXError`.
"""
if not self.pk:
raise AJAXError(400, _('Invalid request for record.'))
try:
return self.m... | python | def _get_record(self):
"""Fetch a given record.
Handles fetching a record from the database along with throwing an
appropriate instance of ``AJAXError`.
"""
if not self.pk:
raise AJAXError(400, _('Invalid request for record.'))
try:
return self.m... | [
"def",
"_get_record",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"pk",
":",
"raise",
"AJAXError",
"(",
"400",
",",
"_",
"(",
"'Invalid request for record.'",
")",
")",
"try",
":",
"return",
"self",
".",
"model",
".",
"objects",
".",
"get",
"(",
... | Fetch a given record.
Handles fetching a record from the database along with throwing an
appropriate instance of ``AJAXError`. | [
"Fetch",
"a",
"given",
"record",
"."
] | b71619d5c00d8e0bb990ddbea2c93cf303dc2c80 | https://github.com/joestump/django-ajax/blob/b71619d5c00d8e0bb990ddbea2c93cf303dc2c80/ajax/endpoints.py#L235-L248 | train |
joestump/django-ajax | ajax/endpoints.py | ModelEndpoint.authenticate | def authenticate(self, request, application, method):
"""Authenticate the AJAX request.
By default any request to fetch a model is allowed for any user,
including anonymous users. All other methods minimally require that
the user is already logged in.
Most likely you will want ... | python | def authenticate(self, request, application, method):
"""Authenticate the AJAX request.
By default any request to fetch a model is allowed for any user,
including anonymous users. All other methods minimally require that
the user is already logged in.
Most likely you will want ... | [
"def",
"authenticate",
"(",
"self",
",",
"request",
",",
"application",
",",
"method",
")",
":",
"return",
"self",
".",
"authentication",
".",
"is_authenticated",
"(",
"request",
",",
"application",
",",
"method",
")"
] | Authenticate the AJAX request.
By default any request to fetch a model is allowed for any user,
including anonymous users. All other methods minimally require that
the user is already logged in.
Most likely you will want to lock down who can edit and delete various
models. To d... | [
"Authenticate",
"the",
"AJAX",
"request",
"."
] | b71619d5c00d8e0bb990ddbea2c93cf303dc2c80 | https://github.com/joestump/django-ajax/blob/b71619d5c00d8e0bb990ddbea2c93cf303dc2c80/ajax/endpoints.py#L261-L271 | train |
contentful/contentful-management.py | contentful_management/entries_proxy.py | EntriesProxy.all | def all(self, query=None):
"""
Gets all entries of a space.
"""
if query is None:
query = {}
if self.content_type_id is not None:
query['content_type'] = self.content_type_id
normalize_select(query)
return super(EntriesProxy, self).all(... | python | def all(self, query=None):
"""
Gets all entries of a space.
"""
if query is None:
query = {}
if self.content_type_id is not None:
query['content_type'] = self.content_type_id
normalize_select(query)
return super(EntriesProxy, self).all(... | [
"def",
"all",
"(",
"self",
",",
"query",
"=",
"None",
")",
":",
"if",
"query",
"is",
"None",
":",
"query",
"=",
"{",
"}",
"if",
"self",
".",
"content_type_id",
"is",
"not",
"None",
":",
"query",
"[",
"'content_type'",
"]",
"=",
"self",
".",
"conten... | Gets all entries of a space. | [
"Gets",
"all",
"entries",
"of",
"a",
"space",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/entries_proxy.py#L32-L45 | train |
contentful/contentful-management.py | contentful_management/entries_proxy.py | EntriesProxy.find | def find(self, entry_id, query=None):
"""
Gets a single entry by ID.
"""
if query is None:
query = {}
if self.content_type_id is not None:
query['content_type'] = self.content_type_id
normalize_select(query)
return super(EntriesProxy, s... | python | def find(self, entry_id, query=None):
"""
Gets a single entry by ID.
"""
if query is None:
query = {}
if self.content_type_id is not None:
query['content_type'] = self.content_type_id
normalize_select(query)
return super(EntriesProxy, s... | [
"def",
"find",
"(",
"self",
",",
"entry_id",
",",
"query",
"=",
"None",
")",
":",
"if",
"query",
"is",
"None",
":",
"query",
"=",
"{",
"}",
"if",
"self",
".",
"content_type_id",
"is",
"not",
"None",
":",
"query",
"[",
"'content_type'",
"]",
"=",
"s... | Gets a single entry by ID. | [
"Gets",
"a",
"single",
"entry",
"by",
"ID",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/entries_proxy.py#L47-L60 | train |
contentful/contentful-management.py | contentful_management/entries_proxy.py | EntriesProxy.create | def create(self, resource_id=None, attributes=None, **kwargs):
"""
Creates an entry with a given ID (optional) and attributes.
"""
if self.content_type_id is not None:
if attributes is None:
attributes = {}
attributes['content_type_id'] = self.con... | python | def create(self, resource_id=None, attributes=None, **kwargs):
"""
Creates an entry with a given ID (optional) and attributes.
"""
if self.content_type_id is not None:
if attributes is None:
attributes = {}
attributes['content_type_id'] = self.con... | [
"def",
"create",
"(",
"self",
",",
"resource_id",
"=",
"None",
",",
"attributes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"content_type_id",
"is",
"not",
"None",
":",
"if",
"attributes",
"is",
"None",
":",
"attributes",
"=",
... | Creates an entry with a given ID (optional) and attributes. | [
"Creates",
"an",
"entry",
"with",
"a",
"given",
"ID",
"(",
"optional",
")",
"and",
"attributes",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/entries_proxy.py#L62-L72 | train |
contentful/contentful-management.py | contentful_management/webhooks_proxy.py | WebhooksProxy.create | def create(self, attributes=None, **kwargs):
"""
Creates a webhook with given attributes.
"""
return super(WebhooksProxy, self).create(resource_id=None, attributes=attributes) | python | def create(self, attributes=None, **kwargs):
"""
Creates a webhook with given attributes.
"""
return super(WebhooksProxy, self).create(resource_id=None, attributes=attributes) | [
"def",
"create",
"(",
"self",
",",
"attributes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"super",
"(",
"WebhooksProxy",
",",
"self",
")",
".",
"create",
"(",
"resource_id",
"=",
"None",
",",
"attributes",
"=",
"attributes",
")"
] | Creates a webhook with given attributes. | [
"Creates",
"a",
"webhook",
"with",
"given",
"attributes",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/webhooks_proxy.py#L27-L32 | train |
contentful/contentful-management.py | contentful_management/utils.py | camel_case | def camel_case(snake_str):
"""
Returns a camel-cased version of a string.
:param a_string: any :class:`str` object.
Usage:
>>> camel_case('foo_bar')
"fooBar"
"""
components = snake_str.split('_')
# We capitalize the first letter of each component except the first one
#... | python | def camel_case(snake_str):
"""
Returns a camel-cased version of a string.
:param a_string: any :class:`str` object.
Usage:
>>> camel_case('foo_bar')
"fooBar"
"""
components = snake_str.split('_')
# We capitalize the first letter of each component except the first one
#... | [
"def",
"camel_case",
"(",
"snake_str",
")",
":",
"components",
"=",
"snake_str",
".",
"split",
"(",
"'_'",
")",
"# We capitalize the first letter of each component except the first one",
"# with the 'title' method and join them together.",
"return",
"components",
"[",
"0",
"]... | Returns a camel-cased version of a string.
:param a_string: any :class:`str` object.
Usage:
>>> camel_case('foo_bar')
"fooBar" | [
"Returns",
"a",
"camel",
"-",
"cased",
"version",
"of",
"a",
"string",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/utils.py#L73-L87 | train |
contentful/contentful-management.py | contentful_management/utils.py | normalize_select | def normalize_select(query):
"""
If the query contains the :select operator, we enforce :sys properties.
The SDK requires sys.type to function properly, but as other of our
SDKs require more parts of the :sys properties, we decided that every
SDK should include the complete :sys block to provide con... | python | def normalize_select(query):
"""
If the query contains the :select operator, we enforce :sys properties.
The SDK requires sys.type to function properly, but as other of our
SDKs require more parts of the :sys properties, we decided that every
SDK should include the complete :sys block to provide con... | [
"def",
"normalize_select",
"(",
"query",
")",
":",
"if",
"'select'",
"not",
"in",
"query",
":",
"return",
"if",
"isinstance",
"(",
"query",
"[",
"'select'",
"]",
",",
"str_type",
"(",
")",
")",
":",
"query",
"[",
"'select'",
"]",
"=",
"[",
"s",
".",
... | If the query contains the :select operator, we enforce :sys properties.
The SDK requires sys.type to function properly, but as other of our
SDKs require more parts of the :sys properties, we decided that every
SDK should include the complete :sys block to provide consistency
accross our SDKs. | [
"If",
"the",
"query",
"contains",
"the",
":",
"select",
"operator",
"we",
"enforce",
":",
"sys",
"properties",
".",
"The",
"SDK",
"requires",
"sys",
".",
"type",
"to",
"function",
"properly",
"but",
"as",
"other",
"of",
"our",
"SDKs",
"require",
"more",
... | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/utils.py#L154-L176 | train |
contentful/contentful-management.py | contentful_management/environment.py | Environment.to_json | def to_json(self):
"""
Returns the JSON representation of the environment.
"""
result = super(Environment, self).to_json()
result.update({
'name': self.name
})
return result | python | def to_json(self):
"""
Returns the JSON representation of the environment.
"""
result = super(Environment, self).to_json()
result.update({
'name': self.name
})
return result | [
"def",
"to_json",
"(",
"self",
")",
":",
"result",
"=",
"super",
"(",
"Environment",
",",
"self",
")",
".",
"to_json",
"(",
")",
"result",
".",
"update",
"(",
"{",
"'name'",
":",
"self",
".",
"name",
"}",
")",
"return",
"result"
] | Returns the JSON representation of the environment. | [
"Returns",
"the",
"JSON",
"representation",
"of",
"the",
"environment",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/environment.py#L56-L66 | train |
contentful/contentful-management.py | contentful_management/environment.py | Environment.content_types | def content_types(self):
"""
Provides access to content type management methods for content types of an environment.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/content-types
:return: :class:`EnvironmentContentTypesProxy <cont... | python | def content_types(self):
"""
Provides access to content type management methods for content types of an environment.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/content-types
:return: :class:`EnvironmentContentTypesProxy <cont... | [
"def",
"content_types",
"(",
"self",
")",
":",
"return",
"EnvironmentContentTypesProxy",
"(",
"self",
".",
"_client",
",",
"self",
".",
"space",
".",
"id",
",",
"self",
".",
"id",
")"
] | Provides access to content type management methods for content types of an environment.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/content-types
:return: :class:`EnvironmentContentTypesProxy <contentful_management.space_content_types_proxy.E... | [
"Provides",
"access",
"to",
"content",
"type",
"management",
"methods",
"for",
"content",
"types",
"of",
"an",
"environment",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/environment.py#L68-L83 | train |
contentful/contentful-management.py | contentful_management/environment.py | Environment.entries | def entries(self):
"""
Provides access to entry management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries
:return: :class:`EnvironmentEntriesProxy <contentful_management.environment_entries_proxy.EnvironmentEntri... | python | def entries(self):
"""
Provides access to entry management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries
:return: :class:`EnvironmentEntriesProxy <contentful_management.environment_entries_proxy.EnvironmentEntri... | [
"def",
"entries",
"(",
"self",
")",
":",
"return",
"EnvironmentEntriesProxy",
"(",
"self",
".",
"_client",
",",
"self",
".",
"space",
".",
"id",
",",
"self",
".",
"id",
")"
] | Provides access to entry management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries
:return: :class:`EnvironmentEntriesProxy <contentful_management.environment_entries_proxy.EnvironmentEntriesProxy>` object.
:rtype: conte... | [
"Provides",
"access",
"to",
"entry",
"management",
"methods",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/environment.py#L85-L100 | train |
contentful/contentful-management.py | contentful_management/environment.py | Environment.assets | def assets(self):
"""
Provides access to asset management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/assets
:return: :class:`EnvironmentAssetsProxy <contentful_management.environment_assets_proxy.EnvironmentAssetsPro... | python | def assets(self):
"""
Provides access to asset management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/assets
:return: :class:`EnvironmentAssetsProxy <contentful_management.environment_assets_proxy.EnvironmentAssetsPro... | [
"def",
"assets",
"(",
"self",
")",
":",
"return",
"EnvironmentAssetsProxy",
"(",
"self",
".",
"_client",
",",
"self",
".",
"space",
".",
"id",
",",
"self",
".",
"id",
")"
] | Provides access to asset management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/assets
:return: :class:`EnvironmentAssetsProxy <contentful_management.environment_assets_proxy.EnvironmentAssetsProxy>` object.
:rtype: contentfu... | [
"Provides",
"access",
"to",
"asset",
"management",
"methods",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/environment.py#L102-L117 | train |
contentful/contentful-management.py | contentful_management/environment.py | Environment.locales | def locales(self):
"""
Provides access to locale management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/locales
:return: :class:`EnvironmentLocalesProxy <contentful_management.environment_locales_proxy.EnvironmentLoca... | python | def locales(self):
"""
Provides access to locale management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/locales
:return: :class:`EnvironmentLocalesProxy <contentful_management.environment_locales_proxy.EnvironmentLoca... | [
"def",
"locales",
"(",
"self",
")",
":",
"return",
"EnvironmentLocalesProxy",
"(",
"self",
".",
"_client",
",",
"self",
".",
"space",
".",
"id",
",",
"self",
".",
"id",
")"
] | Provides access to locale management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/locales
:return: :class:`EnvironmentLocalesProxy <contentful_management.environment_locales_proxy.EnvironmentLocalesProxy>` object.
:rtype: cont... | [
"Provides",
"access",
"to",
"locale",
"management",
"methods",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/environment.py#L119-L134 | train |
contentful/contentful-management.py | contentful_management/environment.py | Environment.ui_extensions | def ui_extensions(self):
"""
Provides access to UI extensions management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/ui-extensions
:return: :class:`EnvironmentUIExtensionsProxy <contentful_management.ui_extensions_pro... | python | def ui_extensions(self):
"""
Provides access to UI extensions management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/ui-extensions
:return: :class:`EnvironmentUIExtensionsProxy <contentful_management.ui_extensions_pro... | [
"def",
"ui_extensions",
"(",
"self",
")",
":",
"return",
"EnvironmentUIExtensionsProxy",
"(",
"self",
".",
"_client",
",",
"self",
".",
"space",
".",
"id",
",",
"self",
".",
"id",
")"
] | Provides access to UI extensions management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/ui-extensions
:return: :class:`EnvironmentUIExtensionsProxy <contentful_management.ui_extensions_proxy.EnvironmentUIExtensionsProxy>` object.
... | [
"Provides",
"access",
"to",
"UI",
"extensions",
"management",
"methods",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/environment.py#L136-L151 | train |
contentful/contentful-management.py | contentful_management/personal_access_tokens_proxy.py | PersonalAccessTokensProxy.delete | def delete(self, token_id, *args, **kwargs):
"""
Revokes a personal access token.
"""
return self.client._put(
"{0}/revoked".format(
self._url(token_id)
),
None,
*args,
**kwargs
) | python | def delete(self, token_id, *args, **kwargs):
"""
Revokes a personal access token.
"""
return self.client._put(
"{0}/revoked".format(
self._url(token_id)
),
None,
*args,
**kwargs
) | [
"def",
"delete",
"(",
"self",
",",
"token_id",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"_put",
"(",
"\"{0}/revoked\"",
".",
"format",
"(",
"self",
".",
"_url",
"(",
"token_id",
")",
")",
",",
"None... | Revokes a personal access token. | [
"Revokes",
"a",
"personal",
"access",
"token",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/personal_access_tokens_proxy.py#L39-L51 | train |
contentful/contentful-management.py | contentful_management/personal_access_tokens_proxy.py | PersonalAccessTokensProxy.revoke | def revoke(self, token_id, *args, **kwargs):
"""
Revokes a personal access token.
"""
return self.delete(token_id, *args, **kwargs) | python | def revoke(self, token_id, *args, **kwargs):
"""
Revokes a personal access token.
"""
return self.delete(token_id, *args, **kwargs) | [
"def",
"revoke",
"(",
"self",
",",
"token_id",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"delete",
"(",
"token_id",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")"
] | Revokes a personal access token. | [
"Revokes",
"a",
"personal",
"access",
"token",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/personal_access_tokens_proxy.py#L53-L58 | train |
contentful/contentful-management.py | contentful_management/resource.py | Resource.base_url | def base_url(klass, space_id='', resource_id=None, environment_id=None, **kwargs):
"""
Returns the URI for the resource.
"""
url = "spaces/{0}".format(
space_id)
if environment_id is not None:
url = url = "{0}/environments/{1}".format(url, environment_id... | python | def base_url(klass, space_id='', resource_id=None, environment_id=None, **kwargs):
"""
Returns the URI for the resource.
"""
url = "spaces/{0}".format(
space_id)
if environment_id is not None:
url = url = "{0}/environments/{1}".format(url, environment_id... | [
"def",
"base_url",
"(",
"klass",
",",
"space_id",
"=",
"''",
",",
"resource_id",
"=",
"None",
",",
"environment_id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"url",
"=",
"\"spaces/{0}\"",
".",
"format",
"(",
"space_id",
")",
"if",
"environment_id"... | Returns the URI for the resource. | [
"Returns",
"the",
"URI",
"for",
"the",
"resource",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L37-L56 | train |
contentful/contentful-management.py | contentful_management/resource.py | Resource.create_attributes | def create_attributes(klass, attributes, previous_object=None):
"""
Attributes for resource creation.
"""
result = {}
if previous_object is not None:
result = {k: v for k, v in previous_object.to_json().items() if k != 'sys'}
result.update(attributes)
... | python | def create_attributes(klass, attributes, previous_object=None):
"""
Attributes for resource creation.
"""
result = {}
if previous_object is not None:
result = {k: v for k, v in previous_object.to_json().items() if k != 'sys'}
result.update(attributes)
... | [
"def",
"create_attributes",
"(",
"klass",
",",
"attributes",
",",
"previous_object",
"=",
"None",
")",
":",
"result",
"=",
"{",
"}",
"if",
"previous_object",
"is",
"not",
"None",
":",
"result",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"pr... | Attributes for resource creation. | [
"Attributes",
"for",
"resource",
"creation",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L59-L71 | train |
contentful/contentful-management.py | contentful_management/resource.py | Resource.delete | def delete(self):
"""
Deletes the resource.
"""
return self._client._delete(
self.__class__.base_url(
self.sys['space'].id,
self.sys['id'],
environment_id=self._environment_id
)
) | python | def delete(self):
"""
Deletes the resource.
"""
return self._client._delete(
self.__class__.base_url(
self.sys['space'].id,
self.sys['id'],
environment_id=self._environment_id
)
) | [
"def",
"delete",
"(",
"self",
")",
":",
"return",
"self",
".",
"_client",
".",
"_delete",
"(",
"self",
".",
"__class__",
".",
"base_url",
"(",
"self",
".",
"sys",
"[",
"'space'",
"]",
".",
"id",
",",
"self",
".",
"sys",
"[",
"'id'",
"]",
",",
"en... | Deletes the resource. | [
"Deletes",
"the",
"resource",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L89-L100 | train |
contentful/contentful-management.py | contentful_management/resource.py | Resource.update | def update(self, attributes=None):
"""
Updates the resource with attributes.
"""
if attributes is None:
attributes = {}
headers = self.__class__.create_headers(attributes)
headers.update(self._update_headers())
result = self._client._put(
... | python | def update(self, attributes=None):
"""
Updates the resource with attributes.
"""
if attributes is None:
attributes = {}
headers = self.__class__.create_headers(attributes)
headers.update(self._update_headers())
result = self._client._put(
... | [
"def",
"update",
"(",
"self",
",",
"attributes",
"=",
"None",
")",
":",
"if",
"attributes",
"is",
"None",
":",
"attributes",
"=",
"{",
"}",
"headers",
"=",
"self",
".",
"__class__",
".",
"create_headers",
"(",
"attributes",
")",
"headers",
".",
"update",... | Updates the resource with attributes. | [
"Updates",
"the",
"resource",
"with",
"attributes",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L102-L121 | train |
contentful/contentful-management.py | contentful_management/resource.py | Resource.reload | def reload(self, result=None):
"""
Reloads the resource.
"""
if result is None:
result = self._client._get(
self.__class__.base_url(
self.sys['space'].id,
self.sys['id'],
environment_id=self._environ... | python | def reload(self, result=None):
"""
Reloads the resource.
"""
if result is None:
result = self._client._get(
self.__class__.base_url(
self.sys['space'].id,
self.sys['id'],
environment_id=self._environ... | [
"def",
"reload",
"(",
"self",
",",
"result",
"=",
"None",
")",
":",
"if",
"result",
"is",
"None",
":",
"result",
"=",
"self",
".",
"_client",
".",
"_get",
"(",
"self",
".",
"__class__",
".",
"base_url",
"(",
"self",
".",
"sys",
"[",
"'space'",
"]",... | Reloads the resource. | [
"Reloads",
"the",
"resource",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L130-L146 | train |
contentful/contentful-management.py | contentful_management/resource.py | Resource.to_link | def to_link(self):
"""
Returns a link for the resource.
"""
link_type = self.link_type if self.type == 'Link' else self.type
return Link({'sys': {'linkType': link_type, 'id': self.sys.get('id')}}, client=self._client) | python | def to_link(self):
"""
Returns a link for the resource.
"""
link_type = self.link_type if self.type == 'Link' else self.type
return Link({'sys': {'linkType': link_type, 'id': self.sys.get('id')}}, client=self._client) | [
"def",
"to_link",
"(",
"self",
")",
":",
"link_type",
"=",
"self",
".",
"link_type",
"if",
"self",
".",
"type",
"==",
"'Link'",
"else",
"self",
".",
"type",
"return",
"Link",
"(",
"{",
"'sys'",
":",
"{",
"'linkType'",
":",
"link_type",
",",
"'id'",
"... | Returns a link for the resource. | [
"Returns",
"a",
"link",
"for",
"the",
"resource",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L148-L155 | train |
contentful/contentful-management.py | contentful_management/resource.py | Resource.to_json | def to_json(self):
"""
Returns the JSON representation of the resource.
"""
result = {
'sys': {}
}
for k, v in self.sys.items():
if k in ['space', 'content_type', 'created_by',
'updated_by', 'published_by']:
v ... | python | def to_json(self):
"""
Returns the JSON representation of the resource.
"""
result = {
'sys': {}
}
for k, v in self.sys.items():
if k in ['space', 'content_type', 'created_by',
'updated_by', 'published_by']:
v ... | [
"def",
"to_json",
"(",
"self",
")",
":",
"result",
"=",
"{",
"'sys'",
":",
"{",
"}",
"}",
"for",
"k",
",",
"v",
"in",
"self",
".",
"sys",
".",
"items",
"(",
")",
":",
"if",
"k",
"in",
"[",
"'space'",
",",
"'content_type'",
",",
"'created_by'",
... | Returns the JSON representation of the resource. | [
"Returns",
"the",
"JSON",
"representation",
"of",
"the",
"resource",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L157-L174 | train |
contentful/contentful-management.py | contentful_management/resource.py | FieldsResource.create_attributes | def create_attributes(klass, attributes, previous_object=None):
"""
Attributes for resource creation.
"""
if 'fields' not in attributes:
if previous_object is None:
attributes['fields'] = {}
else:
attributes['fields'] = previous_ob... | python | def create_attributes(klass, attributes, previous_object=None):
"""
Attributes for resource creation.
"""
if 'fields' not in attributes:
if previous_object is None:
attributes['fields'] = {}
else:
attributes['fields'] = previous_ob... | [
"def",
"create_attributes",
"(",
"klass",
",",
"attributes",
",",
"previous_object",
"=",
"None",
")",
":",
"if",
"'fields'",
"not",
"in",
"attributes",
":",
"if",
"previous_object",
"is",
"None",
":",
"attributes",
"[",
"'fields'",
"]",
"=",
"{",
"}",
"el... | Attributes for resource creation. | [
"Attributes",
"for",
"resource",
"creation",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L249-L259 | train |
contentful/contentful-management.py | contentful_management/resource.py | FieldsResource.fields_with_locales | def fields_with_locales(self):
"""
Get fields with locales per field.
"""
result = {}
for locale, fields in self._fields.items():
for k, v in fields.items():
real_field_id = self._real_field_id_for(k)
if real_field_id not in result:
... | python | def fields_with_locales(self):
"""
Get fields with locales per field.
"""
result = {}
for locale, fields in self._fields.items():
for k, v in fields.items():
real_field_id = self._real_field_id_for(k)
if real_field_id not in result:
... | [
"def",
"fields_with_locales",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"locale",
",",
"fields",
"in",
"self",
".",
"_fields",
".",
"items",
"(",
")",
":",
"for",
"k",
",",
"v",
"in",
"fields",
".",
"items",
"(",
")",
":",
"real_field_... | Get fields with locales per field. | [
"Get",
"fields",
"with",
"locales",
"per",
"field",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L276-L288 | train |
contentful/contentful-management.py | contentful_management/resource.py | FieldsResource.to_json | def to_json(self):
"""
Returns the JSON Representation of the resource.
"""
result = super(FieldsResource, self).to_json()
result['fields'] = self.fields_with_locales()
return result | python | def to_json(self):
"""
Returns the JSON Representation of the resource.
"""
result = super(FieldsResource, self).to_json()
result['fields'] = self.fields_with_locales()
return result | [
"def",
"to_json",
"(",
"self",
")",
":",
"result",
"=",
"super",
"(",
"FieldsResource",
",",
"self",
")",
".",
"to_json",
"(",
")",
"result",
"[",
"'fields'",
"]",
"=",
"self",
".",
"fields_with_locales",
"(",
")",
"return",
"result"
] | Returns the JSON Representation of the resource. | [
"Returns",
"the",
"JSON",
"Representation",
"of",
"the",
"resource",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L290-L297 | train |
contentful/contentful-management.py | contentful_management/resource.py | PublishResource.is_updated | def is_updated(self):
"""
Checks if a resource has been updated since last publish.
Returns False if resource has not been published before.
"""
if not self.is_published:
return False
return sanitize_date(self.sys['published_at']) < sanitize_date(self.sys['u... | python | def is_updated(self):
"""
Checks if a resource has been updated since last publish.
Returns False if resource has not been published before.
"""
if not self.is_published:
return False
return sanitize_date(self.sys['published_at']) < sanitize_date(self.sys['u... | [
"def",
"is_updated",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_published",
":",
"return",
"False",
"return",
"sanitize_date",
"(",
"self",
".",
"sys",
"[",
"'published_at'",
"]",
")",
"<",
"sanitize_date",
"(",
"self",
".",
"sys",
"[",
"'updat... | Checks if a resource has been updated since last publish.
Returns False if resource has not been published before. | [
"Checks",
"if",
"a",
"resource",
"has",
"been",
"updated",
"since",
"last",
"publish",
".",
"Returns",
"False",
"if",
"resource",
"has",
"not",
"been",
"published",
"before",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L392-L401 | train |
contentful/contentful-management.py | contentful_management/resource.py | PublishResource.unpublish | def unpublish(self):
"""
Unpublishes the resource.
"""
self._client._delete(
"{0}/published".format(
self.__class__.base_url(
self.sys['space'].id,
self.sys['id'],
environment_id=self._environment_id... | python | def unpublish(self):
"""
Unpublishes the resource.
"""
self._client._delete(
"{0}/published".format(
self.__class__.base_url(
self.sys['space'].id,
self.sys['id'],
environment_id=self._environment_id... | [
"def",
"unpublish",
"(",
"self",
")",
":",
"self",
".",
"_client",
".",
"_delete",
"(",
"\"{0}/published\"",
".",
"format",
"(",
"self",
".",
"__class__",
".",
"base_url",
"(",
"self",
".",
"sys",
"[",
"'space'",
"]",
".",
"id",
",",
"self",
".",
"sy... | Unpublishes the resource. | [
"Unpublishes",
"the",
"resource",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L422-L438 | train |
contentful/contentful-management.py | contentful_management/resource.py | ArchiveResource.archive | def archive(self):
"""
Archives the resource.
"""
self._client._put(
"{0}/archived".format(
self.__class__.base_url(
self.sys['space'].id,
self.sys['id'],
environment_id=self._environment_id
... | python | def archive(self):
"""
Archives the resource.
"""
self._client._put(
"{0}/archived".format(
self.__class__.base_url(
self.sys['space'].id,
self.sys['id'],
environment_id=self._environment_id
... | [
"def",
"archive",
"(",
"self",
")",
":",
"self",
".",
"_client",
".",
"_put",
"(",
"\"{0}/archived\"",
".",
"format",
"(",
"self",
".",
"__class__",
".",
"base_url",
"(",
"self",
".",
"sys",
"[",
"'space'",
"]",
".",
"id",
",",
"self",
".",
"sys",
... | Archives the resource. | [
"Archives",
"the",
"resource",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L454-L471 | train |
contentful/contentful-management.py | contentful_management/resource.py | Link.resolve | def resolve(self, space_id=None, environment_id=None):
"""
Resolves link to a specific resource.
"""
proxy_method = getattr(
self._client,
base_path_for(self.link_type)
)
if self.link_type == 'Space':
return proxy_method().find(self.id... | python | def resolve(self, space_id=None, environment_id=None):
"""
Resolves link to a specific resource.
"""
proxy_method = getattr(
self._client,
base_path_for(self.link_type)
)
if self.link_type == 'Space':
return proxy_method().find(self.id... | [
"def",
"resolve",
"(",
"self",
",",
"space_id",
"=",
"None",
",",
"environment_id",
"=",
"None",
")",
":",
"proxy_method",
"=",
"getattr",
"(",
"self",
".",
"_client",
",",
"base_path_for",
"(",
"self",
".",
"link_type",
")",
")",
"if",
"self",
".",
"l... | Resolves link to a specific resource. | [
"Resolves",
"link",
"to",
"a",
"specific",
"resource",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/resource.py#L517-L531 | train |
contentful/contentful-management.py | contentful_management/asset.py | Asset.url | def url(self, **kwargs):
"""
Returns a formatted URL for the asset's File
with serialized parameters.
Usage:
>>> my_asset.url()
"//images.contentful.com/spaces/foobar/..."
>>> my_asset.url(w=120, h=160)
"//images.contentful.com/spaces/foob... | python | def url(self, **kwargs):
"""
Returns a formatted URL for the asset's File
with serialized parameters.
Usage:
>>> my_asset.url()
"//images.contentful.com/spaces/foobar/..."
>>> my_asset.url(w=120, h=160)
"//images.contentful.com/spaces/foob... | [
"def",
"url",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"url",
"=",
"self",
".",
"fields",
"(",
"self",
".",
"_locale",
"(",
")",
")",
".",
"get",
"(",
"'file'",
",",
"{",
"}",
")",
".",
"get",
"(",
"'url'",
",",
"''",
")",
"args",
"=... | Returns a formatted URL for the asset's File
with serialized parameters.
Usage:
>>> my_asset.url()
"//images.contentful.com/spaces/foobar/..."
>>> my_asset.url(w=120, h=160)
"//images.contentful.com/spaces/foobar/...?w=120&h=160" | [
"Returns",
"a",
"formatted",
"URL",
"for",
"the",
"asset",
"s",
"File",
"with",
"serialized",
"parameters",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/asset.py#L22-L40 | train |
contentful/contentful-management.py | contentful_management/asset.py | Asset.process | def process(self):
"""
Calls the process endpoint for all locales of the asset.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/assets/asset-processing
"""
for locale in self._fields.keys():
self._client._put(
... | python | def process(self):
"""
Calls the process endpoint for all locales of the asset.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/assets/asset-processing
"""
for locale in self._fields.keys():
self._client._put(
... | [
"def",
"process",
"(",
"self",
")",
":",
"for",
"locale",
"in",
"self",
".",
"_fields",
".",
"keys",
"(",
")",
":",
"self",
".",
"_client",
".",
"_put",
"(",
"\"{0}/files/{1}/process\"",
".",
"format",
"(",
"self",
".",
"__class__",
".",
"base_url",
"(... | Calls the process endpoint for all locales of the asset.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/assets/asset-processing | [
"Calls",
"the",
"process",
"endpoint",
"for",
"all",
"locales",
"of",
"the",
"asset",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/asset.py#L42-L62 | train |
contentful/contentful-management.py | contentful_management/ui_extension.py | UIExtension.to_json | def to_json(self):
"""
Returns the JSON Representation of the UI extension.
"""
result = super(UIExtension, self).to_json()
result.update({
'extension': self.extension
})
return result | python | def to_json(self):
"""
Returns the JSON Representation of the UI extension.
"""
result = super(UIExtension, self).to_json()
result.update({
'extension': self.extension
})
return result | [
"def",
"to_json",
"(",
"self",
")",
":",
"result",
"=",
"super",
"(",
"UIExtension",
",",
"self",
")",
".",
"to_json",
"(",
")",
"result",
".",
"update",
"(",
"{",
"'extension'",
":",
"self",
".",
"extension",
"}",
")",
"return",
"result"
] | Returns the JSON Representation of the UI extension. | [
"Returns",
"the",
"JSON",
"Representation",
"of",
"the",
"UI",
"extension",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/ui_extension.py#L78-L88 | train |
contentful/contentful-management.py | contentful_management/api_key.py | ApiKey.create_attributes | def create_attributes(klass, attributes, previous_object=None):
"""
Attributes for resource creation.
"""
return {
'name': attributes.get(
'name',
previous_object.name if previous_object is not None else ''
),
'descript... | python | def create_attributes(klass, attributes, previous_object=None):
"""
Attributes for resource creation.
"""
return {
'name': attributes.get(
'name',
previous_object.name if previous_object is not None else ''
),
'descript... | [
"def",
"create_attributes",
"(",
"klass",
",",
"attributes",
",",
"previous_object",
"=",
"None",
")",
":",
"return",
"{",
"'name'",
":",
"attributes",
".",
"get",
"(",
"'name'",
",",
"previous_object",
".",
"name",
"if",
"previous_object",
"is",
"not",
"Non... | Attributes for resource creation. | [
"Attributes",
"for",
"resource",
"creation",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/api_key.py#L34-L52 | train |
contentful/contentful-management.py | contentful_management/api_key.py | ApiKey.to_json | def to_json(self):
"""
Returns the JSON representation of the API key.
"""
result = super(ApiKey, self).to_json()
result.update({
'name': self.name,
'description': self.description,
'accessToken': self.access_token,
'environments':... | python | def to_json(self):
"""
Returns the JSON representation of the API key.
"""
result = super(ApiKey, self).to_json()
result.update({
'name': self.name,
'description': self.description,
'accessToken': self.access_token,
'environments':... | [
"def",
"to_json",
"(",
"self",
")",
":",
"result",
"=",
"super",
"(",
"ApiKey",
",",
"self",
")",
".",
"to_json",
"(",
")",
"result",
".",
"update",
"(",
"{",
"'name'",
":",
"self",
".",
"name",
",",
"'description'",
":",
"self",
".",
"description",
... | Returns the JSON representation of the API key. | [
"Returns",
"the",
"JSON",
"representation",
"of",
"the",
"API",
"key",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/api_key.py#L70-L82 | train |
contentful/contentful-management.py | contentful_management/api_usages_proxy.py | ApiUsagesProxy.all | def all(self, usage_type, usage_period_id, api, query=None, *args, **kwargs):
"""
Gets all api usages by type for a given period an api.
"""
if query is None:
query = {}
mandatory_query = {
'filters[usagePeriod]': usage_period_id,
'filters[me... | python | def all(self, usage_type, usage_period_id, api, query=None, *args, **kwargs):
"""
Gets all api usages by type for a given period an api.
"""
if query is None:
query = {}
mandatory_query = {
'filters[usagePeriod]': usage_period_id,
'filters[me... | [
"def",
"all",
"(",
"self",
",",
"usage_type",
",",
"usage_period_id",
",",
"api",
",",
"query",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"query",
"is",
"None",
":",
"query",
"=",
"{",
"}",
"mandatory_query",
"=",
"{",... | Gets all api usages by type for a given period an api. | [
"Gets",
"all",
"api",
"usages",
"by",
"type",
"for",
"a",
"given",
"period",
"an",
"api",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/api_usages_proxy.py#L31-L52 | train |
contentful/contentful-management.py | contentful_management/content_type.py | ContentType.base_url | def base_url(klass, space_id, resource_id=None, public=False, environment_id=None, **kwargs):
"""
Returns the URI for the content type.
"""
if public:
environment_slug = ""
if environment_id is not None:
environment_slug = "/environments/{0}".form... | python | def base_url(klass, space_id, resource_id=None, public=False, environment_id=None, **kwargs):
"""
Returns the URI for the content type.
"""
if public:
environment_slug = ""
if environment_id is not None:
environment_slug = "/environments/{0}".form... | [
"def",
"base_url",
"(",
"klass",
",",
"space_id",
",",
"resource_id",
"=",
"None",
",",
"public",
"=",
"False",
",",
"environment_id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"public",
":",
"environment_slug",
"=",
"\"\"",
"if",
"environmen... | Returns the URI for the content type. | [
"Returns",
"the",
"URI",
"for",
"the",
"content",
"type",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type.py#L35-L50 | train |
contentful/contentful-management.py | contentful_management/content_type.py | ContentType.create_attributes | def create_attributes(klass, attributes, previous_object=None):
"""
Attributes for content type creation.
"""
result = super(ContentType, klass).create_attributes(attributes, previous_object)
if 'fields' not in result:
result['fields'] = []
return result | python | def create_attributes(klass, attributes, previous_object=None):
"""
Attributes for content type creation.
"""
result = super(ContentType, klass).create_attributes(attributes, previous_object)
if 'fields' not in result:
result['fields'] = []
return result | [
"def",
"create_attributes",
"(",
"klass",
",",
"attributes",
",",
"previous_object",
"=",
"None",
")",
":",
"result",
"=",
"super",
"(",
"ContentType",
",",
"klass",
")",
".",
"create_attributes",
"(",
"attributes",
",",
"previous_object",
")",
"if",
"'fields'... | Attributes for content type creation. | [
"Attributes",
"for",
"content",
"type",
"creation",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type.py#L53-L62 | train |
contentful/contentful-management.py | contentful_management/content_type.py | ContentType.to_json | def to_json(self):
"""
Returns the JSON representation of the content type.
"""
result = super(ContentType, self).to_json()
result.update({
'name': self.name,
'description': self.description,
'displayField': self.display_field,
'fi... | python | def to_json(self):
"""
Returns the JSON representation of the content type.
"""
result = super(ContentType, self).to_json()
result.update({
'name': self.name,
'description': self.description,
'displayField': self.display_field,
'fi... | [
"def",
"to_json",
"(",
"self",
")",
":",
"result",
"=",
"super",
"(",
"ContentType",
",",
"self",
")",
".",
"to_json",
"(",
")",
"result",
".",
"update",
"(",
"{",
"'name'",
":",
"self",
".",
"name",
",",
"'description'",
":",
"self",
".",
"descripti... | Returns the JSON representation of the content type. | [
"Returns",
"the",
"JSON",
"representation",
"of",
"the",
"content",
"type",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type.py#L77-L89 | train |
contentful/contentful-management.py | contentful_management/content_type.py | ContentType.entries | def entries(self):
"""
Provides access to entry management methods for the given content type.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries
:return: :class:`ContentTypeEntriesProxy <contentful_management.content_type_en... | python | def entries(self):
"""
Provides access to entry management methods for the given content type.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries
:return: :class:`ContentTypeEntriesProxy <contentful_management.content_type_en... | [
"def",
"entries",
"(",
"self",
")",
":",
"return",
"ContentTypeEntriesProxy",
"(",
"self",
".",
"_client",
",",
"self",
".",
"space",
".",
"id",
",",
"self",
".",
"_environment_id",
",",
"self",
".",
"id",
")"
] | Provides access to entry management methods for the given content type.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/entries
:return: :class:`ContentTypeEntriesProxy <contentful_management.content_type_entries_proxy.ContentTypeEntriesProxy>` o... | [
"Provides",
"access",
"to",
"entry",
"management",
"methods",
"for",
"the",
"given",
"content",
"type",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type.py#L91-L105 | train |
contentful/contentful-management.py | contentful_management/content_type.py | ContentType.editor_interfaces | def editor_interfaces(self):
"""
Provides access to editor interface management methods for the given content type.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/editor-interface
:return: :class:`ContentTypeEditorInterfacesProxy... | python | def editor_interfaces(self):
"""
Provides access to editor interface management methods for the given content type.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/editor-interface
:return: :class:`ContentTypeEditorInterfacesProxy... | [
"def",
"editor_interfaces",
"(",
"self",
")",
":",
"return",
"ContentTypeEditorInterfacesProxy",
"(",
"self",
".",
"_client",
",",
"self",
".",
"space",
".",
"id",
",",
"self",
".",
"_environment_id",
",",
"self",
".",
"id",
")"
] | Provides access to editor interface management methods for the given content type.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/editor-interface
:return: :class:`ContentTypeEditorInterfacesProxy <contentful_management.content_type_editor_inter... | [
"Provides",
"access",
"to",
"editor",
"interface",
"management",
"methods",
"for",
"the",
"given",
"content",
"type",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type.py#L107-L121 | train |
contentful/contentful-management.py | contentful_management/content_type.py | ContentType.snapshots | def snapshots(self):
"""
Provides access to snapshot management methods for the given content type.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots/content-type-snapshots-collection
:return: :class:`ContentTypeSnapshotsP... | python | def snapshots(self):
"""
Provides access to snapshot management methods for the given content type.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots/content-type-snapshots-collection
:return: :class:`ContentTypeSnapshotsP... | [
"def",
"snapshots",
"(",
"self",
")",
":",
"return",
"ContentTypeSnapshotsProxy",
"(",
"self",
".",
"_client",
",",
"self",
".",
"space",
".",
"id",
",",
"self",
".",
"_environment_id",
",",
"self",
".",
"id",
")"
] | Provides access to snapshot management methods for the given content type.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots/content-type-snapshots-collection
:return: :class:`ContentTypeSnapshotsProxy <contentful_management.content_type_... | [
"Provides",
"access",
"to",
"snapshot",
"management",
"methods",
"for",
"the",
"given",
"content",
"type",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type.py#L123-L137 | train |
contentful/contentful-management.py | contentful_management/organizations_proxy.py | OrganizationsProxy.all | def all(self, query=None, **kwargs):
"""
Gets all organizations.
"""
return super(OrganizationsProxy, self).all(query=query) | python | def all(self, query=None, **kwargs):
"""
Gets all organizations.
"""
return super(OrganizationsProxy, self).all(query=query) | [
"def",
"all",
"(",
"self",
",",
"query",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"super",
"(",
"OrganizationsProxy",
",",
"self",
")",
".",
"all",
"(",
"query",
"=",
"query",
")"
] | Gets all organizations. | [
"Gets",
"all",
"organizations",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/organizations_proxy.py#L33-L38 | train |
contentful/contentful-management.py | contentful_management/webhook_call.py | WebhookCall.base_url | def base_url(klass, space_id, webhook_id, resource_id=None):
"""
Returns the URI for the webhook call.
"""
return "spaces/{0}/webhooks/{1}/calls/{2}".format(
space_id,
webhook_id,
resource_id if resource_id is not None else ''
) | python | def base_url(klass, space_id, webhook_id, resource_id=None):
"""
Returns the URI for the webhook call.
"""
return "spaces/{0}/webhooks/{1}/calls/{2}".format(
space_id,
webhook_id,
resource_id if resource_id is not None else ''
) | [
"def",
"base_url",
"(",
"klass",
",",
"space_id",
",",
"webhook_id",
",",
"resource_id",
"=",
"None",
")",
":",
"return",
"\"spaces/{0}/webhooks/{1}/calls/{2}\"",
".",
"format",
"(",
"space_id",
",",
"webhook_id",
",",
"resource_id",
"if",
"resource_id",
"is",
"... | Returns the URI for the webhook call. | [
"Returns",
"the",
"URI",
"for",
"the",
"webhook",
"call",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/webhook_call.py#L42-L51 | train |
contentful/contentful-management.py | contentful_management/space.py | Space.create_attributes | def create_attributes(klass, attributes, previous_object=None):
"""Attributes for space creation."""
if previous_object is not None:
return {'name': attributes.get('name', previous_object.name)}
return {
'name': attributes.get('name', ''),
'defaultLocale': at... | python | def create_attributes(klass, attributes, previous_object=None):
"""Attributes for space creation."""
if previous_object is not None:
return {'name': attributes.get('name', previous_object.name)}
return {
'name': attributes.get('name', ''),
'defaultLocale': at... | [
"def",
"create_attributes",
"(",
"klass",
",",
"attributes",
",",
"previous_object",
"=",
"None",
")",
":",
"if",
"previous_object",
"is",
"not",
"None",
":",
"return",
"{",
"'name'",
":",
"attributes",
".",
"get",
"(",
"'name'",
",",
"previous_object",
".",... | Attributes for space creation. | [
"Attributes",
"for",
"space",
"creation",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/space.py#L54-L62 | train |
contentful/contentful-management.py | contentful_management/space.py | Space.reload | def reload(self):
"""
Reloads the space.
"""
result = self._client._get(
self.__class__.base_url(
self.sys['id']
)
)
self._update_from_resource(result)
return self | python | def reload(self):
"""
Reloads the space.
"""
result = self._client._get(
self.__class__.base_url(
self.sys['id']
)
)
self._update_from_resource(result)
return self | [
"def",
"reload",
"(",
"self",
")",
":",
"result",
"=",
"self",
".",
"_client",
".",
"_get",
"(",
"self",
".",
"__class__",
".",
"base_url",
"(",
"self",
".",
"sys",
"[",
"'id'",
"]",
")",
")",
"self",
".",
"_update_from_resource",
"(",
"result",
")",... | Reloads the space. | [
"Reloads",
"the",
"space",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/space.py#L96-L109 | train |
contentful/contentful-management.py | contentful_management/space.py | Space.delete | def delete(self):
"""
Deletes the space
"""
return self._client._delete(
self.__class__.base_url(
self.sys['id']
)
) | python | def delete(self):
"""
Deletes the space
"""
return self._client._delete(
self.__class__.base_url(
self.sys['id']
)
) | [
"def",
"delete",
"(",
"self",
")",
":",
"return",
"self",
".",
"_client",
".",
"_delete",
"(",
"self",
".",
"__class__",
".",
"base_url",
"(",
"self",
".",
"sys",
"[",
"'id'",
"]",
")",
")"
] | Deletes the space | [
"Deletes",
"the",
"space"
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/space.py#L111-L120 | train |
contentful/contentful-management.py | contentful_management/space.py | Space.to_json | def to_json(self):
"""
Returns the JSON representation of the space.
"""
result = super(Space, self).to_json()
result.update({'name': self.name})
return result | python | def to_json(self):
"""
Returns the JSON representation of the space.
"""
result = super(Space, self).to_json()
result.update({'name': self.name})
return result | [
"def",
"to_json",
"(",
"self",
")",
":",
"result",
"=",
"super",
"(",
"Space",
",",
"self",
")",
".",
"to_json",
"(",
")",
"result",
".",
"update",
"(",
"{",
"'name'",
":",
"self",
".",
"name",
"}",
")",
"return",
"result"
] | Returns the JSON representation of the space. | [
"Returns",
"the",
"JSON",
"representation",
"of",
"the",
"space",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/space.py#L122-L129 | train |
contentful/contentful-management.py | contentful_management/spaces_proxy.py | SpacesProxy.all | def all(self, query=None, **kwargs):
"""
Gets all spaces.
"""
return super(SpacesProxy, self).all(query=query) | python | def all(self, query=None, **kwargs):
"""
Gets all spaces.
"""
return super(SpacesProxy, self).all(query=query) | [
"def",
"all",
"(",
"self",
",",
"query",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"super",
"(",
"SpacesProxy",
",",
"self",
")",
".",
"all",
"(",
"query",
"=",
"query",
")"
] | Gets all spaces. | [
"Gets",
"all",
"spaces",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/spaces_proxy.py#L33-L38 | train |
contentful/contentful-management.py | contentful_management/spaces_proxy.py | SpacesProxy.find | def find(self, space_id, query=None, **kwargs):
"""
Gets a space by ID.
"""
try:
self.space_id = space_id
return super(SpacesProxy, self).find(space_id, query=query)
finally:
self.space_id = None | python | def find(self, space_id, query=None, **kwargs):
"""
Gets a space by ID.
"""
try:
self.space_id = space_id
return super(SpacesProxy, self).find(space_id, query=query)
finally:
self.space_id = None | [
"def",
"find",
"(",
"self",
",",
"space_id",
",",
"query",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"self",
".",
"space_id",
"=",
"space_id",
"return",
"super",
"(",
"SpacesProxy",
",",
"self",
")",
".",
"find",
"(",
"space_id",
... | Gets a space by ID. | [
"Gets",
"a",
"space",
"by",
"ID",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/spaces_proxy.py#L40-L49 | train |
contentful/contentful-management.py | contentful_management/spaces_proxy.py | SpacesProxy.create | def create(self, attributes=None, **kwargs):
"""
Creates a space with given attributes.
"""
if attributes is None:
attributes = {}
if 'default_locale' not in attributes:
attributes['default_locale'] = self.client.default_locale
return super(Space... | python | def create(self, attributes=None, **kwargs):
"""
Creates a space with given attributes.
"""
if attributes is None:
attributes = {}
if 'default_locale' not in attributes:
attributes['default_locale'] = self.client.default_locale
return super(Space... | [
"def",
"create",
"(",
"self",
",",
"attributes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"attributes",
"is",
"None",
":",
"attributes",
"=",
"{",
"}",
"if",
"'default_locale'",
"not",
"in",
"attributes",
":",
"attributes",
"[",
"'default_lo... | Creates a space with given attributes. | [
"Creates",
"a",
"space",
"with",
"given",
"attributes",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/spaces_proxy.py#L51-L61 | train |
contentful/contentful-management.py | contentful_management/spaces_proxy.py | SpacesProxy.delete | def delete(self, space_id):
"""
Deletes a space by ID.
"""
try:
self.space_id = space_id
return super(SpacesProxy, self).delete(space_id)
finally:
self.space_id = None | python | def delete(self, space_id):
"""
Deletes a space by ID.
"""
try:
self.space_id = space_id
return super(SpacesProxy, self).delete(space_id)
finally:
self.space_id = None | [
"def",
"delete",
"(",
"self",
",",
"space_id",
")",
":",
"try",
":",
"self",
".",
"space_id",
"=",
"space_id",
"return",
"super",
"(",
"SpacesProxy",
",",
"self",
")",
".",
"delete",
"(",
"space_id",
")",
"finally",
":",
"self",
".",
"space_id",
"=",
... | Deletes a space by ID. | [
"Deletes",
"a",
"space",
"by",
"ID",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/spaces_proxy.py#L63-L72 | train |
contentful/contentful-management.py | contentful_management/client.py | Client.editor_interfaces | def editor_interfaces(self, space_id, environment_id, content_type_id):
"""
Provides access to editor interfaces management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/editor-interface
:return: :class:`EditorInterface... | python | def editor_interfaces(self, space_id, environment_id, content_type_id):
"""
Provides access to editor interfaces management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/editor-interface
:return: :class:`EditorInterface... | [
"def",
"editor_interfaces",
"(",
"self",
",",
"space_id",
",",
"environment_id",
",",
"content_type_id",
")",
":",
"return",
"EditorInterfacesProxy",
"(",
"self",
",",
"space_id",
",",
"environment_id",
",",
"content_type_id",
")"
] | Provides access to editor interfaces management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/editor-interface
:return: :class:`EditorInterfacesProxy <contentful_management.editor_interfaces_proxy.EditorInterfacesProxy>` object.
... | [
"Provides",
"access",
"to",
"editor",
"interfaces",
"management",
"methods",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L444-L459 | train |
contentful/contentful-management.py | contentful_management/client.py | Client.snapshots | def snapshots(self, space_id, environment_id, resource_id, resource_kind='entries'):
"""
Provides access to snapshot management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots
:return: :class:`SnapshotsProxy <co... | python | def snapshots(self, space_id, environment_id, resource_id, resource_kind='entries'):
"""
Provides access to snapshot management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots
:return: :class:`SnapshotsProxy <co... | [
"def",
"snapshots",
"(",
"self",
",",
"space_id",
",",
"environment_id",
",",
"resource_id",
",",
"resource_kind",
"=",
"'entries'",
")",
":",
"return",
"SnapshotsProxy",
"(",
"self",
",",
"space_id",
",",
"environment_id",
",",
"resource_id",
",",
"resource_kin... | Provides access to snapshot management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots
:return: :class:`SnapshotsProxy <contentful_management.snapshots_proxy.SnapshotsProxy>` object.
:rtype: contentful.snapshots_proxy.S... | [
"Provides",
"access",
"to",
"snapshot",
"management",
"methods",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L461-L479 | train |
contentful/contentful-management.py | contentful_management/client.py | Client.entry_snapshots | def entry_snapshots(self, space_id, environment_id, entry_id):
"""
Provides access to entry snapshot management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots
:return: :class:`SnapshotsProxy <contentful_managem... | python | def entry_snapshots(self, space_id, environment_id, entry_id):
"""
Provides access to entry snapshot management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots
:return: :class:`SnapshotsProxy <contentful_managem... | [
"def",
"entry_snapshots",
"(",
"self",
",",
"space_id",
",",
"environment_id",
",",
"entry_id",
")",
":",
"return",
"SnapshotsProxy",
"(",
"self",
",",
"space_id",
",",
"environment_id",
",",
"entry_id",
",",
"'entries'",
")"
] | Provides access to entry snapshot management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots
:return: :class:`SnapshotsProxy <contentful_management.snapshots_proxy.SnapshotsProxy>` object.
:rtype: contentful.snapshots_p... | [
"Provides",
"access",
"to",
"entry",
"snapshot",
"management",
"methods",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L481-L496 | train |
contentful/contentful-management.py | contentful_management/client.py | Client.content_type_snapshots | def content_type_snapshots(self, space_id, environment_id, content_type_id):
"""
Provides access to content type snapshot management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots
:return: :class:`SnapshotsProx... | python | def content_type_snapshots(self, space_id, environment_id, content_type_id):
"""
Provides access to content type snapshot management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots
:return: :class:`SnapshotsProx... | [
"def",
"content_type_snapshots",
"(",
"self",
",",
"space_id",
",",
"environment_id",
",",
"content_type_id",
")",
":",
"return",
"SnapshotsProxy",
"(",
"self",
",",
"space_id",
",",
"environment_id",
",",
"content_type_id",
",",
"'content_types'",
")"
] | Provides access to content type snapshot management methods.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots
:return: :class:`SnapshotsProxy <contentful_management.snapshots_proxy.SnapshotsProxy>` object.
:rtype: contentful.snap... | [
"Provides",
"access",
"to",
"content",
"type",
"snapshot",
"management",
"methods",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L498-L513 | train |
contentful/contentful-management.py | contentful_management/client.py | Client._validate_configuration | def _validate_configuration(self):
"""
Validates that required parameters are present.
"""
if not self.access_token:
raise ConfigurationException(
'You will need to initialize a client with an Access Token'
)
if not self.api_url:
... | python | def _validate_configuration(self):
"""
Validates that required parameters are present.
"""
if not self.access_token:
raise ConfigurationException(
'You will need to initialize a client with an Access Token'
)
if not self.api_url:
... | [
"def",
"_validate_configuration",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"access_token",
":",
"raise",
"ConfigurationException",
"(",
"'You will need to initialize a client with an Access Token'",
")",
"if",
"not",
"self",
".",
"api_url",
":",
"raise",
"Conf... | Validates that required parameters are present. | [
"Validates",
"that",
"required",
"parameters",
"are",
"present",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L549-L569 | train |
contentful/contentful-management.py | contentful_management/client.py | Client._contentful_user_agent | def _contentful_user_agent(self):
"""
Sets the X-Contentful-User-Agent header.
"""
header = {}
from . import __version__
header['sdk'] = {
'name': 'contentful-management.py',
'version': __version__
}
header['app'] = {
'n... | python | def _contentful_user_agent(self):
"""
Sets the X-Contentful-User-Agent header.
"""
header = {}
from . import __version__
header['sdk'] = {
'name': 'contentful-management.py',
'version': __version__
}
header['app'] = {
'n... | [
"def",
"_contentful_user_agent",
"(",
"self",
")",
":",
"header",
"=",
"{",
"}",
"from",
".",
"import",
"__version__",
"header",
"[",
"'sdk'",
"]",
"=",
"{",
"'name'",
":",
"'contentful-management.py'",
",",
"'version'",
":",
"__version__",
"}",
"header",
"[... | Sets the X-Contentful-User-Agent header. | [
"Sets",
"the",
"X",
"-",
"Contentful",
"-",
"User",
"-",
"Agent",
"header",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L571-L618 | train |
contentful/contentful-management.py | contentful_management/client.py | Client._url | def _url(self, url, file_upload=False):
"""
Creates the request URL.
"""
host = self.api_url
if file_upload:
host = self.uploads_api_url
protocol = 'https' if self.https else 'http'
if url.endswith('/'):
url = url[:-1]
return '{0}... | python | def _url(self, url, file_upload=False):
"""
Creates the request URL.
"""
host = self.api_url
if file_upload:
host = self.uploads_api_url
protocol = 'https' if self.https else 'http'
if url.endswith('/'):
url = url[:-1]
return '{0}... | [
"def",
"_url",
"(",
"self",
",",
"url",
",",
"file_upload",
"=",
"False",
")",
":",
"host",
"=",
"self",
".",
"api_url",
"if",
"file_upload",
":",
"host",
"=",
"self",
".",
"uploads_api_url",
"protocol",
"=",
"'https'",
"if",
"self",
".",
"https",
"els... | Creates the request URL. | [
"Creates",
"the",
"request",
"URL",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L641-L657 | train |
contentful/contentful-management.py | contentful_management/client.py | Client._http_request | def _http_request(self, method, url, request_kwargs=None):
"""
Performs the requested HTTP request.
"""
kwargs = request_kwargs if request_kwargs is not None else {}
headers = self._request_headers()
headers.update(self.additional_headers)
if 'headers' in kwargs... | python | def _http_request(self, method, url, request_kwargs=None):
"""
Performs the requested HTTP request.
"""
kwargs = request_kwargs if request_kwargs is not None else {}
headers = self._request_headers()
headers.update(self.additional_headers)
if 'headers' in kwargs... | [
"def",
"_http_request",
"(",
"self",
",",
"method",
",",
"url",
",",
"request_kwargs",
"=",
"None",
")",
":",
"kwargs",
"=",
"request_kwargs",
"if",
"request_kwargs",
"is",
"not",
"None",
"else",
"{",
"}",
"headers",
"=",
"self",
".",
"_request_headers",
"... | Performs the requested HTTP request. | [
"Performs",
"the",
"requested",
"HTTP",
"request",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L669-L696 | train |
contentful/contentful-management.py | contentful_management/client.py | Client._http_get | def _http_get(self, url, query, **kwargs):
"""
Performs the HTTP GET request.
"""
self._normalize_query(query)
kwargs.update({'params': query})
return self._http_request('get', url, kwargs) | python | def _http_get(self, url, query, **kwargs):
"""
Performs the HTTP GET request.
"""
self._normalize_query(query)
kwargs.update({'params': query})
return self._http_request('get', url, kwargs) | [
"def",
"_http_get",
"(",
"self",
",",
"url",
",",
"query",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_normalize_query",
"(",
"query",
")",
"kwargs",
".",
"update",
"(",
"{",
"'params'",
":",
"query",
"}",
")",
"return",
"self",
".",
"_http_req... | Performs the HTTP GET request. | [
"Performs",
"the",
"HTTP",
"GET",
"request",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L698-L707 | train |
contentful/contentful-management.py | contentful_management/client.py | Client._http_post | def _http_post(self, url, data, **kwargs):
"""
Performs the HTTP POST request.
"""
if not kwargs.get('file_upload', False):
data = json.dumps(data)
kwargs.update({'data': data})
return self._http_request('post', url, kwargs) | python | def _http_post(self, url, data, **kwargs):
"""
Performs the HTTP POST request.
"""
if not kwargs.get('file_upload', False):
data = json.dumps(data)
kwargs.update({'data': data})
return self._http_request('post', url, kwargs) | [
"def",
"_http_post",
"(",
"self",
",",
"url",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"kwargs",
".",
"get",
"(",
"'file_upload'",
",",
"False",
")",
":",
"data",
"=",
"json",
".",
"dumps",
"(",
"data",
")",
"kwargs",
".",
"up... | Performs the HTTP POST request. | [
"Performs",
"the",
"HTTP",
"POST",
"request",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L709-L719 | train |
contentful/contentful-management.py | contentful_management/client.py | Client._http_put | def _http_put(self, url, data, **kwargs):
"""
Performs the HTTP PUT request.
"""
kwargs.update({'data': json.dumps(data)})
return self._http_request('put', url, kwargs) | python | def _http_put(self, url, data, **kwargs):
"""
Performs the HTTP PUT request.
"""
kwargs.update({'data': json.dumps(data)})
return self._http_request('put', url, kwargs) | [
"def",
"_http_put",
"(",
"self",
",",
"url",
",",
"data",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
".",
"update",
"(",
"{",
"'data'",
":",
"json",
".",
"dumps",
"(",
"data",
")",
"}",
")",
"return",
"self",
".",
"_http_request",
"(",
"'put'",
... | Performs the HTTP PUT request. | [
"Performs",
"the",
"HTTP",
"PUT",
"request",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L721-L728 | train |
contentful/contentful-management.py | contentful_management/client.py | Client._request | def _request(self, method, url, query_or_data=None, **kwargs):
"""
Wrapper for the HTTP requests,
rate limit backoff is handled here,
responses are processed with ResourceBuilder.
"""
if query_or_data is None:
query_or_data = {}
request_method = geta... | python | def _request(self, method, url, query_or_data=None, **kwargs):
"""
Wrapper for the HTTP requests,
rate limit backoff is handled here,
responses are processed with ResourceBuilder.
"""
if query_or_data is None:
query_or_data = {}
request_method = geta... | [
"def",
"_request",
"(",
"self",
",",
"method",
",",
"url",
",",
"query_or_data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"query_or_data",
"is",
"None",
":",
"query_or_data",
"=",
"{",
"}",
"request_method",
"=",
"getattr",
"(",
"self",
",... | Wrapper for the HTTP requests,
rate limit backoff is handled here,
responses are processed with ResourceBuilder. | [
"Wrapper",
"for",
"the",
"HTTP",
"requests",
"rate",
"limit",
"backoff",
"is",
"handled",
"here",
"responses",
"are",
"processed",
"with",
"ResourceBuilder",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L737-L767 | train |
contentful/contentful-management.py | contentful_management/client.py | Client._get | def _get(self, url, query=None, **kwargs):
"""
Wrapper for the HTTP GET request.
"""
return self._request('get', url, query, **kwargs) | python | def _get(self, url, query=None, **kwargs):
"""
Wrapper for the HTTP GET request.
"""
return self._request('get', url, query, **kwargs) | [
"def",
"_get",
"(",
"self",
",",
"url",
",",
"query",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_request",
"(",
"'get'",
",",
"url",
",",
"query",
",",
"*",
"*",
"kwargs",
")"
] | Wrapper for the HTTP GET request. | [
"Wrapper",
"for",
"the",
"HTTP",
"GET",
"request",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L769-L774 | train |
contentful/contentful-management.py | contentful_management/client.py | Client._post | def _post(self, url, attributes=None, **kwargs):
"""
Wrapper for the HTTP POST request.
"""
return self._request('post', url, attributes, **kwargs) | python | def _post(self, url, attributes=None, **kwargs):
"""
Wrapper for the HTTP POST request.
"""
return self._request('post', url, attributes, **kwargs) | [
"def",
"_post",
"(",
"self",
",",
"url",
",",
"attributes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_request",
"(",
"'post'",
",",
"url",
",",
"attributes",
",",
"*",
"*",
"kwargs",
")"
] | Wrapper for the HTTP POST request. | [
"Wrapper",
"for",
"the",
"HTTP",
"POST",
"request",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L776-L781 | train |
contentful/contentful-management.py | contentful_management/client.py | Client._put | def _put(self, url, attributes=None, **kwargs):
"""
Wrapper for the HTTP PUT request.
"""
return self._request('put', url, attributes, **kwargs) | python | def _put(self, url, attributes=None, **kwargs):
"""
Wrapper for the HTTP PUT request.
"""
return self._request('put', url, attributes, **kwargs) | [
"def",
"_put",
"(",
"self",
",",
"url",
",",
"attributes",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_request",
"(",
"'put'",
",",
"url",
",",
"attributes",
",",
"*",
"*",
"kwargs",
")"
] | Wrapper for the HTTP PUT request. | [
"Wrapper",
"for",
"the",
"HTTP",
"PUT",
"request",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L783-L788 | train |
contentful/contentful-management.py | contentful_management/client.py | Client._delete | def _delete(self, url, **kwargs):
"""
Wrapper for the HTTP DELETE request.
"""
response = retry_request(self)(self._http_delete)(url, **kwargs)
if self.raw_mode:
return response
if response.status_code >= 300:
error = get_error(response)
... | python | def _delete(self, url, **kwargs):
"""
Wrapper for the HTTP DELETE request.
"""
response = retry_request(self)(self._http_delete)(url, **kwargs)
if self.raw_mode:
return response
if response.status_code >= 300:
error = get_error(response)
... | [
"def",
"_delete",
"(",
"self",
",",
"url",
",",
"*",
"*",
"kwargs",
")",
":",
"response",
"=",
"retry_request",
"(",
"self",
")",
"(",
"self",
".",
"_http_delete",
")",
"(",
"url",
",",
"*",
"*",
"kwargs",
")",
"if",
"self",
".",
"raw_mode",
":",
... | Wrapper for the HTTP DELETE request. | [
"Wrapper",
"for",
"the",
"HTTP",
"DELETE",
"request",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client.py#L790-L806 | train |
contentful/contentful-management.py | contentful_management/locale.py | Locale.to_json | def to_json(self):
"""
Returns the JSON representation of the locale.
"""
result = super(Locale, self).to_json()
result.update({
'code': self.code,
'name': self.name,
'fallbackCode': self.fallback_code,
'optional': self.optional,
... | python | def to_json(self):
"""
Returns the JSON representation of the locale.
"""
result = super(Locale, self).to_json()
result.update({
'code': self.code,
'name': self.name,
'fallbackCode': self.fallback_code,
'optional': self.optional,
... | [
"def",
"to_json",
"(",
"self",
")",
":",
"result",
"=",
"super",
"(",
"Locale",
",",
"self",
")",
".",
"to_json",
"(",
")",
"result",
".",
"update",
"(",
"{",
"'code'",
":",
"self",
".",
"code",
",",
"'name'",
":",
"self",
".",
"name",
",",
"'fal... | Returns the JSON representation of the locale. | [
"Returns",
"the",
"JSON",
"representation",
"of",
"the",
"locale",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/locale.py#L48-L62 | train |
contentful/contentful-management.py | contentful_management/assets_proxy.py | AssetsProxy.all | def all(self, query=None, **kwargs):
"""
Gets all assets of a space.
"""
if query is None:
query = {}
normalize_select(query)
return super(AssetsProxy, self).all(query, **kwargs) | python | def all(self, query=None, **kwargs):
"""
Gets all assets of a space.
"""
if query is None:
query = {}
normalize_select(query)
return super(AssetsProxy, self).all(query, **kwargs) | [
"def",
"all",
"(",
"self",
",",
"query",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"query",
"is",
"None",
":",
"query",
"=",
"{",
"}",
"normalize_select",
"(",
"query",
")",
"return",
"super",
"(",
"AssetsProxy",
",",
"self",
")",
".",
... | Gets all assets of a space. | [
"Gets",
"all",
"assets",
"of",
"a",
"space",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/assets_proxy.py#L28-L38 | train |
contentful/contentful-management.py | contentful_management/assets_proxy.py | AssetsProxy.find | def find(self, asset_id, query=None, **kwargs):
"""
Gets a single asset by ID.
"""
if query is None:
query = {}
normalize_select(query)
return super(AssetsProxy, self).find(asset_id, query=query, **kwargs) | python | def find(self, asset_id, query=None, **kwargs):
"""
Gets a single asset by ID.
"""
if query is None:
query = {}
normalize_select(query)
return super(AssetsProxy, self).find(asset_id, query=query, **kwargs) | [
"def",
"find",
"(",
"self",
",",
"asset_id",
",",
"query",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"query",
"is",
"None",
":",
"query",
"=",
"{",
"}",
"normalize_select",
"(",
"query",
")",
"return",
"super",
"(",
"AssetsProxy",
",",
... | Gets a single asset by ID. | [
"Gets",
"a",
"single",
"asset",
"by",
"ID",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/assets_proxy.py#L40-L50 | train |
contentful/contentful-management.py | contentful_management/entry.py | Entry.snapshots | def snapshots(self):
"""
Provides access to snapshot management methods for the given entry.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots
:return: :class:`EntrySnapshotsProxy <contentful_management.entry_snapshots_pro... | python | def snapshots(self):
"""
Provides access to snapshot management methods for the given entry.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots
:return: :class:`EntrySnapshotsProxy <contentful_management.entry_snapshots_pro... | [
"def",
"snapshots",
"(",
"self",
")",
":",
"return",
"EntrySnapshotsProxy",
"(",
"self",
".",
"_client",
",",
"self",
".",
"sys",
"[",
"'space'",
"]",
".",
"id",
",",
"self",
".",
"_environment_id",
",",
"self",
".",
"sys",
"[",
"'id'",
"]",
")"
] | Provides access to snapshot management methods for the given entry.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/snapshots
:return: :class:`EntrySnapshotsProxy <contentful_management.entry_snapshots_proxy.EntrySnapshotsProxy>` object.
... | [
"Provides",
"access",
"to",
"snapshot",
"management",
"methods",
"for",
"the",
"given",
"entry",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/entry.py#L38-L52 | train |
contentful/contentful-management.py | contentful_management/entry.py | Entry.update | def update(self, attributes=None):
"""
Updates the entry with attributes.
"""
if attributes is None:
attributes = {}
attributes['content_type_id'] = self.sys['content_type'].id
return super(Entry, self).update(attributes) | python | def update(self, attributes=None):
"""
Updates the entry with attributes.
"""
if attributes is None:
attributes = {}
attributes['content_type_id'] = self.sys['content_type'].id
return super(Entry, self).update(attributes) | [
"def",
"update",
"(",
"self",
",",
"attributes",
"=",
"None",
")",
":",
"if",
"attributes",
"is",
"None",
":",
"attributes",
"=",
"{",
"}",
"attributes",
"[",
"'content_type_id'",
"]",
"=",
"self",
".",
"sys",
"[",
"'content_type'",
"]",
".",
"id",
"re... | Updates the entry with attributes. | [
"Updates",
"the",
"entry",
"with",
"attributes",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/entry.py#L54-L64 | train |
contentful/contentful-management.py | contentful_management/client_proxy.py | ClientProxy.all | def all(self, query=None):
"""
Gets resource collection for _resource_class.
"""
if query is None:
query = {}
return self.client._get(
self._url(),
query
) | python | def all(self, query=None):
"""
Gets resource collection for _resource_class.
"""
if query is None:
query = {}
return self.client._get(
self._url(),
query
) | [
"def",
"all",
"(",
"self",
",",
"query",
"=",
"None",
")",
":",
"if",
"query",
"is",
"None",
":",
"query",
"=",
"{",
"}",
"return",
"self",
".",
"client",
".",
"_get",
"(",
"self",
".",
"_url",
"(",
")",
",",
"query",
")"
] | Gets resource collection for _resource_class. | [
"Gets",
"resource",
"collection",
"for",
"_resource_class",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client_proxy.py#L33-L43 | train |
contentful/contentful-management.py | contentful_management/client_proxy.py | ClientProxy.find | def find(self, resource_id, query=None, **kwargs):
"""Gets a single resource."""
if query is None:
query = {}
return self.client._get(
self._url(resource_id),
query,
**kwargs
) | python | def find(self, resource_id, query=None, **kwargs):
"""Gets a single resource."""
if query is None:
query = {}
return self.client._get(
self._url(resource_id),
query,
**kwargs
) | [
"def",
"find",
"(",
"self",
",",
"resource_id",
",",
"query",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"query",
"is",
"None",
":",
"query",
"=",
"{",
"}",
"return",
"self",
".",
"client",
".",
"_get",
"(",
"self",
".",
"_url",
"(",
... | Gets a single resource. | [
"Gets",
"a",
"single",
"resource",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client_proxy.py#L45-L54 | train |
contentful/contentful-management.py | contentful_management/client_proxy.py | ClientProxy.create | def create(self, resource_id=None, attributes=None):
"""
Creates a resource with the given ID (optional) and attributes.
"""
if attributes is None:
attributes = {}
result = None
if not resource_id:
result = self.client._post(
self... | python | def create(self, resource_id=None, attributes=None):
"""
Creates a resource with the given ID (optional) and attributes.
"""
if attributes is None:
attributes = {}
result = None
if not resource_id:
result = self.client._post(
self... | [
"def",
"create",
"(",
"self",
",",
"resource_id",
"=",
"None",
",",
"attributes",
"=",
"None",
")",
":",
"if",
"attributes",
"is",
"None",
":",
"attributes",
"=",
"{",
"}",
"result",
"=",
"None",
"if",
"not",
"resource_id",
":",
"result",
"=",
"self",
... | Creates a resource with the given ID (optional) and attributes. | [
"Creates",
"a",
"resource",
"with",
"the",
"given",
"ID",
"(",
"optional",
")",
"and",
"attributes",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client_proxy.py#L56-L78 | train |
contentful/contentful-management.py | contentful_management/client_proxy.py | ClientProxy.delete | def delete(self, resource_id, **kwargs):
"""
Deletes a resource by ID.
"""
return self.client._delete(self._url(resource_id), **kwargs) | python | def delete(self, resource_id, **kwargs):
"""
Deletes a resource by ID.
"""
return self.client._delete(self._url(resource_id), **kwargs) | [
"def",
"delete",
"(",
"self",
",",
"resource_id",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"_delete",
"(",
"self",
".",
"_url",
"(",
"resource_id",
")",
",",
"*",
"*",
"kwargs",
")"
] | Deletes a resource by ID. | [
"Deletes",
"a",
"resource",
"by",
"ID",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/client_proxy.py#L80-L85 | train |
contentful/contentful-management.py | contentful_management/role.py | Role.to_json | def to_json(self):
"""
Returns the JSON representation of the role.
"""
result = super(Role, self).to_json()
result.update({
'name': self.name,
'description': self.description,
'permissions': self.permissions,
'policies': self.poli... | python | def to_json(self):
"""
Returns the JSON representation of the role.
"""
result = super(Role, self).to_json()
result.update({
'name': self.name,
'description': self.description,
'permissions': self.permissions,
'policies': self.poli... | [
"def",
"to_json",
"(",
"self",
")",
":",
"result",
"=",
"super",
"(",
"Role",
",",
"self",
")",
".",
"to_json",
"(",
")",
"result",
".",
"update",
"(",
"{",
"'name'",
":",
"self",
".",
"name",
",",
"'description'",
":",
"self",
".",
"description",
... | Returns the JSON representation of the role. | [
"Returns",
"the",
"JSON",
"representation",
"of",
"the",
"role",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/role.py#L42-L54 | train |
contentful/contentful-management.py | contentful_management/space_membership.py | SpaceMembership.to_json | def to_json(self):
"""
Returns the JSON representation of the space membership.
"""
result = super(SpaceMembership, self).to_json()
result.update({
'admin': self.admin,
'roles': self.roles
})
return result | python | def to_json(self):
"""
Returns the JSON representation of the space membership.
"""
result = super(SpaceMembership, self).to_json()
result.update({
'admin': self.admin,
'roles': self.roles
})
return result | [
"def",
"to_json",
"(",
"self",
")",
":",
"result",
"=",
"super",
"(",
"SpaceMembership",
",",
"self",
")",
".",
"to_json",
"(",
")",
"result",
".",
"update",
"(",
"{",
"'admin'",
":",
"self",
".",
"admin",
",",
"'roles'",
":",
"self",
".",
"roles",
... | Returns the JSON representation of the space membership. | [
"Returns",
"the",
"JSON",
"representation",
"of",
"the",
"space",
"membership",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/space_membership.py#L28-L38 | train |
contentful/contentful-management.py | contentful_management/uploads_proxy.py | UploadsProxy.create | def create(self, file_or_path, **kwargs):
"""
Creates an upload for the given file or path.
"""
opened = False
if isinstance(file_or_path, str_type()):
file_or_path = open(file_or_path, 'rb')
opened = True
elif not getattr(file_or_path, 'read', Fa... | python | def create(self, file_or_path, **kwargs):
"""
Creates an upload for the given file or path.
"""
opened = False
if isinstance(file_or_path, str_type()):
file_or_path = open(file_or_path, 'rb')
opened = True
elif not getattr(file_or_path, 'read', Fa... | [
"def",
"create",
"(",
"self",
",",
"file_or_path",
",",
"*",
"*",
"kwargs",
")",
":",
"opened",
"=",
"False",
"if",
"isinstance",
"(",
"file_or_path",
",",
"str_type",
"(",
")",
")",
":",
"file_or_path",
"=",
"open",
"(",
"file_or_path",
",",
"'rb'",
"... | Creates an upload for the given file or path. | [
"Creates",
"an",
"upload",
"for",
"the",
"given",
"file",
"or",
"path",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/uploads_proxy.py#L35-L56 | train |
contentful/contentful-management.py | contentful_management/uploads_proxy.py | UploadsProxy.find | def find(self, upload_id, **kwargs):
"""
Finds an upload by ID.
"""
return super(UploadsProxy, self).find(upload_id, file_upload=True) | python | def find(self, upload_id, **kwargs):
"""
Finds an upload by ID.
"""
return super(UploadsProxy, self).find(upload_id, file_upload=True) | [
"def",
"find",
"(",
"self",
",",
"upload_id",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"super",
"(",
"UploadsProxy",
",",
"self",
")",
".",
"find",
"(",
"upload_id",
",",
"file_upload",
"=",
"True",
")"
] | Finds an upload by ID. | [
"Finds",
"an",
"upload",
"by",
"ID",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/uploads_proxy.py#L58-L63 | train |
contentful/contentful-management.py | contentful_management/uploads_proxy.py | UploadsProxy.delete | def delete(self, upload_id):
"""
Deletes an upload by ID.
"""
return super(UploadsProxy, self).delete(upload_id, file_upload=True) | python | def delete(self, upload_id):
"""
Deletes an upload by ID.
"""
return super(UploadsProxy, self).delete(upload_id, file_upload=True) | [
"def",
"delete",
"(",
"self",
",",
"upload_id",
")",
":",
"return",
"super",
"(",
"UploadsProxy",
",",
"self",
")",
".",
"delete",
"(",
"upload_id",
",",
"file_upload",
"=",
"True",
")"
] | Deletes an upload by ID. | [
"Deletes",
"an",
"upload",
"by",
"ID",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/uploads_proxy.py#L65-L70 | train |
contentful/contentful-management.py | contentful_management/content_type_field.py | ContentTypeField.to_json | def to_json(self):
"""
Returns the JSON Representation of the content type field.
"""
result = {
'name': self.name,
'id': self._real_id(),
'type': self.type,
'localized': self.localized,
'omitted': self.omitted,
're... | python | def to_json(self):
"""
Returns the JSON Representation of the content type field.
"""
result = {
'name': self.name,
'id': self._real_id(),
'type': self.type,
'localized': self.localized,
'omitted': self.omitted,
're... | [
"def",
"to_json",
"(",
"self",
")",
":",
"result",
"=",
"{",
"'name'",
":",
"self",
".",
"name",
",",
"'id'",
":",
"self",
".",
"_real_id",
"(",
")",
",",
"'type'",
":",
"self",
".",
"type",
",",
"'localized'",
":",
"self",
".",
"localized",
",",
... | Returns the JSON Representation of the content type field. | [
"Returns",
"the",
"JSON",
"Representation",
"of",
"the",
"content",
"type",
"field",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type_field.py#L38-L60 | train |
contentful/contentful-management.py | contentful_management/content_type_field_types.py | LocationField.coerce | def coerce(self, value):
"""
Coerces value to location hash.
"""
return {
'lat': float(value.get('lat', value.get('latitude'))),
'lon': float(value.get('lon', value.get('longitude')))
} | python | def coerce(self, value):
"""
Coerces value to location hash.
"""
return {
'lat': float(value.get('lat', value.get('latitude'))),
'lon': float(value.get('lon', value.get('longitude')))
} | [
"def",
"coerce",
"(",
"self",
",",
"value",
")",
":",
"return",
"{",
"'lat'",
":",
"float",
"(",
"value",
".",
"get",
"(",
"'lat'",
",",
"value",
".",
"get",
"(",
"'latitude'",
")",
")",
")",
",",
"'lon'",
":",
"float",
"(",
"value",
".",
"get",
... | Coerces value to location hash. | [
"Coerces",
"value",
"to",
"location",
"hash",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type_field_types.py#L167-L175 | train |
contentful/contentful-management.py | contentful_management/snapshot.py | Snapshot.base_url | def base_url(klass, space_id, parent_resource_id, resource_url='entries', resource_id=None, environment_id=None):
"""
Returns the URI for the snapshot.
"""
return "spaces/{0}{1}/{2}/{3}/snapshots/{4}".format(
space_id,
'/environments/{0}'.format(environment_id) i... | python | def base_url(klass, space_id, parent_resource_id, resource_url='entries', resource_id=None, environment_id=None):
"""
Returns the URI for the snapshot.
"""
return "spaces/{0}{1}/{2}/{3}/snapshots/{4}".format(
space_id,
'/environments/{0}'.format(environment_id) i... | [
"def",
"base_url",
"(",
"klass",
",",
"space_id",
",",
"parent_resource_id",
",",
"resource_url",
"=",
"'entries'",
",",
"resource_id",
"=",
"None",
",",
"environment_id",
"=",
"None",
")",
":",
"return",
"\"spaces/{0}{1}/{2}/{3}/snapshots/{4}\"",
".",
"format",
"... | Returns the URI for the snapshot. | [
"Returns",
"the",
"URI",
"for",
"the",
"snapshot",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/snapshot.py#L38-L49 | train |
contentful/contentful-management.py | contentful_management/snapshot.py | Snapshot.to_json | def to_json(self):
"""
Returns the JSON representation of the snapshot.
"""
result = super(Snapshot, self).to_json()
result.update({
'snapshot': self.snapshot.to_json(),
})
return result | python | def to_json(self):
"""
Returns the JSON representation of the snapshot.
"""
result = super(Snapshot, self).to_json()
result.update({
'snapshot': self.snapshot.to_json(),
})
return result | [
"def",
"to_json",
"(",
"self",
")",
":",
"result",
"=",
"super",
"(",
"Snapshot",
",",
"self",
")",
".",
"to_json",
"(",
")",
"result",
".",
"update",
"(",
"{",
"'snapshot'",
":",
"self",
".",
"snapshot",
".",
"to_json",
"(",
")",
",",
"}",
")",
... | Returns the JSON representation of the snapshot. | [
"Returns",
"the",
"JSON",
"representation",
"of",
"the",
"snapshot",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/snapshot.py#L51-L60 | train |
contentful/contentful-management.py | contentful_management/usage_periods_proxy.py | UsagePeriodsProxy.all | def all(self, *args, **kwargs):
"""
Gets all usage periods.
"""
return self.client._get(
self._url(),
{},
headers={
'x-contentful-enable-alpha-feature': 'usage-insights'
}
) | python | def all(self, *args, **kwargs):
"""
Gets all usage periods.
"""
return self.client._get(
self._url(),
{},
headers={
'x-contentful-enable-alpha-feature': 'usage-insights'
}
) | [
"def",
"all",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"client",
".",
"_get",
"(",
"self",
".",
"_url",
"(",
")",
",",
"{",
"}",
",",
"headers",
"=",
"{",
"'x-contentful-enable-alpha-feature'",
":",
"... | Gets all usage periods. | [
"Gets",
"all",
"usage",
"periods",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/usage_periods_proxy.py#L31-L42 | train |
contentful/contentful-management.py | contentful_management/webhook.py | Webhook.create_attributes | def create_attributes(klass, attributes, previous_object=None):
"""
Attributes for webhook creation.
"""
result = super(Webhook, klass).create_attributes(attributes, previous_object)
if 'topics' not in result:
raise Exception("Topics ('topics') must be provided for ... | python | def create_attributes(klass, attributes, previous_object=None):
"""
Attributes for webhook creation.
"""
result = super(Webhook, klass).create_attributes(attributes, previous_object)
if 'topics' not in result:
raise Exception("Topics ('topics') must be provided for ... | [
"def",
"create_attributes",
"(",
"klass",
",",
"attributes",
",",
"previous_object",
"=",
"None",
")",
":",
"result",
"=",
"super",
"(",
"Webhook",
",",
"klass",
")",
".",
"create_attributes",
"(",
"attributes",
",",
"previous_object",
")",
"if",
"'topics'",
... | Attributes for webhook creation. | [
"Attributes",
"for",
"webhook",
"creation",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/webhook.py#L51-L60 | train |
contentful/contentful-management.py | contentful_management/webhook.py | Webhook.calls | def calls(self):
"""
Provides access to call overview for the given webhook.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls
:return: :class:`WebhookWebhooksCallProxy <contentful_management.webhook_webhooks_call_prox... | python | def calls(self):
"""
Provides access to call overview for the given webhook.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls
:return: :class:`WebhookWebhooksCallProxy <contentful_management.webhook_webhooks_call_prox... | [
"def",
"calls",
"(",
"self",
")",
":",
"return",
"WebhookWebhooksCallProxy",
"(",
"self",
".",
"_client",
",",
"self",
".",
"sys",
"[",
"'space'",
"]",
".",
"id",
",",
"self",
".",
"sys",
"[",
"'id'",
"]",
")"
] | Provides access to call overview for the given webhook.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls
:return: :class:`WebhookWebhooksCallProxy <contentful_management.webhook_webhooks_call_proxy.WebhookWebhooksCallProxy>` object.
... | [
"Provides",
"access",
"to",
"call",
"overview",
"for",
"the",
"given",
"webhook",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/webhook.py#L62-L76 | train |
contentful/contentful-management.py | contentful_management/webhook.py | Webhook.health | def health(self):
"""
Provides access to health overview for the given webhook.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls/webhook-health
:return: :class:`WebhookWebhooksHealthProxy <contentful_management.webhoo... | python | def health(self):
"""
Provides access to health overview for the given webhook.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls/webhook-health
:return: :class:`WebhookWebhooksHealthProxy <contentful_management.webhoo... | [
"def",
"health",
"(",
"self",
")",
":",
"return",
"WebhookWebhooksHealthProxy",
"(",
"self",
".",
"_client",
",",
"self",
".",
"sys",
"[",
"'space'",
"]",
".",
"id",
",",
"self",
".",
"sys",
"[",
"'id'",
"]",
")"
] | Provides access to health overview for the given webhook.
API reference: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/webhook-calls/webhook-health
:return: :class:`WebhookWebhooksHealthProxy <contentful_management.webhook_webhooks_health_proxy.WebhookWebhook... | [
"Provides",
"access",
"to",
"health",
"overview",
"for",
"the",
"given",
"webhook",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/webhook.py#L78-L92 | train |
contentful/contentful-management.py | contentful_management/webhook.py | Webhook.to_json | def to_json(self):
"""
Returns the JSON representation of the webhook.
"""
result = super(Webhook, self).to_json()
result.update({
'name': self.name,
'url': self.url,
'topics': self.topics,
'httpBasicUsername': self.http_basic_user... | python | def to_json(self):
"""
Returns the JSON representation of the webhook.
"""
result = super(Webhook, self).to_json()
result.update({
'name': self.name,
'url': self.url,
'topics': self.topics,
'httpBasicUsername': self.http_basic_user... | [
"def",
"to_json",
"(",
"self",
")",
":",
"result",
"=",
"super",
"(",
"Webhook",
",",
"self",
")",
".",
"to_json",
"(",
")",
"result",
".",
"update",
"(",
"{",
"'name'",
":",
"self",
".",
"name",
",",
"'url'",
":",
"self",
".",
"url",
",",
"'topi... | Returns the JSON representation of the webhook. | [
"Returns",
"the",
"JSON",
"representation",
"of",
"the",
"webhook",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/webhook.py#L94-L114 | train |
contentful/contentful-management.py | contentful_management/editor_interface.py | EditorInterface.base_url | def base_url(self, space_id, content_type_id, environment_id=None, **kwargs):
"""
Returns the URI for the editor interface.
"""
return "spaces/{0}{1}/content_types/{2}/editor_interface".format(
space_id,
'/environments/{0}'.format(environment_id) if environment_i... | python | def base_url(self, space_id, content_type_id, environment_id=None, **kwargs):
"""
Returns the URI for the editor interface.
"""
return "spaces/{0}{1}/content_types/{2}/editor_interface".format(
space_id,
'/environments/{0}'.format(environment_id) if environment_i... | [
"def",
"base_url",
"(",
"self",
",",
"space_id",
",",
"content_type_id",
",",
"environment_id",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"\"spaces/{0}{1}/content_types/{2}/editor_interface\"",
".",
"format",
"(",
"space_id",
",",
"'/environments/{0}... | Returns the URI for the editor interface. | [
"Returns",
"the",
"URI",
"for",
"the",
"editor",
"interface",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/editor_interface.py#L27-L36 | train |
contentful/contentful-management.py | contentful_management/editor_interface.py | EditorInterface.to_json | def to_json(self):
"""
Returns the JSON representation of the editor interface.
"""
result = super(EditorInterface, self).to_json()
result.update({'controls': self.controls})
return result | python | def to_json(self):
"""
Returns the JSON representation of the editor interface.
"""
result = super(EditorInterface, self).to_json()
result.update({'controls': self.controls})
return result | [
"def",
"to_json",
"(",
"self",
")",
":",
"result",
"=",
"super",
"(",
"EditorInterface",
",",
"self",
")",
".",
"to_json",
"(",
")",
"result",
".",
"update",
"(",
"{",
"'controls'",
":",
"self",
".",
"controls",
"}",
")",
"return",
"result"
] | Returns the JSON representation of the editor interface. | [
"Returns",
"the",
"JSON",
"representation",
"of",
"the",
"editor",
"interface",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/editor_interface.py#L46-L53 | train |
contentful/contentful-management.py | contentful_management/content_type_field_validation.py | ContentTypeFieldValidation.to_json | def to_json(self):
"""
Returns the JSON Representation of the content type field validation.
"""
result = {}
for k, v in self._data.items():
result[camel_case(k)] = v
return result | python | def to_json(self):
"""
Returns the JSON Representation of the content type field validation.
"""
result = {}
for k, v in self._data.items():
result[camel_case(k)] = v
return result | [
"def",
"to_json",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"k",
",",
"v",
"in",
"self",
".",
"_data",
".",
"items",
"(",
")",
":",
"result",
"[",
"camel_case",
"(",
"k",
")",
"]",
"=",
"v",
"return",
"result"
] | Returns the JSON Representation of the content type field validation. | [
"Returns",
"the",
"JSON",
"Representation",
"of",
"the",
"content",
"type",
"field",
"validation",
"."
] | 707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0 | https://github.com/contentful/contentful-management.py/blob/707dd30883b98a10c7ff0f7f5bdb8edbdc1d8df0/contentful_management/content_type_field_validation.py#L28-L36 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.