repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
rochacbruno/dynaconf | dynaconf/base.py | Settings.load_file | def load_file(self, path=None, env=None, silent=True, key=None):
"""Programmatically load files from ``path``.
:param path: A single filename or a file list
:param env: Which env to load from file (default current_env)
:param silent: Should raise errors?
:param key: Load a singl... | python | def load_file(self, path=None, env=None, silent=True, key=None):
"""Programmatically load files from ``path``.
:param path: A single filename or a file list
:param env: Which env to load from file (default current_env)
:param silent: Should raise errors?
:param key: Load a singl... | [
"def",
"load_file",
"(",
"self",
",",
"path",
"=",
"None",
",",
"env",
"=",
"None",
",",
"silent",
"=",
"True",
",",
"key",
"=",
"None",
")",
":",
"env",
"=",
"(",
"env",
"or",
"self",
".",
"current_env",
")",
".",
"upper",
"(",
")",
"files",
"... | Programmatically load files from ``path``.
:param path: A single filename or a file list
:param env: Which env to load from file (default current_env)
:param silent: Should raise errors?
:param key: Load a single key? | [
"Programmatically",
"load",
"files",
"from",
"path",
"."
] | 5a7cc8f8252251cbdf4f4112965801f9dfe2831d | https://github.com/rochacbruno/dynaconf/blob/5a7cc8f8252251cbdf4f4112965801f9dfe2831d/dynaconf/base.py#L765-L799 | train |
rochacbruno/dynaconf | dynaconf/base.py | Settings._root_path | def _root_path(self):
"""ROOT_PATH_FOR_DYNACONF or the path of first loaded file or '.'"""
if self.ROOT_PATH_FOR_DYNACONF is not None:
return self.ROOT_PATH_FOR_DYNACONF
elif self._loaded_files: # called once
root_path = os.path.dirname(self._loaded_files[0])
... | python | def _root_path(self):
"""ROOT_PATH_FOR_DYNACONF or the path of first loaded file or '.'"""
if self.ROOT_PATH_FOR_DYNACONF is not None:
return self.ROOT_PATH_FOR_DYNACONF
elif self._loaded_files: # called once
root_path = os.path.dirname(self._loaded_files[0])
... | [
"def",
"_root_path",
"(",
"self",
")",
":",
"if",
"self",
".",
"ROOT_PATH_FOR_DYNACONF",
"is",
"not",
"None",
":",
"return",
"self",
".",
"ROOT_PATH_FOR_DYNACONF",
"elif",
"self",
".",
"_loaded_files",
":",
"root_path",
"=",
"os",
".",
"path",
".",
"dirname"... | ROOT_PATH_FOR_DYNACONF or the path of first loaded file or '. | [
"ROOT_PATH_FOR_DYNACONF",
"or",
"the",
"path",
"of",
"first",
"loaded",
"file",
"or",
"."
] | 5a7cc8f8252251cbdf4f4112965801f9dfe2831d | https://github.com/rochacbruno/dynaconf/blob/5a7cc8f8252251cbdf4f4112965801f9dfe2831d/dynaconf/base.py#L802-L809 | train |
rochacbruno/dynaconf | dynaconf/base.py | Settings.load_extra_yaml | def load_extra_yaml(self, env, silent, key):
"""This is deprecated, kept for compat
.. deprecated:: 1.0.0
Use multiple settings or INCLUDES_FOR_DYNACONF files instead.
"""
if self.get("YAML") is not None:
self.logger.warning(
"The use of YAML var ... | python | def load_extra_yaml(self, env, silent, key):
"""This is deprecated, kept for compat
.. deprecated:: 1.0.0
Use multiple settings or INCLUDES_FOR_DYNACONF files instead.
"""
if self.get("YAML") is not None:
self.logger.warning(
"The use of YAML var ... | [
"def",
"load_extra_yaml",
"(",
"self",
",",
"env",
",",
"silent",
",",
"key",
")",
":",
"if",
"self",
".",
"get",
"(",
"\"YAML\"",
")",
"is",
"not",
"None",
":",
"self",
".",
"logger",
".",
"warning",
"(",
"\"The use of YAML var is deprecated, please define ... | This is deprecated, kept for compat
.. deprecated:: 1.0.0
Use multiple settings or INCLUDES_FOR_DYNACONF files instead. | [
"This",
"is",
"deprecated",
"kept",
"for",
"compat"
] | 5a7cc8f8252251cbdf4f4112965801f9dfe2831d | https://github.com/rochacbruno/dynaconf/blob/5a7cc8f8252251cbdf4f4112965801f9dfe2831d/dynaconf/base.py#L811-L831 | train |
rochacbruno/dynaconf | dynaconf/base.py | Settings.path_for | def path_for(self, *args):
"""Path containing _root_path"""
if args and args[0].startswith(os.path.sep):
return os.path.join(*args)
return os.path.join(self._root_path or os.getcwd(), *args) | python | def path_for(self, *args):
"""Path containing _root_path"""
if args and args[0].startswith(os.path.sep):
return os.path.join(*args)
return os.path.join(self._root_path or os.getcwd(), *args) | [
"def",
"path_for",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"args",
"and",
"args",
"[",
"0",
"]",
".",
"startswith",
"(",
"os",
".",
"path",
".",
"sep",
")",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"*",
"args",
")",
"return",
... | Path containing _root_path | [
"Path",
"containing",
"_root_path"
] | 5a7cc8f8252251cbdf4f4112965801f9dfe2831d | https://github.com/rochacbruno/dynaconf/blob/5a7cc8f8252251cbdf4f4112965801f9dfe2831d/dynaconf/base.py#L833-L837 | train |
rochacbruno/dynaconf | dynaconf/base.py | Settings.validators | def validators(self):
"""Gets or creates validator wrapper"""
if not hasattr(self, "_validators"):
self._validators = ValidatorList(self)
return self._validators | python | def validators(self):
"""Gets or creates validator wrapper"""
if not hasattr(self, "_validators"):
self._validators = ValidatorList(self)
return self._validators | [
"def",
"validators",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"_validators\"",
")",
":",
"self",
".",
"_validators",
"=",
"ValidatorList",
"(",
"self",
")",
"return",
"self",
".",
"_validators"
] | Gets or creates validator wrapper | [
"Gets",
"or",
"creates",
"validator",
"wrapper"
] | 5a7cc8f8252251cbdf4f4112965801f9dfe2831d | https://github.com/rochacbruno/dynaconf/blob/5a7cc8f8252251cbdf4f4112965801f9dfe2831d/dynaconf/base.py#L847-L851 | train |
rochacbruno/dynaconf | dynaconf/base.py | Settings.populate_obj | def populate_obj(self, obj, keys=None):
"""Given the `obj` populate it using self.store items."""
keys = keys or self.keys()
for key in keys:
key = key.upper()
value = self.get(key, empty)
if value is not empty:
setattr(obj, key, value) | python | def populate_obj(self, obj, keys=None):
"""Given the `obj` populate it using self.store items."""
keys = keys or self.keys()
for key in keys:
key = key.upper()
value = self.get(key, empty)
if value is not empty:
setattr(obj, key, value) | [
"def",
"populate_obj",
"(",
"self",
",",
"obj",
",",
"keys",
"=",
"None",
")",
":",
"keys",
"=",
"keys",
"or",
"self",
".",
"keys",
"(",
")",
"for",
"key",
"in",
"keys",
":",
"key",
"=",
"key",
".",
"upper",
"(",
")",
"value",
"=",
"self",
".",... | Given the `obj` populate it using self.store items. | [
"Given",
"the",
"obj",
"populate",
"it",
"using",
"self",
".",
"store",
"items",
"."
] | 5a7cc8f8252251cbdf4f4112965801f9dfe2831d | https://github.com/rochacbruno/dynaconf/blob/5a7cc8f8252251cbdf4f4112965801f9dfe2831d/dynaconf/base.py#L878-L885 | train |
rochacbruno/dynaconf | dynaconf/loaders/__init__.py | default_loader | def default_loader(obj, defaults=None):
"""Loads default settings and check if there are overridings
exported as environment variables"""
defaults = defaults or {}
default_settings_values = {
key: value
for key, value in default_settings.__dict__.items() # noqa
if key.isupper()
... | python | def default_loader(obj, defaults=None):
"""Loads default settings and check if there are overridings
exported as environment variables"""
defaults = defaults or {}
default_settings_values = {
key: value
for key, value in default_settings.__dict__.items() # noqa
if key.isupper()
... | [
"def",
"default_loader",
"(",
"obj",
",",
"defaults",
"=",
"None",
")",
":",
"defaults",
"=",
"defaults",
"or",
"{",
"}",
"default_settings_values",
"=",
"{",
"key",
":",
"value",
"for",
"key",
",",
"value",
"in",
"default_settings",
".",
"__dict__",
".",
... | Loads default settings and check if there are overridings
exported as environment variables | [
"Loads",
"default",
"settings",
"and",
"check",
"if",
"there",
"are",
"overridings",
"exported",
"as",
"environment",
"variables"
] | 5a7cc8f8252251cbdf4f4112965801f9dfe2831d | https://github.com/rochacbruno/dynaconf/blob/5a7cc8f8252251cbdf4f4112965801f9dfe2831d/dynaconf/loaders/__init__.py#L15-L56 | train |
rochacbruno/dynaconf | dynaconf/loaders/__init__.py | settings_loader | def settings_loader(
obj, settings_module=None, env=None, silent=True, key=None, filename=None
):
"""Loads from defined settings module
:param obj: A dynaconf instance
:param settings_module: A path or a list of paths e.g settings.toml
:param env: Env to look for data defaults: development
:par... | python | def settings_loader(
obj, settings_module=None, env=None, silent=True, key=None, filename=None
):
"""Loads from defined settings module
:param obj: A dynaconf instance
:param settings_module: A path or a list of paths e.g settings.toml
:param env: Env to look for data defaults: development
:par... | [
"def",
"settings_loader",
"(",
"obj",
",",
"settings_module",
"=",
"None",
",",
"env",
"=",
"None",
",",
"silent",
"=",
"True",
",",
"key",
"=",
"None",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"settings_module",
"="... | Loads from defined settings module
:param obj: A dynaconf instance
:param settings_module: A path or a list of paths e.g settings.toml
:param env: Env to look for data defaults: development
:param silent: Boolean to raise loading errors
:param key: Load a single key if provided
:param filename:... | [
"Loads",
"from",
"defined",
"settings",
"module"
] | 5a7cc8f8252251cbdf4f4112965801f9dfe2831d | https://github.com/rochacbruno/dynaconf/blob/5a7cc8f8252251cbdf4f4112965801f9dfe2831d/dynaconf/loaders/__init__.py#L59-L159 | train |
rochacbruno/dynaconf | dynaconf/loaders/__init__.py | enable_external_loaders | def enable_external_loaders(obj):
"""Enable external service loaders like `VAULT_` and `REDIS_`
looks forenv variables like `REDIS_ENABLED_FOR_DYNACONF`
"""
for name, loader in ct.EXTERNAL_LOADERS.items():
enabled = getattr(
obj, "{}_ENABLED_FOR_DYNACONF".format(name.upper()), False
... | python | def enable_external_loaders(obj):
"""Enable external service loaders like `VAULT_` and `REDIS_`
looks forenv variables like `REDIS_ENABLED_FOR_DYNACONF`
"""
for name, loader in ct.EXTERNAL_LOADERS.items():
enabled = getattr(
obj, "{}_ENABLED_FOR_DYNACONF".format(name.upper()), False
... | [
"def",
"enable_external_loaders",
"(",
"obj",
")",
":",
"for",
"name",
",",
"loader",
"in",
"ct",
".",
"EXTERNAL_LOADERS",
".",
"items",
"(",
")",
":",
"enabled",
"=",
"getattr",
"(",
"obj",
",",
"\"{}_ENABLED_FOR_DYNACONF\"",
".",
"format",
"(",
"name",
"... | Enable external service loaders like `VAULT_` and `REDIS_`
looks forenv variables like `REDIS_ENABLED_FOR_DYNACONF` | [
"Enable",
"external",
"service",
"loaders",
"like",
"VAULT_",
"and",
"REDIS_",
"looks",
"forenv",
"variables",
"like",
"REDIS_ENABLED_FOR_DYNACONF"
] | 5a7cc8f8252251cbdf4f4112965801f9dfe2831d | https://github.com/rochacbruno/dynaconf/blob/5a7cc8f8252251cbdf4f4112965801f9dfe2831d/dynaconf/loaders/__init__.py#L162-L176 | train |
rochacbruno/dynaconf | dynaconf/utils/files.py | _walk_to_root | def _walk_to_root(path, break_at=None):
"""
Directories starting from the given directory up to the root or break_at
"""
if not os.path.exists(path): # pragma: no cover
raise IOError("Starting path not found")
if os.path.isfile(path): # pragma: no cover
path = os.path.dirname(path... | python | def _walk_to_root(path, break_at=None):
"""
Directories starting from the given directory up to the root or break_at
"""
if not os.path.exists(path): # pragma: no cover
raise IOError("Starting path not found")
if os.path.isfile(path): # pragma: no cover
path = os.path.dirname(path... | [
"def",
"_walk_to_root",
"(",
"path",
",",
"break_at",
"=",
"None",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"path",
")",
":",
"raise",
"IOError",
"(",
"\"Starting path not found\"",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",... | Directories starting from the given directory up to the root or break_at | [
"Directories",
"starting",
"from",
"the",
"given",
"directory",
"up",
"to",
"the",
"root",
"or",
"break_at"
] | 5a7cc8f8252251cbdf4f4112965801f9dfe2831d | https://github.com/rochacbruno/dynaconf/blob/5a7cc8f8252251cbdf4f4112965801f9dfe2831d/dynaconf/utils/files.py#L12-L33 | train |
rochacbruno/dynaconf | dynaconf/utils/files.py | find_file | def find_file(filename=".env", project_root=None, skip_files=None, **kwargs):
"""Search in increasingly higher folders for the given file
Returns path to the file if found, or an empty string otherwise.
This function will build a `search_tree` based on:
- Project_root if specified
- Invoked script... | python | def find_file(filename=".env", project_root=None, skip_files=None, **kwargs):
"""Search in increasingly higher folders for the given file
Returns path to the file if found, or an empty string otherwise.
This function will build a `search_tree` based on:
- Project_root if specified
- Invoked script... | [
"def",
"find_file",
"(",
"filename",
"=",
"\".env\"",
",",
"project_root",
"=",
"None",
",",
"skip_files",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"search_tree",
"=",
"[",
"]",
"work_dir",
"=",
"os",
".",
"getcwd",
"(",
")",
"skip_files",
"=",
"ski... | Search in increasingly higher folders for the given file
Returns path to the file if found, or an empty string otherwise.
This function will build a `search_tree` based on:
- Project_root if specified
- Invoked script location and its parents until root
- Current working directory
For each pa... | [
"Search",
"in",
"increasingly",
"higher",
"folders",
"for",
"the",
"given",
"file",
"Returns",
"path",
"to",
"the",
"file",
"if",
"found",
"or",
"an",
"empty",
"string",
"otherwise",
"."
] | 5a7cc8f8252251cbdf4f4112965801f9dfe2831d | https://github.com/rochacbruno/dynaconf/blob/5a7cc8f8252251cbdf4f4112965801f9dfe2831d/dynaconf/utils/files.py#L39-L88 | train |
rochacbruno/dynaconf | dynaconf/validator.py | Validator.validate | def validate(self, settings):
"""Raise ValidationError if invalid"""
if self.envs is None:
self.envs = [settings.current_env]
if self.when is not None:
try:
# inherit env if not defined
if self.when.envs is None:
self.... | python | def validate(self, settings):
"""Raise ValidationError if invalid"""
if self.envs is None:
self.envs = [settings.current_env]
if self.when is not None:
try:
# inherit env if not defined
if self.when.envs is None:
self.... | [
"def",
"validate",
"(",
"self",
",",
"settings",
")",
":",
"if",
"self",
".",
"envs",
"is",
"None",
":",
"self",
".",
"envs",
"=",
"[",
"settings",
".",
"current_env",
"]",
"if",
"self",
".",
"when",
"is",
"not",
"None",
":",
"try",
":",
"if",
"s... | Raise ValidationError if invalid | [
"Raise",
"ValidationError",
"if",
"invalid"
] | 5a7cc8f8252251cbdf4f4112965801f9dfe2831d | https://github.com/rochacbruno/dynaconf/blob/5a7cc8f8252251cbdf4f4112965801f9dfe2831d/dynaconf/validator.py#L86-L113 | train |
django-json-api/django-rest-framework-json-api | rest_framework_json_api/serializers.py | ModelSerializer.to_representation | def to_representation(self, instance):
"""
Object instance -> Dict of primitive datatypes.
"""
ret = OrderedDict()
readable_fields = [
field for field in self.fields.values()
if not field.write_only
]
for field in readable_fields:
... | python | def to_representation(self, instance):
"""
Object instance -> Dict of primitive datatypes.
"""
ret = OrderedDict()
readable_fields = [
field for field in self.fields.values()
if not field.write_only
]
for field in readable_fields:
... | [
"def",
"to_representation",
"(",
"self",
",",
"instance",
")",
":",
"ret",
"=",
"OrderedDict",
"(",
")",
"readable_fields",
"=",
"[",
"field",
"for",
"field",
"in",
"self",
".",
"fields",
".",
"values",
"(",
")",
"if",
"not",
"field",
".",
"write_only",
... | Object instance -> Dict of primitive datatypes. | [
"Object",
"instance",
"-",
">",
"Dict",
"of",
"primitive",
"datatypes",
"."
] | de7021f9e011615ce8b65d0cb38227c6c12721b6 | https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/serializers.py#L175-L192 | train |
django-json-api/django-rest-framework-json-api | rest_framework_json_api/renderers.py | JSONRenderer.extract_attributes | def extract_attributes(cls, fields, resource):
"""
Builds the `attributes` object of the JSON API resource object.
"""
data = OrderedDict()
for field_name, field in six.iteritems(fields):
# ID is always provided in the root of JSON API so remove it from attributes
... | python | def extract_attributes(cls, fields, resource):
"""
Builds the `attributes` object of the JSON API resource object.
"""
data = OrderedDict()
for field_name, field in six.iteritems(fields):
# ID is always provided in the root of JSON API so remove it from attributes
... | [
"def",
"extract_attributes",
"(",
"cls",
",",
"fields",
",",
"resource",
")",
":",
"data",
"=",
"OrderedDict",
"(",
")",
"for",
"field_name",
",",
"field",
"in",
"six",
".",
"iteritems",
"(",
"fields",
")",
":",
"if",
"field_name",
"==",
"'id'",
":",
"... | Builds the `attributes` object of the JSON API resource object. | [
"Builds",
"the",
"attributes",
"object",
"of",
"the",
"JSON",
"API",
"resource",
"object",
"."
] | de7021f9e011615ce8b65d0cb38227c6c12721b6 | https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/renderers.py#L50-L81 | train |
django-json-api/django-rest-framework-json-api | rest_framework_json_api/renderers.py | JSONRenderer.extract_relation_instance | def extract_relation_instance(cls, field_name, field, resource_instance, serializer):
"""
Determines what instance represents given relation and extracts it.
Relation instance is determined by given field_name or source configured on
field. As fallback is a serializer method called with... | python | def extract_relation_instance(cls, field_name, field, resource_instance, serializer):
"""
Determines what instance represents given relation and extracts it.
Relation instance is determined by given field_name or source configured on
field. As fallback is a serializer method called with... | [
"def",
"extract_relation_instance",
"(",
"cls",
",",
"field_name",
",",
"field",
",",
"resource_instance",
",",
"serializer",
")",
":",
"relation_instance",
"=",
"None",
"try",
":",
"relation_instance",
"=",
"getattr",
"(",
"resource_instance",
",",
"field_name",
... | Determines what instance represents given relation and extracts it.
Relation instance is determined by given field_name or source configured on
field. As fallback is a serializer method called with name of field's source. | [
"Determines",
"what",
"instance",
"represents",
"given",
"relation",
"and",
"extracts",
"it",
"."
] | de7021f9e011615ce8b65d0cb38227c6c12721b6 | https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/renderers.py#L299-L326 | train |
django-json-api/django-rest-framework-json-api | rest_framework_json_api/renderers.py | JSONRenderer.extract_meta | def extract_meta(cls, serializer, resource):
"""
Gathers the data from serializer fields specified in meta_fields and adds it to
the meta object.
"""
if hasattr(serializer, 'child'):
meta = getattr(serializer.child, 'Meta', None)
else:
meta = getat... | python | def extract_meta(cls, serializer, resource):
"""
Gathers the data from serializer fields specified in meta_fields and adds it to
the meta object.
"""
if hasattr(serializer, 'child'):
meta = getattr(serializer.child, 'Meta', None)
else:
meta = getat... | [
"def",
"extract_meta",
"(",
"cls",
",",
"serializer",
",",
"resource",
")",
":",
"if",
"hasattr",
"(",
"serializer",
",",
"'child'",
")",
":",
"meta",
"=",
"getattr",
"(",
"serializer",
".",
"child",
",",
"'Meta'",
",",
"None",
")",
"else",
":",
"meta"... | Gathers the data from serializer fields specified in meta_fields and adds it to
the meta object. | [
"Gathers",
"the",
"data",
"from",
"serializer",
"fields",
"specified",
"in",
"meta_fields",
"and",
"adds",
"it",
"to",
"the",
"meta",
"object",
"."
] | de7021f9e011615ce8b65d0cb38227c6c12721b6 | https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/renderers.py#L458-L473 | train |
django-json-api/django-rest-framework-json-api | rest_framework_json_api/renderers.py | JSONRenderer.extract_root_meta | def extract_root_meta(cls, serializer, resource):
"""
Calls a `get_root_meta` function on a serializer, if it exists.
"""
many = False
if hasattr(serializer, 'child'):
many = True
serializer = serializer.child
data = {}
if getattr(serializ... | python | def extract_root_meta(cls, serializer, resource):
"""
Calls a `get_root_meta` function on a serializer, if it exists.
"""
many = False
if hasattr(serializer, 'child'):
many = True
serializer = serializer.child
data = {}
if getattr(serializ... | [
"def",
"extract_root_meta",
"(",
"cls",
",",
"serializer",
",",
"resource",
")",
":",
"many",
"=",
"False",
"if",
"hasattr",
"(",
"serializer",
",",
"'child'",
")",
":",
"many",
"=",
"True",
"serializer",
"=",
"serializer",
".",
"child",
"data",
"=",
"{"... | Calls a `get_root_meta` function on a serializer, if it exists. | [
"Calls",
"a",
"get_root_meta",
"function",
"on",
"a",
"serializer",
"if",
"it",
"exists",
"."
] | de7021f9e011615ce8b65d0cb38227c6c12721b6 | https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/renderers.py#L476-L490 | train |
django-json-api/django-rest-framework-json-api | rest_framework_json_api/views.py | PrefetchForIncludesHelperMixin.get_queryset | def get_queryset(self):
"""
This viewset provides a helper attribute to prefetch related models
based on the include specified in the URL.
__all__ can be used to specify a prefetch which should be done regardless of the include
.. code:: python
# When MyViewSet is ... | python | def get_queryset(self):
"""
This viewset provides a helper attribute to prefetch related models
based on the include specified in the URL.
__all__ can be used to specify a prefetch which should be done regardless of the include
.. code:: python
# When MyViewSet is ... | [
"def",
"get_queryset",
"(",
"self",
")",
":",
"qs",
"=",
"super",
"(",
"PrefetchForIncludesHelperMixin",
",",
"self",
")",
".",
"get_queryset",
"(",
")",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'prefetch_for_includes'",
")",
":",
"return",
"qs",
"includes... | This viewset provides a helper attribute to prefetch related models
based on the include specified in the URL.
__all__ can be used to specify a prefetch which should be done regardless of the include
.. code:: python
# When MyViewSet is called with ?include=author it will prefetch... | [
"This",
"viewset",
"provides",
"a",
"helper",
"attribute",
"to",
"prefetch",
"related",
"models",
"based",
"on",
"the",
"include",
"specified",
"in",
"the",
"URL",
"."
] | de7021f9e011615ce8b65d0cb38227c6c12721b6 | https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/views.py#L34-L62 | train |
django-json-api/django-rest-framework-json-api | rest_framework_json_api/views.py | AutoPrefetchMixin.get_queryset | def get_queryset(self, *args, **kwargs):
""" This mixin adds automatic prefetching for OneToOne and ManyToMany fields. """
qs = super(AutoPrefetchMixin, self).get_queryset(*args, **kwargs)
included_resources = get_included_resources(self.request)
for included in included_resources:
... | python | def get_queryset(self, *args, **kwargs):
""" This mixin adds automatic prefetching for OneToOne and ManyToMany fields. """
qs = super(AutoPrefetchMixin, self).get_queryset(*args, **kwargs)
included_resources = get_included_resources(self.request)
for included in included_resources:
... | [
"def",
"get_queryset",
"(",
"self",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"qs",
"=",
"super",
"(",
"AutoPrefetchMixin",
",",
"self",
")",
".",
"get_queryset",
"(",
"*",
"args",
",",
"**",
"kwargs",
")",
"included_resources",
"=",
"get_included... | This mixin adds automatic prefetching for OneToOne and ManyToMany fields. | [
"This",
"mixin",
"adds",
"automatic",
"prefetching",
"for",
"OneToOne",
"and",
"ManyToMany",
"fields",
"."
] | de7021f9e011615ce8b65d0cb38227c6c12721b6 | https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/views.py#L66-L109 | train |
django-json-api/django-rest-framework-json-api | rest_framework_json_api/views.py | RelationshipView.get_url | def get_url(self, name, view_name, kwargs, request):
"""
Given a name, view name and kwargs, return the URL that hyperlinks to the object.
May raise a `NoReverseMatch` if the `view_name` and `lookup_field`
attributes are not configured to correctly match the URL conf.
"""
... | python | def get_url(self, name, view_name, kwargs, request):
"""
Given a name, view name and kwargs, return the URL that hyperlinks to the object.
May raise a `NoReverseMatch` if the `view_name` and `lookup_field`
attributes are not configured to correctly match the URL conf.
"""
... | [
"def",
"get_url",
"(",
"self",
",",
"name",
",",
"view_name",
",",
"kwargs",
",",
"request",
")",
":",
"if",
"not",
"view_name",
":",
"return",
"None",
"try",
":",
"url",
"=",
"self",
".",
"reverse",
"(",
"view_name",
",",
"kwargs",
"=",
"kwargs",
",... | Given a name, view name and kwargs, return the URL that hyperlinks to the object.
May raise a `NoReverseMatch` if the `view_name` and `lookup_field`
attributes are not configured to correctly match the URL conf. | [
"Given",
"a",
"name",
"view",
"name",
"and",
"kwargs",
"return",
"the",
"URL",
"that",
"hyperlinks",
"to",
"the",
"object",
"."
] | de7021f9e011615ce8b65d0cb38227c6c12721b6 | https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/views.py#L221-L248 | train |
django-json-api/django-rest-framework-json-api | rest_framework_json_api/utils.py | get_resource_name | def get_resource_name(context, expand_polymorphic_types=False):
"""
Return the name of a resource.
"""
from rest_framework_json_api.serializers import PolymorphicModelSerializer
view = context.get('view')
# Sanity check to make sure we have a view.
if not view:
return None
# Ch... | python | def get_resource_name(context, expand_polymorphic_types=False):
"""
Return the name of a resource.
"""
from rest_framework_json_api.serializers import PolymorphicModelSerializer
view = context.get('view')
# Sanity check to make sure we have a view.
if not view:
return None
# Ch... | [
"def",
"get_resource_name",
"(",
"context",
",",
"expand_polymorphic_types",
"=",
"False",
")",
":",
"from",
"rest_framework_json_api",
".",
"serializers",
"import",
"PolymorphicModelSerializer",
"view",
"=",
"context",
".",
"get",
"(",
"'view'",
")",
"if",
"not",
... | Return the name of a resource. | [
"Return",
"the",
"name",
"of",
"a",
"resource",
"."
] | de7021f9e011615ce8b65d0cb38227c6c12721b6 | https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/utils.py#L36-L79 | train |
django-json-api/django-rest-framework-json-api | rest_framework_json_api/utils.py | format_field_names | def format_field_names(obj, format_type=None):
"""
Takes a dict and returns it with formatted keys as set in `format_type`
or `JSON_API_FORMAT_FIELD_NAMES`
:format_type: Either 'dasherize', 'camelize', 'capitalize' or 'underscore'
"""
if format_type is None:
format_type = json_api_setti... | python | def format_field_names(obj, format_type=None):
"""
Takes a dict and returns it with formatted keys as set in `format_type`
or `JSON_API_FORMAT_FIELD_NAMES`
:format_type: Either 'dasherize', 'camelize', 'capitalize' or 'underscore'
"""
if format_type is None:
format_type = json_api_setti... | [
"def",
"format_field_names",
"(",
"obj",
",",
"format_type",
"=",
"None",
")",
":",
"if",
"format_type",
"is",
"None",
":",
"format_type",
"=",
"json_api_settings",
".",
"FORMAT_FIELD_NAMES",
"if",
"isinstance",
"(",
"obj",
",",
"dict",
")",
":",
"formatted",
... | Takes a dict and returns it with formatted keys as set in `format_type`
or `JSON_API_FORMAT_FIELD_NAMES`
:format_type: Either 'dasherize', 'camelize', 'capitalize' or 'underscore' | [
"Takes",
"a",
"dict",
"and",
"returns",
"it",
"with",
"formatted",
"keys",
"as",
"set",
"in",
"format_type",
"or",
"JSON_API_FORMAT_FIELD_NAMES"
] | de7021f9e011615ce8b65d0cb38227c6c12721b6 | https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/utils.py#L101-L118 | train |
django-json-api/django-rest-framework-json-api | rest_framework_json_api/utils.py | _format_object | def _format_object(obj, format_type=None):
"""Depending on settings calls either `format_keys` or `format_field_names`"""
if json_api_settings.FORMAT_KEYS is not None:
return format_keys(obj, format_type)
return format_field_names(obj, format_type) | python | def _format_object(obj, format_type=None):
"""Depending on settings calls either `format_keys` or `format_field_names`"""
if json_api_settings.FORMAT_KEYS is not None:
return format_keys(obj, format_type)
return format_field_names(obj, format_type) | [
"def",
"_format_object",
"(",
"obj",
",",
"format_type",
"=",
"None",
")",
":",
"if",
"json_api_settings",
".",
"FORMAT_KEYS",
"is",
"not",
"None",
":",
"return",
"format_keys",
"(",
"obj",
",",
"format_type",
")",
"return",
"format_field_names",
"(",
"obj",
... | Depending on settings calls either `format_keys` or `format_field_names` | [
"Depending",
"on",
"settings",
"calls",
"either",
"format_keys",
"or",
"format_field_names"
] | de7021f9e011615ce8b65d0cb38227c6c12721b6 | https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/utils.py#L121-L127 | train |
django-json-api/django-rest-framework-json-api | rest_framework_json_api/utils.py | get_included_resources | def get_included_resources(request, serializer=None):
""" Build a list of included resources. """
include_resources_param = request.query_params.get('include') if request else None
if include_resources_param:
return include_resources_param.split(',')
else:
return get_default_included_res... | python | def get_included_resources(request, serializer=None):
""" Build a list of included resources. """
include_resources_param = request.query_params.get('include') if request else None
if include_resources_param:
return include_resources_param.split(',')
else:
return get_default_included_res... | [
"def",
"get_included_resources",
"(",
"request",
",",
"serializer",
"=",
"None",
")",
":",
"include_resources_param",
"=",
"request",
".",
"query_params",
".",
"get",
"(",
"'include'",
")",
"if",
"request",
"else",
"None",
"if",
"include_resources_param",
":",
"... | Build a list of included resources. | [
"Build",
"a",
"list",
"of",
"included",
"resources",
"."
] | de7021f9e011615ce8b65d0cb38227c6c12721b6 | https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/utils.py#L327-L333 | train |
django-json-api/django-rest-framework-json-api | rest_framework_json_api/parsers.py | JSONParser.parse | def parse(self, stream, media_type=None, parser_context=None):
"""
Parses the incoming bytestream as JSON and returns the resulting data
"""
result = super(JSONParser, self).parse(
stream, media_type=media_type, parser_context=parser_context
)
if not isinstan... | python | def parse(self, stream, media_type=None, parser_context=None):
"""
Parses the incoming bytestream as JSON and returns the resulting data
"""
result = super(JSONParser, self).parse(
stream, media_type=media_type, parser_context=parser_context
)
if not isinstan... | [
"def",
"parse",
"(",
"self",
",",
"stream",
",",
"media_type",
"=",
"None",
",",
"parser_context",
"=",
"None",
")",
":",
"result",
"=",
"super",
"(",
"JSONParser",
",",
"self",
")",
".",
"parse",
"(",
"stream",
",",
"media_type",
"=",
"media_type",
",... | Parses the incoming bytestream as JSON and returns the resulting data | [
"Parses",
"the",
"incoming",
"bytestream",
"as",
"JSON",
"and",
"returns",
"the",
"resulting",
"data"
] | de7021f9e011615ce8b65d0cb38227c6c12721b6 | https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/parsers.py#L85-L153 | train |
django-json-api/django-rest-framework-json-api | rest_framework_json_api/relations.py | ResourceRelatedField.get_resource_type_from_included_serializer | def get_resource_type_from_included_serializer(self):
"""
Check to see it this resource has a different resource_name when
included and return that name, or None
"""
field_name = self.field_name or self.parent.field_name
parent = self.get_parent_serializer()
if p... | python | def get_resource_type_from_included_serializer(self):
"""
Check to see it this resource has a different resource_name when
included and return that name, or None
"""
field_name = self.field_name or self.parent.field_name
parent = self.get_parent_serializer()
if p... | [
"def",
"get_resource_type_from_included_serializer",
"(",
"self",
")",
":",
"field_name",
"=",
"self",
".",
"field_name",
"or",
"self",
".",
"parent",
".",
"field_name",
"parent",
"=",
"self",
".",
"get_parent_serializer",
"(",
")",
"if",
"parent",
"is",
"not",
... | Check to see it this resource has a different resource_name when
included and return that name, or None | [
"Check",
"to",
"see",
"it",
"this",
"resource",
"has",
"a",
"different",
"resource_name",
"when",
"included",
"and",
"return",
"that",
"name",
"or",
"None"
] | de7021f9e011615ce8b65d0cb38227c6c12721b6 | https://github.com/django-json-api/django-rest-framework-json-api/blob/de7021f9e011615ce8b65d0cb38227c6c12721b6/rest_framework_json_api/relations.py#L255-L274 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/signature.py | sign_plaintext | def sign_plaintext(client_secret, resource_owner_secret):
"""Sign a request using plaintext.
Per `section 3.4.4`_ of the spec.
The "PLAINTEXT" method does not employ a signature algorithm. It
MUST be used with a transport-layer mechanism such as TLS or SSL (or
sent over a secure channel with equi... | python | def sign_plaintext(client_secret, resource_owner_secret):
"""Sign a request using plaintext.
Per `section 3.4.4`_ of the spec.
The "PLAINTEXT" method does not employ a signature algorithm. It
MUST be used with a transport-layer mechanism such as TLS or SSL (or
sent over a secure channel with equi... | [
"def",
"sign_plaintext",
"(",
"client_secret",
",",
"resource_owner_secret",
")",
":",
"signature",
"=",
"utils",
".",
"escape",
"(",
"client_secret",
"or",
"''",
")",
"signature",
"+=",
"'&'",
"signature",
"+=",
"utils",
".",
"escape",
"(",
"resource_owner_secr... | Sign a request using plaintext.
Per `section 3.4.4`_ of the spec.
The "PLAINTEXT" method does not employ a signature algorithm. It
MUST be used with a transport-layer mechanism such as TLS or SSL (or
sent over a secure channel with equivalent protections). It does not
utilize the signature base ... | [
"Sign",
"a",
"request",
"using",
"plaintext",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/signature.py#L595-L627 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/signature.py | verify_hmac_sha1 | def verify_hmac_sha1(request, client_secret=None,
resource_owner_secret=None):
"""Verify a HMAC-SHA1 signature.
Per `section 3.4`_ of the spec.
.. _`section 3.4`: https://tools.ietf.org/html/rfc5849#section-3.4
To satisfy `RFC2616 section 5.2`_ item 1, the request argument's uri
... | python | def verify_hmac_sha1(request, client_secret=None,
resource_owner_secret=None):
"""Verify a HMAC-SHA1 signature.
Per `section 3.4`_ of the spec.
.. _`section 3.4`: https://tools.ietf.org/html/rfc5849#section-3.4
To satisfy `RFC2616 section 5.2`_ item 1, the request argument's uri
... | [
"def",
"verify_hmac_sha1",
"(",
"request",
",",
"client_secret",
"=",
"None",
",",
"resource_owner_secret",
"=",
"None",
")",
":",
"norm_params",
"=",
"normalize_parameters",
"(",
"request",
".",
"params",
")",
"bs_uri",
"=",
"base_string_uri",
"(",
"request",
"... | Verify a HMAC-SHA1 signature.
Per `section 3.4`_ of the spec.
.. _`section 3.4`: https://tools.ietf.org/html/rfc5849#section-3.4
To satisfy `RFC2616 section 5.2`_ item 1, the request argument's uri
attribute MUST be an absolute URI whose netloc part identifies the
origin server or gateway on whic... | [
"Verify",
"a",
"HMAC",
"-",
"SHA1",
"signature",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/signature.py#L634-L661 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/signature.py | verify_plaintext | def verify_plaintext(request, client_secret=None, resource_owner_secret=None):
"""Verify a PLAINTEXT signature.
Per `section 3.4`_ of the spec.
.. _`section 3.4`: https://tools.ietf.org/html/rfc5849#section-3.4
"""
signature = sign_plaintext(client_secret, resource_owner_secret)
match = safe_s... | python | def verify_plaintext(request, client_secret=None, resource_owner_secret=None):
"""Verify a PLAINTEXT signature.
Per `section 3.4`_ of the spec.
.. _`section 3.4`: https://tools.ietf.org/html/rfc5849#section-3.4
"""
signature = sign_plaintext(client_secret, resource_owner_secret)
match = safe_s... | [
"def",
"verify_plaintext",
"(",
"request",
",",
"client_secret",
"=",
"None",
",",
"resource_owner_secret",
"=",
"None",
")",
":",
"signature",
"=",
"sign_plaintext",
"(",
"client_secret",
",",
"resource_owner_secret",
")",
"match",
"=",
"safe_string_equals",
"(",
... | Verify a PLAINTEXT signature.
Per `section 3.4`_ of the spec.
.. _`section 3.4`: https://tools.ietf.org/html/rfc5849#section-3.4 | [
"Verify",
"a",
"PLAINTEXT",
"signature",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/signature.py#L702-L713 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/endpoints/authorization.py | AuthorizationEndpoint.create_authorization_response | def create_authorization_response(self, uri, http_method='GET', body=None,
headers=None, realms=None, credentials=None):
"""Create an authorization response, with a new request token if valid.
:param uri: The full URI of the token request.
:param http_metho... | python | def create_authorization_response(self, uri, http_method='GET', body=None,
headers=None, realms=None, credentials=None):
"""Create an authorization response, with a new request token if valid.
:param uri: The full URI of the token request.
:param http_metho... | [
"def",
"create_authorization_response",
"(",
"self",
",",
"uri",
",",
"http_method",
"=",
"'GET'",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"realms",
"=",
"None",
",",
"credentials",
"=",
"None",
")",
":",
"request",
"=",
"self",
".",
... | Create an authorization response, with a new request token if valid.
:param uri: The full URI of the token request.
:param http_method: A valid HTTP verb, i.e. GET, POST, PUT, HEAD, etc.
:param body: The request body as a string.
:param headers: The request headers as a dict.
:p... | [
"Create",
"an",
"authorization",
"response",
"with",
"a",
"new",
"request",
"token",
"if",
"valid",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/endpoints/authorization.py#L59-L139 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/endpoints/authorization.py | AuthorizationEndpoint.get_realms_and_credentials | def get_realms_and_credentials(self, uri, http_method='GET', body=None,
headers=None):
"""Fetch realms and credentials for the presented request token.
:param uri: The full URI of the token request.
:param http_method: A valid HTTP verb, i.e. GET, POST, PUT, H... | python | def get_realms_and_credentials(self, uri, http_method='GET', body=None,
headers=None):
"""Fetch realms and credentials for the presented request token.
:param uri: The full URI of the token request.
:param http_method: A valid HTTP verb, i.e. GET, POST, PUT, H... | [
"def",
"get_realms_and_credentials",
"(",
"self",
",",
"uri",
",",
"http_method",
"=",
"'GET'",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"request",
"=",
"self",
".",
"_create_request",
"(",
"uri",
",",
"http_method",
"=",
"http_meth... | Fetch realms and credentials for the presented request token.
:param uri: The full URI of the token request.
:param http_method: A valid HTTP verb, i.e. GET, POST, PUT, HEAD, etc.
:param body: The request body as a string.
:param headers: The request headers as a dict.
:returns:... | [
"Fetch",
"realms",
"and",
"credentials",
"for",
"the",
"presented",
"request",
"token",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/endpoints/authorization.py#L141-L163 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/endpoints/introspect.py | IntrospectEndpoint.create_introspect_response | def create_introspect_response(self, uri, http_method='POST', body=None,
headers=None):
"""Create introspect valid or invalid response
If the authorization server is unable to determine the state
of the token without additional information, it SHOULD return
... | python | def create_introspect_response(self, uri, http_method='POST', body=None,
headers=None):
"""Create introspect valid or invalid response
If the authorization server is unable to determine the state
of the token without additional information, it SHOULD return
... | [
"def",
"create_introspect_response",
"(",
"self",
",",
"uri",
",",
"http_method",
"=",
"'POST'",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"resp_headers",
"=",
"{",
"'Content-Type'",
":",
"'application/json'",
",",
"'Cache-Control'",
":"... | Create introspect valid or invalid response
If the authorization server is unable to determine the state
of the token without additional information, it SHOULD return
an introspection response indicating the token is not active
as described in Section 2.2. | [
"Create",
"introspect",
"valid",
"or",
"invalid",
"response"
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/endpoints/introspect.py#L50-L82 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/clients/service_application.py | ServiceApplicationClient.prepare_request_body | def prepare_request_body(self,
private_key=None,
subject=None,
issuer=None,
audience=None,
expires_at=None,
issued_at=None,
... | python | def prepare_request_body(self,
private_key=None,
subject=None,
issuer=None,
audience=None,
expires_at=None,
issued_at=None,
... | [
"def",
"prepare_request_body",
"(",
"self",
",",
"private_key",
"=",
"None",
",",
"subject",
"=",
"None",
",",
"issuer",
"=",
"None",
",",
"audience",
"=",
"None",
",",
"expires_at",
"=",
"None",
",",
"issued_at",
"=",
"None",
",",
"extra_claims",
"=",
"... | Create and add a JWT assertion to the request body.
:param private_key: Private key used for signing and encrypting.
Must be given as a string.
:param subject: (sub) The principal that is the subject of the JWT,
i.e. which user is the token requeste... | [
"Create",
"and",
"add",
"a",
"JWT",
"assertion",
"to",
"the",
"request",
"body",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/clients/service_application.py#L66-L190 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/grant_types/authorization_code.py | AuthorizationCodeGrant.create_authorization_code | def create_authorization_code(self, request):
"""
Generates an authorization grant represented as a dictionary.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
"""
grant = {'code': common.generate_token()}
if hasattr(request, 'state') and... | python | def create_authorization_code(self, request):
"""
Generates an authorization grant represented as a dictionary.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
"""
grant = {'code': common.generate_token()}
if hasattr(request, 'state') and... | [
"def",
"create_authorization_code",
"(",
"self",
",",
"request",
")",
":",
"grant",
"=",
"{",
"'code'",
":",
"common",
".",
"generate_token",
"(",
")",
"}",
"if",
"hasattr",
"(",
"request",
",",
"'state'",
")",
"and",
"request",
".",
"state",
":",
"grant... | Generates an authorization grant represented as a dictionary.
:param request: OAuthlib request.
:type request: oauthlib.common.Request | [
"Generates",
"an",
"authorization",
"grant",
"represented",
"as",
"a",
"dictionary",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py#L163-L175 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/grant_types/authorization_code.py | AuthorizationCodeGrant.create_token_response | def create_token_response(self, request, token_handler):
"""Validate the authorization code.
The client MUST NOT use the authorization code more than once. If an
authorization code is used more than once, the authorization server
MUST deny the request and SHOULD revoke (when possible) a... | python | def create_token_response(self, request, token_handler):
"""Validate the authorization code.
The client MUST NOT use the authorization code more than once. If an
authorization code is used more than once, the authorization server
MUST deny the request and SHOULD revoke (when possible) a... | [
"def",
"create_token_response",
"(",
"self",
",",
"request",
",",
"token_handler",
")",
":",
"headers",
"=",
"self",
".",
"_get_default_headers",
"(",
")",
"try",
":",
"self",
".",
"validate_token_request",
"(",
"request",
")",
"log",
".",
"debug",
"(",
"'To... | Validate the authorization code.
The client MUST NOT use the authorization code more than once. If an
authorization code is used more than once, the authorization server
MUST deny the request and SHOULD revoke (when possible) all tokens
previously issued based on that authorization code... | [
"Validate",
"the",
"authorization",
"code",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py#L284-L316 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/grant_types/authorization_code.py | AuthorizationCodeGrant.validate_authorization_request | def validate_authorization_request(self, request):
"""Check the authorization request for normal and fatal errors.
A normal error could be a missing response_type parameter or the client
attempting to access scope it is not allowed to ask authorization for.
Normal errors can safely be i... | python | def validate_authorization_request(self, request):
"""Check the authorization request for normal and fatal errors.
A normal error could be a missing response_type parameter or the client
attempting to access scope it is not allowed to ask authorization for.
Normal errors can safely be i... | [
"def",
"validate_authorization_request",
"(",
"self",
",",
"request",
")",
":",
"for",
"param",
"in",
"(",
"'client_id'",
",",
"'response_type'",
",",
"'redirect_uri'",
",",
"'scope'",
",",
"'state'",
")",
":",
"try",
":",
"duplicate_params",
"=",
"request",
"... | Check the authorization request for normal and fatal errors.
A normal error could be a missing response_type parameter or the client
attempting to access scope it is not allowed to ask authorization for.
Normal errors can safely be included in the redirection URI and
sent back to the cl... | [
"Check",
"the",
"authorization",
"request",
"for",
"normal",
"and",
"fatal",
"errors",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py#L318-L430 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/endpoints/metadata.py | MetadataEndpoint.create_metadata_response | def create_metadata_response(self, uri, http_method='GET', body=None,
headers=None):
"""Create metadata response
"""
headers = {
'Content-Type': 'application/json'
}
return headers, json.dumps(self.claims), 200 | python | def create_metadata_response(self, uri, http_method='GET', body=None,
headers=None):
"""Create metadata response
"""
headers = {
'Content-Type': 'application/json'
}
return headers, json.dumps(self.claims), 200 | [
"def",
"create_metadata_response",
"(",
"self",
",",
"uri",
",",
"http_method",
"=",
"'GET'",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"headers",
"=",
"{",
"'Content-Type'",
":",
"'application/json'",
"}",
"return",
"headers",
",",
... | Create metadata response | [
"Create",
"metadata",
"response"
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/endpoints/metadata.py#L57-L64 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/endpoints/metadata.py | MetadataEndpoint.validate_metadata_token | def validate_metadata_token(self, claims, endpoint):
"""
If the token endpoint is used in the grant type, the value of this
parameter MUST be the same as the value of the "grant_type"
parameter passed to the token endpoint defined in the grant type
definition.
"""
... | python | def validate_metadata_token(self, claims, endpoint):
"""
If the token endpoint is used in the grant type, the value of this
parameter MUST be the same as the value of the "grant_type"
parameter passed to the token endpoint defined in the grant type
definition.
"""
... | [
"def",
"validate_metadata_token",
"(",
"self",
",",
"claims",
",",
"endpoint",
")",
":",
"self",
".",
"_grant_types",
".",
"extend",
"(",
"endpoint",
".",
"_grant_types",
".",
"keys",
"(",
")",
")",
"claims",
".",
"setdefault",
"(",
"\"token_endpoint_auth_meth... | If the token endpoint is used in the grant type, the value of this
parameter MUST be the same as the value of the "grant_type"
parameter passed to the token endpoint defined in the grant type
definition. | [
"If",
"the",
"token",
"endpoint",
"is",
"used",
"in",
"the",
"grant",
"type",
"the",
"value",
"of",
"this",
"parameter",
"MUST",
"be",
"the",
"same",
"as",
"the",
"value",
"of",
"the",
"grant_type",
"parameter",
"passed",
"to",
"the",
"token",
"endpoint",
... | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/endpoints/metadata.py#L91-L103 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/clients/web_application.py | WebApplicationClient.prepare_request_body | def prepare_request_body(self, code=None, redirect_uri=None, body='',
include_client_id=True, **kwargs):
"""Prepare the access token request body.
The client makes a request to the token endpoint by adding the
following parameters using the "application/x-www-form-u... | python | def prepare_request_body(self, code=None, redirect_uri=None, body='',
include_client_id=True, **kwargs):
"""Prepare the access token request body.
The client makes a request to the token endpoint by adding the
following parameters using the "application/x-www-form-u... | [
"def",
"prepare_request_body",
"(",
"self",
",",
"code",
"=",
"None",
",",
"redirect_uri",
"=",
"None",
",",
"body",
"=",
"''",
",",
"include_client_id",
"=",
"True",
",",
"**",
"kwargs",
")",
":",
"code",
"=",
"code",
"or",
"self",
".",
"code",
"if",
... | Prepare the access token request body.
The client makes a request to the token endpoint by adding the
following parameters using the "application/x-www-form-urlencoded"
format in the HTTP request entity-body:
:param code: REQUIRED. The authorization code received from the
... | [
"Prepare",
"the",
"access",
"token",
"request",
"body",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/clients/web_application.py#L92-L157 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/clients/web_application.py | WebApplicationClient.parse_request_uri_response | def parse_request_uri_response(self, uri, state=None):
"""Parse the URI query for code and state.
If the resource owner grants the access request, the authorization
server issues an authorization code and delivers it to the client by
adding the following parameters to the query componen... | python | def parse_request_uri_response(self, uri, state=None):
"""Parse the URI query for code and state.
If the resource owner grants the access request, the authorization
server issues an authorization code and delivers it to the client by
adding the following parameters to the query componen... | [
"def",
"parse_request_uri_response",
"(",
"self",
",",
"uri",
",",
"state",
"=",
"None",
")",
":",
"response",
"=",
"parse_authorization_code_response",
"(",
"uri",
",",
"state",
"=",
"state",
")",
"self",
".",
"populate_code_attributes",
"(",
"response",
")",
... | Parse the URI query for code and state.
If the resource owner grants the access request, the authorization
server issues an authorization code and delivers it to the client by
adding the following parameters to the query component of the
redirection URI using the "application/x-www-form... | [
"Parse",
"the",
"URI",
"query",
"for",
"code",
"and",
"state",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/clients/web_application.py#L159-L205 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/clients/base.py | Client.add_token | def add_token(self, uri, http_method='GET', body=None, headers=None,
token_placement=None, **kwargs):
"""Add token to the request uri, body or authorization header.
The access token type provides the client with the information
required to successfully utilize the access token... | python | def add_token(self, uri, http_method='GET', body=None, headers=None,
token_placement=None, **kwargs):
"""Add token to the request uri, body or authorization header.
The access token type provides the client with the information
required to successfully utilize the access token... | [
"def",
"add_token",
"(",
"self",
",",
"uri",
",",
"http_method",
"=",
"'GET'",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"token_placement",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"is_secure_transport",
"(",
"uri",
")... | Add token to the request uri, body or authorization header.
The access token type provides the client with the information
required to successfully utilize the access token to make a protected
resource request (along with type-specific attributes). The client
MUST NOT use an access tok... | [
"Add",
"token",
"to",
"the",
"request",
"uri",
"body",
"or",
"authorization",
"header",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/clients/base.py#L149-L201 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/clients/base.py | Client.prepare_authorization_request | def prepare_authorization_request(self, authorization_url, state=None,
redirect_url=None, scope=None, **kwargs):
"""Prepare the authorization request.
This is the first step in many OAuth flows in which the user is
redirected to a certain authorization URL.... | python | def prepare_authorization_request(self, authorization_url, state=None,
redirect_url=None, scope=None, **kwargs):
"""Prepare the authorization request.
This is the first step in many OAuth flows in which the user is
redirected to a certain authorization URL.... | [
"def",
"prepare_authorization_request",
"(",
"self",
",",
"authorization_url",
",",
"state",
"=",
"None",
",",
"redirect_url",
"=",
"None",
",",
"scope",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"is_secure_transport",
"(",
"authorization_url",
... | Prepare the authorization request.
This is the first step in many OAuth flows in which the user is
redirected to a certain authorization URL. This method adds
required parameters to the authorization URL.
:param authorization_url: Provider authorization endpoint URL.
:param st... | [
"Prepare",
"the",
"authorization",
"request",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/clients/base.py#L203-L240 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/clients/base.py | Client.prepare_token_request | def prepare_token_request(self, token_url, authorization_response=None,
redirect_url=None, state=None, body='', **kwargs):
"""Prepare a token creation request.
Note that these requests usually require client authentication, either
by including client_id or a set of... | python | def prepare_token_request(self, token_url, authorization_response=None,
redirect_url=None, state=None, body='', **kwargs):
"""Prepare a token creation request.
Note that these requests usually require client authentication, either
by including client_id or a set of... | [
"def",
"prepare_token_request",
"(",
"self",
",",
"token_url",
",",
"authorization_response",
"=",
"None",
",",
"redirect_url",
"=",
"None",
",",
"state",
"=",
"None",
",",
"body",
"=",
"''",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"is_secure_transport",... | Prepare a token creation request.
Note that these requests usually require client authentication, either
by including client_id or a set of provider specific authentication
credentials.
:param token_url: Provider token creation endpoint URL.
:param authorization_response: The ... | [
"Prepare",
"a",
"token",
"creation",
"request",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/clients/base.py#L242-L280 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/clients/base.py | Client.prepare_refresh_token_request | def prepare_refresh_token_request(self, token_url, refresh_token=None,
body='', scope=None, **kwargs):
"""Prepare an access token refresh request.
Expired access tokens can be replaced by new access tokens without
going through the OAuth dance if the client... | python | def prepare_refresh_token_request(self, token_url, refresh_token=None,
body='', scope=None, **kwargs):
"""Prepare an access token refresh request.
Expired access tokens can be replaced by new access tokens without
going through the OAuth dance if the client... | [
"def",
"prepare_refresh_token_request",
"(",
"self",
",",
"token_url",
",",
"refresh_token",
"=",
"None",
",",
"body",
"=",
"''",
",",
"scope",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"is_secure_transport",
"(",
"token_url",
")",
":",
"rai... | Prepare an access token refresh request.
Expired access tokens can be replaced by new access tokens without
going through the OAuth dance if the client obtained a refresh token.
This refresh token and authentication credentials can be used to
obtain a new access token, and possibly a ne... | [
"Prepare",
"an",
"access",
"token",
"refresh",
"request",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/clients/base.py#L282-L312 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/clients/base.py | Client.parse_request_body_response | def parse_request_body_response(self, body, scope=None, **kwargs):
"""Parse the JSON response body.
If the access token request is valid and authorized, the
authorization server issues an access token as described in
`Section 5.1`_. A refresh token SHOULD NOT be included. If the reque... | python | def parse_request_body_response(self, body, scope=None, **kwargs):
"""Parse the JSON response body.
If the access token request is valid and authorized, the
authorization server issues an access token as described in
`Section 5.1`_. A refresh token SHOULD NOT be included. If the reque... | [
"def",
"parse_request_body_response",
"(",
"self",
",",
"body",
",",
"scope",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"self",
".",
"token",
"=",
"parse_token_response",
"(",
"body",
",",
"scope",
"=",
"scope",
")",
"self",
".",
"populate_token_attributes... | Parse the JSON response body.
If the access token request is valid and authorized, the
authorization server issues an access token as described in
`Section 5.1`_. A refresh token SHOULD NOT be included. If the request
failed client authentication or is invalid, the authorization serve... | [
"Parse",
"the",
"JSON",
"response",
"body",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/clients/base.py#L375-L423 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/clients/base.py | Client.prepare_refresh_body | def prepare_refresh_body(self, body='', refresh_token=None, scope=None, **kwargs):
"""Prepare an access token request, using a refresh token.
If the authorization server issued a refresh token to the client, the
client makes a refresh request to the token endpoint by adding the
followin... | python | def prepare_refresh_body(self, body='', refresh_token=None, scope=None, **kwargs):
"""Prepare an access token request, using a refresh token.
If the authorization server issued a refresh token to the client, the
client makes a refresh request to the token endpoint by adding the
followin... | [
"def",
"prepare_refresh_body",
"(",
"self",
",",
"body",
"=",
"''",
",",
"refresh_token",
"=",
"None",
",",
"scope",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"refresh_token",
"=",
"refresh_token",
"or",
"self",
".",
"refresh_token",
"return",
"prepare_tok... | Prepare an access token request, using a refresh token.
If the authorization server issued a refresh token to the client, the
client makes a refresh request to the token endpoint by adding the
following parameters using the "application/x-www-form-urlencoded"
format in the HTTP request ... | [
"Prepare",
"an",
"access",
"token",
"request",
"using",
"a",
"refresh",
"token",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/clients/base.py#L425-L446 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/clients/base.py | Client._add_mac_token | def _add_mac_token(self, uri, http_method='GET', body=None,
headers=None, token_placement=AUTH_HEADER, ext=None, **kwargs):
"""Add a MAC token to the request authorization header.
Warning: MAC token support is experimental as the spec is not yet stable.
"""
if tok... | python | def _add_mac_token(self, uri, http_method='GET', body=None,
headers=None, token_placement=AUTH_HEADER, ext=None, **kwargs):
"""Add a MAC token to the request authorization header.
Warning: MAC token support is experimental as the spec is not yet stable.
"""
if tok... | [
"def",
"_add_mac_token",
"(",
"self",
",",
"uri",
",",
"http_method",
"=",
"'GET'",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"token_placement",
"=",
"AUTH_HEADER",
",",
"ext",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"token_... | Add a MAC token to the request authorization header.
Warning: MAC token support is experimental as the spec is not yet stable. | [
"Add",
"a",
"MAC",
"token",
"to",
"the",
"request",
"authorization",
"header",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/clients/base.py#L464-L476 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/clients/base.py | Client.populate_token_attributes | def populate_token_attributes(self, response):
"""Add attributes from a token exchange response to self."""
if 'access_token' in response:
self.access_token = response.get('access_token')
if 'refresh_token' in response:
self.refresh_token = response.get('refresh_token')... | python | def populate_token_attributes(self, response):
"""Add attributes from a token exchange response to self."""
if 'access_token' in response:
self.access_token = response.get('access_token')
if 'refresh_token' in response:
self.refresh_token = response.get('refresh_token')... | [
"def",
"populate_token_attributes",
"(",
"self",
",",
"response",
")",
":",
"if",
"'access_token'",
"in",
"response",
":",
"self",
".",
"access_token",
"=",
"response",
".",
"get",
"(",
"'access_token'",
")",
"if",
"'refresh_token'",
"in",
"response",
":",
"se... | Add attributes from a token exchange response to self. | [
"Add",
"attributes",
"from",
"a",
"token",
"exchange",
"response",
"to",
"self",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/clients/base.py#L489-L512 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/endpoints/base.py | BaseEndpoint._get_signature_type_and_params | def _get_signature_type_and_params(self, request):
"""Extracts parameters from query, headers and body. Signature type
is set to the source in which parameters were found.
"""
# Per RFC5849, only the Authorization header may contain the 'realm'
# optional parameter.
heade... | python | def _get_signature_type_and_params(self, request):
"""Extracts parameters from query, headers and body. Signature type
is set to the source in which parameters were found.
"""
# Per RFC5849, only the Authorization header may contain the 'realm'
# optional parameter.
heade... | [
"def",
"_get_signature_type_and_params",
"(",
"self",
",",
"request",
")",
":",
"header_params",
"=",
"signature",
".",
"collect_parameters",
"(",
"headers",
"=",
"request",
".",
"headers",
",",
"exclude_oauth_signature",
"=",
"False",
",",
"with_realm",
"=",
"Tru... | Extracts parameters from query, headers and body. Signature type
is set to the source in which parameters were found. | [
"Extracts",
"parameters",
"from",
"query",
"headers",
"and",
"body",
".",
"Signature",
"type",
"is",
"set",
"to",
"the",
"source",
"in",
"which",
"parameters",
"were",
"found",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/endpoints/base.py#L26-L66 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py | ResourceOwnerPasswordCredentialsGrant.create_token_response | def create_token_response(self, request, token_handler):
"""Return token or error in json format.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:param token_handler: A token handler instance, for example of type
oauthlib.oauth2.Be... | python | def create_token_response(self, request, token_handler):
"""Return token or error in json format.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:param token_handler: A token handler instance, for example of type
oauthlib.oauth2.Be... | [
"def",
"create_token_response",
"(",
"self",
",",
"request",
",",
"token_handler",
")",
":",
"headers",
"=",
"self",
".",
"_get_default_headers",
"(",
")",
"try",
":",
"if",
"self",
".",
"request_validator",
".",
"client_authentication_required",
"(",
"request",
... | Return token or error in json format.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:param token_handler: A token handler instance, for example of type
oauthlib.oauth2.BearerToken.
If the access token request is valid and authori... | [
"Return",
"token",
"or",
"error",
"in",
"json",
"format",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py#L73-L116 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/request_validator.py | RequestValidator.check_client_key | def check_client_key(self, client_key):
"""Check that the client key only contains safe characters
and is no shorter than lower and no longer than upper.
"""
lower, upper = self.client_key_length
return (set(client_key) <= self.safe_characters and
lower <= len(cli... | python | def check_client_key(self, client_key):
"""Check that the client key only contains safe characters
and is no shorter than lower and no longer than upper.
"""
lower, upper = self.client_key_length
return (set(client_key) <= self.safe_characters and
lower <= len(cli... | [
"def",
"check_client_key",
"(",
"self",
",",
"client_key",
")",
":",
"lower",
",",
"upper",
"=",
"self",
".",
"client_key_length",
"return",
"(",
"set",
"(",
"client_key",
")",
"<=",
"self",
".",
"safe_characters",
"and",
"lower",
"<=",
"len",
"(",
"client... | Check that the client key only contains safe characters
and is no shorter than lower and no longer than upper. | [
"Check",
"that",
"the",
"client",
"key",
"only",
"contains",
"safe",
"characters",
"and",
"is",
"no",
"shorter",
"than",
"lower",
"and",
"no",
"longer",
"than",
"upper",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/request_validator.py#L158-L164 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/request_validator.py | RequestValidator.check_request_token | def check_request_token(self, request_token):
"""Checks that the request token contains only safe characters
and is no shorter than lower and no longer than upper.
"""
lower, upper = self.request_token_length
return (set(request_token) <= self.safe_characters and
... | python | def check_request_token(self, request_token):
"""Checks that the request token contains only safe characters
and is no shorter than lower and no longer than upper.
"""
lower, upper = self.request_token_length
return (set(request_token) <= self.safe_characters and
... | [
"def",
"check_request_token",
"(",
"self",
",",
"request_token",
")",
":",
"lower",
",",
"upper",
"=",
"self",
".",
"request_token_length",
"return",
"(",
"set",
"(",
"request_token",
")",
"<=",
"self",
".",
"safe_characters",
"and",
"lower",
"<=",
"len",
"(... | Checks that the request token contains only safe characters
and is no shorter than lower and no longer than upper. | [
"Checks",
"that",
"the",
"request",
"token",
"contains",
"only",
"safe",
"characters",
"and",
"is",
"no",
"shorter",
"than",
"lower",
"and",
"no",
"longer",
"than",
"upper",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/request_validator.py#L166-L172 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/request_validator.py | RequestValidator.check_access_token | def check_access_token(self, request_token):
"""Checks that the token contains only safe characters
and is no shorter than lower and no longer than upper.
"""
lower, upper = self.access_token_length
return (set(request_token) <= self.safe_characters and
lower <= l... | python | def check_access_token(self, request_token):
"""Checks that the token contains only safe characters
and is no shorter than lower and no longer than upper.
"""
lower, upper = self.access_token_length
return (set(request_token) <= self.safe_characters and
lower <= l... | [
"def",
"check_access_token",
"(",
"self",
",",
"request_token",
")",
":",
"lower",
",",
"upper",
"=",
"self",
".",
"access_token_length",
"return",
"(",
"set",
"(",
"request_token",
")",
"<=",
"self",
".",
"safe_characters",
"and",
"lower",
"<=",
"len",
"(",... | Checks that the token contains only safe characters
and is no shorter than lower and no longer than upper. | [
"Checks",
"that",
"the",
"token",
"contains",
"only",
"safe",
"characters",
"and",
"is",
"no",
"shorter",
"than",
"lower",
"and",
"no",
"longer",
"than",
"upper",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/request_validator.py#L174-L180 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/request_validator.py | RequestValidator.check_nonce | def check_nonce(self, nonce):
"""Checks that the nonce only contains only safe characters
and is no shorter than lower and no longer than upper.
"""
lower, upper = self.nonce_length
return (set(nonce) <= self.safe_characters and
lower <= len(nonce) <= upper) | python | def check_nonce(self, nonce):
"""Checks that the nonce only contains only safe characters
and is no shorter than lower and no longer than upper.
"""
lower, upper = self.nonce_length
return (set(nonce) <= self.safe_characters and
lower <= len(nonce) <= upper) | [
"def",
"check_nonce",
"(",
"self",
",",
"nonce",
")",
":",
"lower",
",",
"upper",
"=",
"self",
".",
"nonce_length",
"return",
"(",
"set",
"(",
"nonce",
")",
"<=",
"self",
".",
"safe_characters",
"and",
"lower",
"<=",
"len",
"(",
"nonce",
")",
"<=",
"... | Checks that the nonce only contains only safe characters
and is no shorter than lower and no longer than upper. | [
"Checks",
"that",
"the",
"nonce",
"only",
"contains",
"only",
"safe",
"characters",
"and",
"is",
"no",
"shorter",
"than",
"lower",
"and",
"no",
"longer",
"than",
"upper",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/request_validator.py#L182-L188 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/request_validator.py | RequestValidator.check_verifier | def check_verifier(self, verifier):
"""Checks that the verifier contains only safe characters
and is no shorter than lower and no longer than upper.
"""
lower, upper = self.verifier_length
return (set(verifier) <= self.safe_characters and
lower <= len(verifier) <=... | python | def check_verifier(self, verifier):
"""Checks that the verifier contains only safe characters
and is no shorter than lower and no longer than upper.
"""
lower, upper = self.verifier_length
return (set(verifier) <= self.safe_characters and
lower <= len(verifier) <=... | [
"def",
"check_verifier",
"(",
"self",
",",
"verifier",
")",
":",
"lower",
",",
"upper",
"=",
"self",
".",
"verifier_length",
"return",
"(",
"set",
"(",
"verifier",
")",
"<=",
"self",
".",
"safe_characters",
"and",
"lower",
"<=",
"len",
"(",
"verifier",
"... | Checks that the verifier contains only safe characters
and is no shorter than lower and no longer than upper. | [
"Checks",
"that",
"the",
"verifier",
"contains",
"only",
"safe",
"characters",
"and",
"is",
"no",
"shorter",
"than",
"lower",
"and",
"no",
"longer",
"than",
"upper",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/request_validator.py#L190-L196 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/request_validator.py | RequestValidator.validate_timestamp_and_nonce | def validate_timestamp_and_nonce(self, client_key, timestamp, nonce,
request, request_token=None, access_token=None):
"""Validates that the nonce has not been used before.
:param client_key: The client/consumer key.
:param timestamp: The ``oauth_timestamp`` ... | python | def validate_timestamp_and_nonce(self, client_key, timestamp, nonce,
request, request_token=None, access_token=None):
"""Validates that the nonce has not been used before.
:param client_key: The client/consumer key.
:param timestamp: The ``oauth_timestamp`` ... | [
"def",
"validate_timestamp_and_nonce",
"(",
"self",
",",
"client_key",
",",
"timestamp",
",",
"nonce",
",",
"request",
",",
"request_token",
"=",
"None",
",",
"access_token",
"=",
"None",
")",
":",
"raise",
"self",
".",
"_subclass_must_implement",
"(",
"\"valida... | Validates that the nonce has not been used before.
:param client_key: The client/consumer key.
:param timestamp: The ``oauth_timestamp`` parameter.
:param nonce: The ``oauth_nonce`` parameter.
:param request_token: Request token string, if any.
:param access_token: Access token ... | [
"Validates",
"that",
"the",
"nonce",
"has",
"not",
"been",
"used",
"before",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/request_validator.py#L576-L625 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/parameters.py | prepare_grant_uri | def prepare_grant_uri(uri, client_id, response_type, redirect_uri=None,
scope=None, state=None, **kwargs):
"""Prepare the authorization grant request URI.
The client constructs the request URI by adding the following
parameters to the query component of the authorization endpoint URI
... | python | def prepare_grant_uri(uri, client_id, response_type, redirect_uri=None,
scope=None, state=None, **kwargs):
"""Prepare the authorization grant request URI.
The client constructs the request URI by adding the following
parameters to the query component of the authorization endpoint URI
... | [
"def",
"prepare_grant_uri",
"(",
"uri",
",",
"client_id",
",",
"response_type",
",",
"redirect_uri",
"=",
"None",
",",
"scope",
"=",
"None",
",",
"state",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"not",
"is_secure_transport",
"(",
"uri",
")",
":... | Prepare the authorization grant request URI.
The client constructs the request URI by adding the following
parameters to the query component of the authorization endpoint URI
using the ``application/x-www-form-urlencoded`` format as defined by
[`W3C.REC-html401-19991224`_]:
:param uri:
:param ... | [
"Prepare",
"the",
"authorization",
"grant",
"request",
"URI",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/parameters.py#L31-L87 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/parameters.py | prepare_token_request | def prepare_token_request(grant_type, body='', include_client_id=True, **kwargs):
"""Prepare the access token request.
The client makes a request to the token endpoint by adding the
following parameters using the ``application/x-www-form-urlencoded``
format in the HTTP request entity-body:
:param ... | python | def prepare_token_request(grant_type, body='', include_client_id=True, **kwargs):
"""Prepare the access token request.
The client makes a request to the token endpoint by adding the
following parameters using the ``application/x-www-form-urlencoded``
format in the HTTP request entity-body:
:param ... | [
"def",
"prepare_token_request",
"(",
"grant_type",
",",
"body",
"=",
"''",
",",
"include_client_id",
"=",
"True",
",",
"**",
"kwargs",
")",
":",
"params",
"=",
"[",
"(",
"'grant_type'",
",",
"grant_type",
")",
"]",
"if",
"'scope'",
"in",
"kwargs",
":",
"... | Prepare the access token request.
The client makes a request to the token endpoint by adding the
following parameters using the ``application/x-www-form-urlencoded``
format in the HTTP request entity-body:
:param grant_type: To indicate grant type being used, i.e. "password",
"a... | [
"Prepare",
"the",
"access",
"token",
"request",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/parameters.py#L90-L162 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/parameters.py | parse_authorization_code_response | def parse_authorization_code_response(uri, state=None):
"""Parse authorization grant response URI into a dict.
If the resource owner grants the access request, the authorization
server issues an authorization code and delivers it to the client by
adding the following parameters to the query component o... | python | def parse_authorization_code_response(uri, state=None):
"""Parse authorization grant response URI into a dict.
If the resource owner grants the access request, the authorization
server issues an authorization code and delivers it to the client by
adding the following parameters to the query component o... | [
"def",
"parse_authorization_code_response",
"(",
"uri",
",",
"state",
"=",
"None",
")",
":",
"if",
"not",
"is_secure_transport",
"(",
"uri",
")",
":",
"raise",
"InsecureTransportError",
"(",
")",
"query",
"=",
"urlparse",
".",
"urlparse",
"(",
"uri",
")",
".... | Parse authorization grant response URI into a dict.
If the resource owner grants the access request, the authorization
server issues an authorization code and delivers it to the client by
adding the following parameters to the query component of the
redirection URI using the ``application/x-www-form-ur... | [
"Parse",
"authorization",
"grant",
"response",
"URI",
"into",
"a",
"dict",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/parameters.py#L223-L273 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/parameters.py | parse_implicit_response | def parse_implicit_response(uri, state=None, scope=None):
"""Parse the implicit token response URI into a dict.
If the resource owner grants the access request, the authorization
server issues an access token and delivers it to the client by adding
the following parameters to the fragment component of ... | python | def parse_implicit_response(uri, state=None, scope=None):
"""Parse the implicit token response URI into a dict.
If the resource owner grants the access request, the authorization
server issues an access token and delivers it to the client by adding
the following parameters to the fragment component of ... | [
"def",
"parse_implicit_response",
"(",
"uri",
",",
"state",
"=",
"None",
",",
"scope",
"=",
"None",
")",
":",
"if",
"not",
"is_secure_transport",
"(",
"uri",
")",
":",
"raise",
"InsecureTransportError",
"(",
")",
"fragment",
"=",
"urlparse",
".",
"urlparse",... | Parse the implicit token response URI into a dict.
If the resource owner grants the access request, the authorization
server issues an access token and delivers it to the client by adding
the following parameters to the fragment component of the redirection
URI using the ``application/x-www-form-urlenc... | [
"Parse",
"the",
"implicit",
"token",
"response",
"URI",
"into",
"a",
"dict",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/parameters.py#L276-L342 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/parameters.py | parse_token_response | def parse_token_response(body, scope=None):
"""Parse the JSON token response body into a dict.
The authorization server issues an access token and optional refresh
token, and constructs the response by adding the following parameters
to the entity body of the HTTP response with a 200 (OK) status code:
... | python | def parse_token_response(body, scope=None):
"""Parse the JSON token response body into a dict.
The authorization server issues an access token and optional refresh
token, and constructs the response by adding the following parameters
to the entity body of the HTTP response with a 200 (OK) status code:
... | [
"def",
"parse_token_response",
"(",
"body",
",",
"scope",
"=",
"None",
")",
":",
"try",
":",
"params",
"=",
"json",
".",
"loads",
"(",
"body",
")",
"except",
"ValueError",
":",
"params",
"=",
"dict",
"(",
"urlparse",
".",
"parse_qsl",
"(",
"body",
")",... | Parse the JSON token response body into a dict.
The authorization server issues an access token and optional refresh
token, and constructs the response by adding the following parameters
to the entity body of the HTTP response with a 200 (OK) status code:
access_token
REQUIRED. The access... | [
"Parse",
"the",
"JSON",
"token",
"response",
"body",
"into",
"a",
"dict",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/parameters.py#L345-L426 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/parameters.py | validate_token_parameters | def validate_token_parameters(params):
"""Ensures token precence, token type, expiration and scope in params."""
if 'error' in params:
raise_from_error(params.get('error'), params)
if not 'access_token' in params:
raise MissingTokenError(description="Missing access token parameter.")
i... | python | def validate_token_parameters(params):
"""Ensures token precence, token type, expiration and scope in params."""
if 'error' in params:
raise_from_error(params.get('error'), params)
if not 'access_token' in params:
raise MissingTokenError(description="Missing access token parameter.")
i... | [
"def",
"validate_token_parameters",
"(",
"params",
")",
":",
"if",
"'error'",
"in",
"params",
":",
"raise_from_error",
"(",
"params",
".",
"get",
"(",
"'error'",
")",
",",
"params",
")",
"if",
"not",
"'access_token'",
"in",
"params",
":",
"raise",
"MissingTo... | Ensures token precence, token type, expiration and scope in params. | [
"Ensures",
"token",
"precence",
"token",
"type",
"expiration",
"and",
"scope",
"in",
"params",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/parameters.py#L429-L455 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/clients/legacy_application.py | LegacyApplicationClient.prepare_request_body | def prepare_request_body(self, username, password, body='', scope=None,
include_client_id=False, **kwargs):
"""Add the resource owner password and username to the request body.
The client makes a request to the token endpoint by adding the
following parameters using... | python | def prepare_request_body(self, username, password, body='', scope=None,
include_client_id=False, **kwargs):
"""Add the resource owner password and username to the request body.
The client makes a request to the token endpoint by adding the
following parameters using... | [
"def",
"prepare_request_body",
"(",
"self",
",",
"username",
",",
"password",
",",
"body",
"=",
"''",
",",
"scope",
"=",
"None",
",",
"include_client_id",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"kwargs",
"[",
"'client_id'",
"]",
"=",
"self",
".",
... | Add the resource owner password and username to the request body.
The client makes a request to the token endpoint by adding the
following parameters using the "application/x-www-form-urlencoded"
format per `Appendix B`_ in the HTTP request entity-body:
:param username: The resource... | [
"Add",
"the",
"resource",
"owner",
"password",
"and",
"username",
"to",
"the",
"request",
"body",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/clients/legacy_application.py#L43-L85 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/clients/mobile_application.py | MobileApplicationClient.prepare_request_uri | def prepare_request_uri(self, uri, redirect_uri=None, scope=None,
state=None, **kwargs):
"""Prepare the implicit grant request URI.
The client constructs the request URI by adding the following
parameters to the query component of the authorization endpoint URI
... | python | def prepare_request_uri(self, uri, redirect_uri=None, scope=None,
state=None, **kwargs):
"""Prepare the implicit grant request URI.
The client constructs the request URI by adding the following
parameters to the query component of the authorization endpoint URI
... | [
"def",
"prepare_request_uri",
"(",
"self",
",",
"uri",
",",
"redirect_uri",
"=",
"None",
",",
"scope",
"=",
"None",
",",
"state",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"return",
"prepare_grant_uri",
"(",
"uri",
",",
"self",
".",
"client_id",
",",
... | Prepare the implicit grant request URI.
The client constructs the request URI by adding the following
parameters to the query component of the authorization endpoint URI
using the "application/x-www-form-urlencoded" format, per `Appendix B`_:
:param redirect_uri: OPTIONAL. The redirec... | [
"Prepare",
"the",
"implicit",
"grant",
"request",
"URI",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/clients/mobile_application.py#L51-L97 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/clients/mobile_application.py | MobileApplicationClient.parse_request_uri_response | def parse_request_uri_response(self, uri, state=None, scope=None):
"""Parse the response URI fragment.
If the resource owner grants the access request, the authorization
server issues an access token and delivers it to the client by adding
the following parameters to the fragment compon... | python | def parse_request_uri_response(self, uri, state=None, scope=None):
"""Parse the response URI fragment.
If the resource owner grants the access request, the authorization
server issues an access token and delivers it to the client by adding
the following parameters to the fragment compon... | [
"def",
"parse_request_uri_response",
"(",
"self",
",",
"uri",
",",
"state",
"=",
"None",
",",
"scope",
"=",
"None",
")",
":",
"self",
".",
"token",
"=",
"parse_implicit_response",
"(",
"uri",
",",
"state",
"=",
"state",
",",
"scope",
"=",
"scope",
")",
... | Parse the response URI fragment.
If the resource owner grants the access request, the authorization
server issues an access token and delivers it to the client by adding
the following parameters to the fragment component of the redirection
URI using the "application/x-www-form-urlencode... | [
"Parse",
"the",
"response",
"URI",
"fragment",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/clients/mobile_application.py#L99-L174 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/request_validator.py | RequestValidator.confirm_redirect_uri | def confirm_redirect_uri(self, client_id, code, redirect_uri, client, request,
*args, **kwargs):
"""Ensure that the authorization process represented by this authorization
code began with this 'redirect_uri'.
If the client specifies a redirect_uri when obtaining cod... | python | def confirm_redirect_uri(self, client_id, code, redirect_uri, client, request,
*args, **kwargs):
"""Ensure that the authorization process represented by this authorization
code began with this 'redirect_uri'.
If the client specifies a redirect_uri when obtaining cod... | [
"def",
"confirm_redirect_uri",
"(",
"self",
",",
"client_id",
",",
"code",
",",
"redirect_uri",
",",
"client",
",",
"request",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"raise",
"NotImplementedError",
"(",
"'Subclasses must implement this method.'",
")"
] | Ensure that the authorization process represented by this authorization
code began with this 'redirect_uri'.
If the client specifies a redirect_uri when obtaining code then that
redirect URI must be bound to the code and verified equal in this
method, according to RFC 6749 section 4.1.3... | [
"Ensure",
"that",
"the",
"authorization",
"process",
"represented",
"by",
"this",
"authorization",
"code",
"began",
"with",
"this",
"redirect_uri",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/request_validator.py#L89-L111 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/request_validator.py | RequestValidator.save_token | def save_token(self, token, request, *args, **kwargs):
"""Persist the token with a token type specific method.
Currently, only save_bearer_token is supported.
:param token: A (Bearer) token dict.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
"... | python | def save_token(self, token, request, *args, **kwargs):
"""Persist the token with a token type specific method.
Currently, only save_bearer_token is supported.
:param token: A (Bearer) token dict.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
"... | [
"def",
"save_token",
"(",
"self",
",",
"token",
",",
"request",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"return",
"self",
".",
"save_bearer_token",
"(",
"token",
",",
"request",
",",
"*",
"args",
",",
"**",
"kwargs",
")"
] | Persist the token with a token type specific method.
Currently, only save_bearer_token is supported.
:param token: A (Bearer) token dict.
:param request: OAuthlib request.
:type request: oauthlib.common.Request | [
"Persist",
"the",
"token",
"with",
"a",
"token",
"type",
"specific",
"method",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/request_validator.py#L294-L303 | train |
oauthlib/oauthlib | oauthlib/common.py | encode_params_utf8 | def encode_params_utf8(params):
"""Ensures that all parameters in a list of 2-element tuples are encoded to
bytestrings using UTF-8
"""
encoded = []
for k, v in params:
encoded.append((
k.encode('utf-8') if isinstance(k, unicode_type) else k,
v.encode('utf-8') if isin... | python | def encode_params_utf8(params):
"""Ensures that all parameters in a list of 2-element tuples are encoded to
bytestrings using UTF-8
"""
encoded = []
for k, v in params:
encoded.append((
k.encode('utf-8') if isinstance(k, unicode_type) else k,
v.encode('utf-8') if isin... | [
"def",
"encode_params_utf8",
"(",
"params",
")",
":",
"encoded",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"params",
":",
"encoded",
".",
"append",
"(",
"(",
"k",
".",
"encode",
"(",
"'utf-8'",
")",
"if",
"isinstance",
"(",
"k",
",",
"unicode_type",... | Ensures that all parameters in a list of 2-element tuples are encoded to
bytestrings using UTF-8 | [
"Ensures",
"that",
"all",
"parameters",
"in",
"a",
"list",
"of",
"2",
"-",
"element",
"tuples",
"are",
"encoded",
"to",
"bytestrings",
"using",
"UTF",
"-",
"8"
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/common.py#L92-L101 | train |
oauthlib/oauthlib | oauthlib/common.py | decode_params_utf8 | def decode_params_utf8(params):
"""Ensures that all parameters in a list of 2-element tuples are decoded to
unicode using UTF-8.
"""
decoded = []
for k, v in params:
decoded.append((
k.decode('utf-8') if isinstance(k, bytes) else k,
v.decode('utf-8') if isinstance(v, ... | python | def decode_params_utf8(params):
"""Ensures that all parameters in a list of 2-element tuples are decoded to
unicode using UTF-8.
"""
decoded = []
for k, v in params:
decoded.append((
k.decode('utf-8') if isinstance(k, bytes) else k,
v.decode('utf-8') if isinstance(v, ... | [
"def",
"decode_params_utf8",
"(",
"params",
")",
":",
"decoded",
"=",
"[",
"]",
"for",
"k",
",",
"v",
"in",
"params",
":",
"decoded",
".",
"append",
"(",
"(",
"k",
".",
"decode",
"(",
"'utf-8'",
")",
"if",
"isinstance",
"(",
"k",
",",
"bytes",
")",... | Ensures that all parameters in a list of 2-element tuples are decoded to
unicode using UTF-8. | [
"Ensures",
"that",
"all",
"parameters",
"in",
"a",
"list",
"of",
"2",
"-",
"element",
"tuples",
"are",
"decoded",
"to",
"unicode",
"using",
"UTF",
"-",
"8",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/common.py#L104-L113 | train |
oauthlib/oauthlib | oauthlib/common.py | urldecode | def urldecode(query):
"""Decode a query string in x-www-form-urlencoded format into a sequence
of two-element tuples.
Unlike urlparse.parse_qsl(..., strict_parsing=True) urldecode will enforce
correct formatting of the query string by validation. If validation fails
a ValueError will be raised. url... | python | def urldecode(query):
"""Decode a query string in x-www-form-urlencoded format into a sequence
of two-element tuples.
Unlike urlparse.parse_qsl(..., strict_parsing=True) urldecode will enforce
correct formatting of the query string by validation. If validation fails
a ValueError will be raised. url... | [
"def",
"urldecode",
"(",
"query",
")",
":",
"if",
"query",
"and",
"not",
"set",
"(",
"query",
")",
"<=",
"urlencoded",
":",
"error",
"=",
"(",
"\"Error trying to decode a non urlencoded string. \"",
"\"Found invalid characters: %s \"",
"\"in the string: '%s'. \"",
"\"Pl... | Decode a query string in x-www-form-urlencoded format into a sequence
of two-element tuples.
Unlike urlparse.parse_qsl(..., strict_parsing=True) urldecode will enforce
correct formatting of the query string by validation. If validation fails
a ValueError will be raised. urllib.parse_qsl will only raise... | [
"Decode",
"a",
"query",
"string",
"in",
"x",
"-",
"www",
"-",
"form",
"-",
"urlencoded",
"format",
"into",
"a",
"sequence",
"of",
"two",
"-",
"element",
"tuples",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/common.py#L119-L165 | train |
oauthlib/oauthlib | oauthlib/common.py | extract_params | def extract_params(raw):
"""Extract parameters and return them as a list of 2-tuples.
Will successfully extract parameters from urlencoded query strings,
dicts, or lists of 2-tuples. Empty strings/dicts/lists will return an
empty list of parameters. Any other input will result in a return
value of ... | python | def extract_params(raw):
"""Extract parameters and return them as a list of 2-tuples.
Will successfully extract parameters from urlencoded query strings,
dicts, or lists of 2-tuples. Empty strings/dicts/lists will return an
empty list of parameters. Any other input will result in a return
value of ... | [
"def",
"extract_params",
"(",
"raw",
")",
":",
"if",
"isinstance",
"(",
"raw",
",",
"(",
"bytes",
",",
"unicode_type",
")",
")",
":",
"try",
":",
"params",
"=",
"urldecode",
"(",
"raw",
")",
"except",
"ValueError",
":",
"params",
"=",
"None",
"elif",
... | Extract parameters and return them as a list of 2-tuples.
Will successfully extract parameters from urlencoded query strings,
dicts, or lists of 2-tuples. Empty strings/dicts/lists will return an
empty list of parameters. Any other input will result in a return
value of None. | [
"Extract",
"parameters",
"and",
"return",
"them",
"as",
"a",
"list",
"of",
"2",
"-",
"tuples",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/common.py#L168-L194 | train |
oauthlib/oauthlib | oauthlib/common.py | generate_token | def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):
"""Generates a non-guessable OAuth token
OAuth (1 and 2) does not specify the format of tokens except that they
should be strings of random characters. Tokens should not be guessable
and entropy when generating the random characters is i... | python | def generate_token(length=30, chars=UNICODE_ASCII_CHARACTER_SET):
"""Generates a non-guessable OAuth token
OAuth (1 and 2) does not specify the format of tokens except that they
should be strings of random characters. Tokens should not be guessable
and entropy when generating the random characters is i... | [
"def",
"generate_token",
"(",
"length",
"=",
"30",
",",
"chars",
"=",
"UNICODE_ASCII_CHARACTER_SET",
")",
":",
"rand",
"=",
"SystemRandom",
"(",
")",
"return",
"''",
".",
"join",
"(",
"rand",
".",
"choice",
"(",
"chars",
")",
"for",
"x",
"in",
"range",
... | Generates a non-guessable OAuth token
OAuth (1 and 2) does not specify the format of tokens except that they
should be strings of random characters. Tokens should not be guessable
and entropy when generating the random characters is important. Which is
why SystemRandom is used instead of the default ra... | [
"Generates",
"a",
"non",
"-",
"guessable",
"OAuth",
"token"
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/common.py#L224-L233 | train |
oauthlib/oauthlib | oauthlib/common.py | add_params_to_qs | def add_params_to_qs(query, params):
"""Extend a query with a list of two-tuples."""
if isinstance(params, dict):
params = params.items()
queryparams = urlparse.parse_qsl(query, keep_blank_values=True)
queryparams.extend(params)
return urlencode(queryparams) | python | def add_params_to_qs(query, params):
"""Extend a query with a list of two-tuples."""
if isinstance(params, dict):
params = params.items()
queryparams = urlparse.parse_qsl(query, keep_blank_values=True)
queryparams.extend(params)
return urlencode(queryparams) | [
"def",
"add_params_to_qs",
"(",
"query",
",",
"params",
")",
":",
"if",
"isinstance",
"(",
"params",
",",
"dict",
")",
":",
"params",
"=",
"params",
".",
"items",
"(",
")",
"queryparams",
"=",
"urlparse",
".",
"parse_qsl",
"(",
"query",
",",
"keep_blank_... | Extend a query with a list of two-tuples. | [
"Extend",
"a",
"query",
"with",
"a",
"list",
"of",
"two",
"-",
"tuples",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/common.py#L269-L275 | train |
oauthlib/oauthlib | oauthlib/common.py | add_params_to_uri | def add_params_to_uri(uri, params, fragment=False):
"""Add a list of two-tuples to the uri query components."""
sch, net, path, par, query, fra = urlparse.urlparse(uri)
if fragment:
fra = add_params_to_qs(fra, params)
else:
query = add_params_to_qs(query, params)
return urlparse.urlu... | python | def add_params_to_uri(uri, params, fragment=False):
"""Add a list of two-tuples to the uri query components."""
sch, net, path, par, query, fra = urlparse.urlparse(uri)
if fragment:
fra = add_params_to_qs(fra, params)
else:
query = add_params_to_qs(query, params)
return urlparse.urlu... | [
"def",
"add_params_to_uri",
"(",
"uri",
",",
"params",
",",
"fragment",
"=",
"False",
")",
":",
"sch",
",",
"net",
",",
"path",
",",
"par",
",",
"query",
",",
"fra",
"=",
"urlparse",
".",
"urlparse",
"(",
"uri",
")",
"if",
"fragment",
":",
"fra",
"... | Add a list of two-tuples to the uri query components. | [
"Add",
"a",
"list",
"of",
"two",
"-",
"tuples",
"to",
"the",
"uri",
"query",
"components",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/common.py#L278-L285 | train |
oauthlib/oauthlib | oauthlib/common.py | to_unicode | def to_unicode(data, encoding='UTF-8'):
"""Convert a number of different types of objects to unicode."""
if isinstance(data, unicode_type):
return data
if isinstance(data, bytes):
return unicode_type(data, encoding=encoding)
if hasattr(data, '__iter__'):
try:
dict(d... | python | def to_unicode(data, encoding='UTF-8'):
"""Convert a number of different types of objects to unicode."""
if isinstance(data, unicode_type):
return data
if isinstance(data, bytes):
return unicode_type(data, encoding=encoding)
if hasattr(data, '__iter__'):
try:
dict(d... | [
"def",
"to_unicode",
"(",
"data",
",",
"encoding",
"=",
"'UTF-8'",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"unicode_type",
")",
":",
"return",
"data",
"if",
"isinstance",
"(",
"data",
",",
"bytes",
")",
":",
"return",
"unicode_type",
"(",
"data",... | Convert a number of different types of objects to unicode. | [
"Convert",
"a",
"number",
"of",
"different",
"types",
"of",
"objects",
"to",
"unicode",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/common.py#L306-L328 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/parameters.py | _append_params | def _append_params(oauth_params, params):
"""Append OAuth params to an existing set of parameters.
Both params and oauth_params is must be lists of 2-tuples.
Per `section 3.5.2`_ and `3.5.3`_ of the spec.
.. _`section 3.5.2`: https://tools.ietf.org/html/rfc5849#section-3.5.2
.. _`3.5.3`: https://... | python | def _append_params(oauth_params, params):
"""Append OAuth params to an existing set of parameters.
Both params and oauth_params is must be lists of 2-tuples.
Per `section 3.5.2`_ and `3.5.3`_ of the spec.
.. _`section 3.5.2`: https://tools.ietf.org/html/rfc5849#section-3.5.2
.. _`3.5.3`: https://... | [
"def",
"_append_params",
"(",
"oauth_params",
",",
"params",
")",
":",
"merged",
"=",
"list",
"(",
"params",
")",
"merged",
".",
"extend",
"(",
"oauth_params",
")",
"merged",
".",
"sort",
"(",
"key",
"=",
"lambda",
"i",
":",
"i",
"[",
"0",
"]",
".",
... | Append OAuth params to an existing set of parameters.
Both params and oauth_params is must be lists of 2-tuples.
Per `section 3.5.2`_ and `3.5.3`_ of the spec.
.. _`section 3.5.2`: https://tools.ietf.org/html/rfc5849#section-3.5.2
.. _`3.5.3`: https://tools.ietf.org/html/rfc5849#section-3.5.3 | [
"Append",
"OAuth",
"params",
"to",
"an",
"existing",
"set",
"of",
"parameters",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/parameters.py#L94-L112 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/parameters.py | prepare_request_uri_query | def prepare_request_uri_query(oauth_params, uri):
"""Prepare the Request URI Query.
Per `section 3.5.3`_ of the spec.
.. _`section 3.5.3`: https://tools.ietf.org/html/rfc5849#section-3.5.3
"""
# append OAuth params to the existing set of query components
sch, net, path, par, query, fra = urlp... | python | def prepare_request_uri_query(oauth_params, uri):
"""Prepare the Request URI Query.
Per `section 3.5.3`_ of the spec.
.. _`section 3.5.3`: https://tools.ietf.org/html/rfc5849#section-3.5.3
"""
# append OAuth params to the existing set of query components
sch, net, path, par, query, fra = urlp... | [
"def",
"prepare_request_uri_query",
"(",
"oauth_params",
",",
"uri",
")",
":",
"sch",
",",
"net",
",",
"path",
",",
"par",
",",
"query",
",",
"fra",
"=",
"urlparse",
"(",
"uri",
")",
"query",
"=",
"urlencode",
"(",
"_append_params",
"(",
"oauth_params",
... | Prepare the Request URI Query.
Per `section 3.5.3`_ of the spec.
.. _`section 3.5.3`: https://tools.ietf.org/html/rfc5849#section-3.5.3 | [
"Prepare",
"the",
"Request",
"URI",
"Query",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/parameters.py#L127-L139 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/endpoints/request_token.py | RequestTokenEndpoint.validate_request_token_request | def validate_request_token_request(self, request):
"""Validate a request token request.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:raises: OAuth1Error if the request is invalid.
:returns: A tuple of 2 elements.
1. The validation r... | python | def validate_request_token_request(self, request):
"""Validate a request token request.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:raises: OAuth1Error if the request is invalid.
:returns: A tuple of 2 elements.
1. The validation r... | [
"def",
"validate_request_token_request",
"(",
"self",
",",
"request",
")",
":",
"self",
".",
"_check_transport_security",
"(",
"request",
")",
"self",
".",
"_check_mandatory_parameters",
"(",
"request",
")",
"if",
"request",
".",
"realm",
":",
"request",
".",
"r... | Validate a request token request.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:raises: OAuth1Error if the request is invalid.
:returns: A tuple of 2 elements.
1. The validation result (True or False).
2. The request object... | [
"Validate",
"a",
"request",
"token",
"request",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/endpoints/request_token.py#L112-L211 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/endpoints/signature_only.py | SignatureOnlyEndpoint.validate_request | def validate_request(self, uri, http_method='GET',
body=None, headers=None):
"""Validate a signed OAuth request.
:param uri: The full URI of the token request.
:param http_method: A valid HTTP verb, i.e. GET, POST, PUT, HEAD, etc.
:param body: The request body a... | python | def validate_request(self, uri, http_method='GET',
body=None, headers=None):
"""Validate a signed OAuth request.
:param uri: The full URI of the token request.
:param http_method: A valid HTTP verb, i.e. GET, POST, PUT, HEAD, etc.
:param body: The request body a... | [
"def",
"validate_request",
"(",
"self",
",",
"uri",
",",
"http_method",
"=",
"'GET'",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"try",
":",
"request",
"=",
"self",
".",
"_create_request",
"(",
"uri",
",",
"http_method",
",",
"bod... | Validate a signed OAuth request.
:param uri: The full URI of the token request.
:param http_method: A valid HTTP verb, i.e. GET, POST, PUT, HEAD, etc.
:param body: The request body as a string.
:param headers: The request headers as a dict.
:returns: A tuple of 2 elements.
... | [
"Validate",
"a",
"signed",
"OAuth",
"request",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/endpoints/signature_only.py#L23-L84 | train |
oauthlib/oauthlib | oauthlib/openid/connect/core/tokens.py | JWTToken.create_token | def create_token(self, request, refresh_token=False):
"""Create a JWT Token, using requestvalidator method."""
if callable(self.expires_in):
expires_in = self.expires_in(request)
else:
expires_in = self.expires_in
request.expires_in = expires_in
return ... | python | def create_token(self, request, refresh_token=False):
"""Create a JWT Token, using requestvalidator method."""
if callable(self.expires_in):
expires_in = self.expires_in(request)
else:
expires_in = self.expires_in
request.expires_in = expires_in
return ... | [
"def",
"create_token",
"(",
"self",
",",
"request",
",",
"refresh_token",
"=",
"False",
")",
":",
"if",
"callable",
"(",
"self",
".",
"expires_in",
")",
":",
"expires_in",
"=",
"self",
".",
"expires_in",
"(",
"request",
")",
"else",
":",
"expires_in",
"=... | Create a JWT Token, using requestvalidator method. | [
"Create",
"a",
"JWT",
"Token",
"using",
"requestvalidator",
"method",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/openid/connect/core/tokens.py#L28-L38 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/__init__.py | Client.get_oauth_signature | def get_oauth_signature(self, request):
"""Get an OAuth signature to be used in signing a request
To satisfy `section 3.4.1.2`_ item 2, if the request argument's
headers dict attribute contains a Host item, its value will
replace any netloc part of the request argument's uri attribute
... | python | def get_oauth_signature(self, request):
"""Get an OAuth signature to be used in signing a request
To satisfy `section 3.4.1.2`_ item 2, if the request argument's
headers dict attribute contains a Host item, its value will
replace any netloc part of the request argument's uri attribute
... | [
"def",
"get_oauth_signature",
"(",
"self",
",",
"request",
")",
":",
"if",
"self",
".",
"signature_method",
"==",
"SIGNATURE_PLAINTEXT",
":",
"return",
"signature",
".",
"sign_plaintext",
"(",
"self",
".",
"client_secret",
",",
"self",
".",
"resource_owner_secret"... | Get an OAuth signature to be used in signing a request
To satisfy `section 3.4.1.2`_ item 2, if the request argument's
headers dict attribute contains a Host item, its value will
replace any netloc part of the request argument's uri attribute
value.
.. _`section 3.4.1.2`: https... | [
"Get",
"an",
"OAuth",
"signature",
"to",
"be",
"used",
"in",
"signing",
"a",
"request"
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/__init__.py#L112-L151 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/__init__.py | Client.get_oauth_params | def get_oauth_params(self, request):
"""Get the basic OAuth parameters to be used in generating a signature.
"""
nonce = (generate_nonce()
if self.nonce is None else self.nonce)
timestamp = (generate_timestamp()
if self.timestamp is None else self.ti... | python | def get_oauth_params(self, request):
"""Get the basic OAuth parameters to be used in generating a signature.
"""
nonce = (generate_nonce()
if self.nonce is None else self.nonce)
timestamp = (generate_timestamp()
if self.timestamp is None else self.ti... | [
"def",
"get_oauth_params",
"(",
"self",
",",
"request",
")",
":",
"nonce",
"=",
"(",
"generate_nonce",
"(",
")",
"if",
"self",
".",
"nonce",
"is",
"None",
"else",
"self",
".",
"nonce",
")",
"timestamp",
"=",
"(",
"generate_timestamp",
"(",
")",
"if",
"... | Get the basic OAuth parameters to be used in generating a signature. | [
"Get",
"the",
"basic",
"OAuth",
"parameters",
"to",
"be",
"used",
"in",
"generating",
"a",
"signature",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/__init__.py#L153-L186 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/__init__.py | Client._render | def _render(self, request, formencode=False, realm=None):
"""Render a signed request according to signature type
Returns a 3-tuple containing the request URI, headers, and body.
If the formencode argument is True and the body contains parameters, it
is escaped and returned as a valid f... | python | def _render(self, request, formencode=False, realm=None):
"""Render a signed request according to signature type
Returns a 3-tuple containing the request URI, headers, and body.
If the formencode argument is True and the body contains parameters, it
is escaped and returned as a valid f... | [
"def",
"_render",
"(",
"self",
",",
"request",
",",
"formencode",
"=",
"False",
",",
"realm",
"=",
"None",
")",
":",
"uri",
",",
"headers",
",",
"body",
"=",
"request",
".",
"uri",
",",
"request",
".",
"headers",
",",
"request",
".",
"body",
"if",
... | Render a signed request according to signature type
Returns a 3-tuple containing the request URI, headers, and body.
If the formencode argument is True and the body contains parameters, it
is escaped and returned as a valid formencoded string. | [
"Render",
"a",
"signed",
"request",
"according",
"to",
"signature",
"type"
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/__init__.py#L188-L223 | train |
oauthlib/oauthlib | oauthlib/oauth1/rfc5849/__init__.py | Client.sign | def sign(self, uri, http_method='GET', body=None, headers=None, realm=None):
"""Sign a request
Signs an HTTP request with the specified parts.
Returns a 3-tuple of the signed request's URI, headers, and body.
Note that http_method is not returned as it is unaffected by the OAuth
... | python | def sign(self, uri, http_method='GET', body=None, headers=None, realm=None):
"""Sign a request
Signs an HTTP request with the specified parts.
Returns a 3-tuple of the signed request's URI, headers, and body.
Note that http_method is not returned as it is unaffected by the OAuth
... | [
"def",
"sign",
"(",
"self",
",",
"uri",
",",
"http_method",
"=",
"'GET'",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"realm",
"=",
"None",
")",
":",
"request",
"=",
"Request",
"(",
"uri",
",",
"http_method",
",",
"body",
",",
"head... | Sign a request
Signs an HTTP request with the specified parts.
Returns a 3-tuple of the signed request's URI, headers, and body.
Note that http_method is not returned as it is unaffected by the OAuth
signing process. Also worth noting is that duplicate parameters
will be includ... | [
"Sign",
"a",
"request"
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth1/rfc5849/__init__.py#L225-L327 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/endpoints/base.py | BaseEndpoint._raise_on_invalid_client | def _raise_on_invalid_client(self, request):
"""Raise on failed client authentication."""
if self.request_validator.client_authentication_required(request):
if not self.request_validator.authenticate_client(request):
log.debug('Client authentication failed, %r.', request)
... | python | def _raise_on_invalid_client(self, request):
"""Raise on failed client authentication."""
if self.request_validator.client_authentication_required(request):
if not self.request_validator.authenticate_client(request):
log.debug('Client authentication failed, %r.', request)
... | [
"def",
"_raise_on_invalid_client",
"(",
"self",
",",
"request",
")",
":",
"if",
"self",
".",
"request_validator",
".",
"client_authentication_required",
"(",
"request",
")",
":",
"if",
"not",
"self",
".",
"request_validator",
".",
"authenticate_client",
"(",
"requ... | Raise on failed client authentication. | [
"Raise",
"on",
"failed",
"client",
"authentication",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/endpoints/base.py#L48-L56 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/endpoints/base.py | BaseEndpoint._raise_on_unsupported_token | def _raise_on_unsupported_token(self, request):
"""Raise on unsupported tokens."""
if (request.token_type_hint and
request.token_type_hint in self.valid_token_types and
request.token_type_hint not in self.supported_token_types):
raise UnsupportedTokenTypeError(request... | python | def _raise_on_unsupported_token(self, request):
"""Raise on unsupported tokens."""
if (request.token_type_hint and
request.token_type_hint in self.valid_token_types and
request.token_type_hint not in self.supported_token_types):
raise UnsupportedTokenTypeError(request... | [
"def",
"_raise_on_unsupported_token",
"(",
"self",
",",
"request",
")",
":",
"if",
"(",
"request",
".",
"token_type_hint",
"and",
"request",
".",
"token_type_hint",
"in",
"self",
".",
"valid_token_types",
"and",
"request",
".",
"token_type_hint",
"not",
"in",
"s... | Raise on unsupported tokens. | [
"Raise",
"on",
"unsupported",
"tokens",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/endpoints/base.py#L58-L63 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/endpoints/revocation.py | RevocationEndpoint.create_revocation_response | def create_revocation_response(self, uri, http_method='POST', body=None,
headers=None):
"""Revoke supplied access or refresh token.
The authorization server responds with HTTP status code 200 if the
token has been revoked sucessfully or if the client submitte... | python | def create_revocation_response(self, uri, http_method='POST', body=None,
headers=None):
"""Revoke supplied access or refresh token.
The authorization server responds with HTTP status code 200 if the
token has been revoked sucessfully or if the client submitte... | [
"def",
"create_revocation_response",
"(",
"self",
",",
"uri",
",",
"http_method",
"=",
"'POST'",
",",
"body",
"=",
"None",
",",
"headers",
"=",
"None",
")",
":",
"resp_headers",
"=",
"{",
"'Content-Type'",
":",
"'application/json'",
",",
"'Cache-Control'",
":"... | Revoke supplied access or refresh token.
The authorization server responds with HTTP status code 200 if the
token has been revoked sucessfully or if the client submitted an
invalid token.
Note: invalid tokens do not cause an error response since the client
cannot handle such a... | [
"Revoke",
"supplied",
"access",
"or",
"refresh",
"token",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/endpoints/revocation.py#L41-L85 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/grant_types/base.py | GrantTypeBase.prepare_authorization_response | def prepare_authorization_response(self, request, token, headers, body, status):
"""Place token according to response mode.
Base classes can define a default response mode for their authorization
response by overriding the static `default_response_mode` member.
:param request: OAuthlib... | python | def prepare_authorization_response(self, request, token, headers, body, status):
"""Place token according to response mode.
Base classes can define a default response mode for their authorization
response by overriding the static `default_response_mode` member.
:param request: OAuthlib... | [
"def",
"prepare_authorization_response",
"(",
"self",
",",
"request",
",",
"token",
",",
"headers",
",",
"body",
",",
"status",
")",
":",
"request",
".",
"response_mode",
"=",
"request",
".",
"response_mode",
"or",
"self",
".",
"default_response_mode",
"if",
"... | Place token according to response mode.
Base classes can define a default response mode for their authorization
response by overriding the static `default_response_mode` member.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:param token:
:para... | [
"Place",
"token",
"according",
"to",
"response",
"mode",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/grant_types/base.py#L180-L220 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/tokens.py | prepare_mac_header | def prepare_mac_header(token, uri, key, http_method,
nonce=None,
headers=None,
body=None,
ext='',
hash_algorithm='hmac-sha-1',
issue_time=None,
draft=0):
"... | python | def prepare_mac_header(token, uri, key, http_method,
nonce=None,
headers=None,
body=None,
ext='',
hash_algorithm='hmac-sha-1',
issue_time=None,
draft=0):
"... | [
"def",
"prepare_mac_header",
"(",
"token",
",",
"uri",
",",
"key",
",",
"http_method",
",",
"nonce",
"=",
"None",
",",
"headers",
"=",
"None",
",",
"body",
"=",
"None",
",",
"ext",
"=",
"''",
",",
"hash_algorithm",
"=",
"'hmac-sha-1'",
",",
"issue_time",... | Add an `MAC Access Authentication`_ signature to headers.
Unlike OAuth 1, this HMAC signature does not require inclusion of the
request payload/body, neither does it use a combination of client_secret
and token_secret but rather a mac_key provided together with the access
token.
Currently two algo... | [
"Add",
"an",
"MAC",
"Access",
"Authentication",
"_",
"signature",
"to",
"headers",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/tokens.py#L73-L179 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/tokens.py | get_token_from_header | def get_token_from_header(request):
"""
Helper function to extract a token from the request header.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:return: Return the token or None if the Authorization header is malformed.
"""
token = None
if 'Authorization' i... | python | def get_token_from_header(request):
"""
Helper function to extract a token from the request header.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:return: Return the token or None if the Authorization header is malformed.
"""
token = None
if 'Authorization' i... | [
"def",
"get_token_from_header",
"(",
"request",
")",
":",
"token",
"=",
"None",
"if",
"'Authorization'",
"in",
"request",
".",
"headers",
":",
"split_header",
"=",
"request",
".",
"headers",
".",
"get",
"(",
"'Authorization'",
")",
".",
"split",
"(",
")",
... | Helper function to extract a token from the request header.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:return: Return the token or None if the Authorization header is malformed. | [
"Helper",
"function",
"to",
"extract",
"a",
"token",
"from",
"the",
"request",
"header",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/tokens.py#L245-L262 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/tokens.py | BearerToken.create_token | def create_token(self, request, refresh_token=False, **kwargs):
"""
Create a BearerToken, by default without refresh token.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:param refresh_token:
"""
if "save_token" in kwargs:
w... | python | def create_token(self, request, refresh_token=False, **kwargs):
"""
Create a BearerToken, by default without refresh token.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:param refresh_token:
"""
if "save_token" in kwargs:
w... | [
"def",
"create_token",
"(",
"self",
",",
"request",
",",
"refresh_token",
"=",
"False",
",",
"**",
"kwargs",
")",
":",
"if",
"\"save_token\"",
"in",
"kwargs",
":",
"warnings",
".",
"warn",
"(",
"\"`save_token` has been deprecated, it was not called internally.\"",
"... | Create a BearerToken, by default without refresh token.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:param refresh_token: | [
"Create",
"a",
"BearerToken",
"by",
"default",
"without",
"refresh",
"token",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/tokens.py#L300-L340 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/utils.py | list_to_scope | def list_to_scope(scope):
"""Convert a list of scopes to a space separated string."""
if isinstance(scope, unicode_type) or scope is None:
return scope
elif isinstance(scope, (set, tuple, list)):
return " ".join([unicode_type(s) for s in scope])
else:
raise ValueError("Invalid sc... | python | def list_to_scope(scope):
"""Convert a list of scopes to a space separated string."""
if isinstance(scope, unicode_type) or scope is None:
return scope
elif isinstance(scope, (set, tuple, list)):
return " ".join([unicode_type(s) for s in scope])
else:
raise ValueError("Invalid sc... | [
"def",
"list_to_scope",
"(",
"scope",
")",
":",
"if",
"isinstance",
"(",
"scope",
",",
"unicode_type",
")",
"or",
"scope",
"is",
"None",
":",
"return",
"scope",
"elif",
"isinstance",
"(",
"scope",
",",
"(",
"set",
",",
"tuple",
",",
"list",
")",
")",
... | Convert a list of scopes to a space separated string. | [
"Convert",
"a",
"list",
"of",
"scopes",
"to",
"a",
"space",
"separated",
"string",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/utils.py#L25-L32 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/utils.py | scope_to_list | def scope_to_list(scope):
"""Convert a space separated string to a list of scopes."""
if isinstance(scope, (tuple, list, set)):
return [unicode_type(s) for s in scope]
elif scope is None:
return None
else:
return scope.strip().split(" ") | python | def scope_to_list(scope):
"""Convert a space separated string to a list of scopes."""
if isinstance(scope, (tuple, list, set)):
return [unicode_type(s) for s in scope]
elif scope is None:
return None
else:
return scope.strip().split(" ") | [
"def",
"scope_to_list",
"(",
"scope",
")",
":",
"if",
"isinstance",
"(",
"scope",
",",
"(",
"tuple",
",",
"list",
",",
"set",
")",
")",
":",
"return",
"[",
"unicode_type",
"(",
"s",
")",
"for",
"s",
"in",
"scope",
"]",
"elif",
"scope",
"is",
"None"... | Convert a space separated string to a list of scopes. | [
"Convert",
"a",
"space",
"separated",
"string",
"to",
"a",
"list",
"of",
"scopes",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/utils.py#L35-L42 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/utils.py | host_from_uri | def host_from_uri(uri):
"""Extract hostname and port from URI.
Will use default port for HTTP and HTTPS if none is present in the URI.
"""
default_ports = {
'HTTP': '80',
'HTTPS': '443',
}
sch, netloc, path, par, query, fra = urlparse(uri)
if ':' in netloc:
netloc, ... | python | def host_from_uri(uri):
"""Extract hostname and port from URI.
Will use default port for HTTP and HTTPS if none is present in the URI.
"""
default_ports = {
'HTTP': '80',
'HTTPS': '443',
}
sch, netloc, path, par, query, fra = urlparse(uri)
if ':' in netloc:
netloc, ... | [
"def",
"host_from_uri",
"(",
"uri",
")",
":",
"default_ports",
"=",
"{",
"'HTTP'",
":",
"'80'",
",",
"'HTTPS'",
":",
"'443'",
",",
"}",
"sch",
",",
"netloc",
",",
"path",
",",
"par",
",",
"query",
",",
"fra",
"=",
"urlparse",
"(",
"uri",
")",
"if",... | Extract hostname and port from URI.
Will use default port for HTTP and HTTPS if none is present in the URI. | [
"Extract",
"hostname",
"and",
"port",
"from",
"URI",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/utils.py#L52-L68 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/utils.py | escape | def escape(u):
"""Escape a string in an OAuth-compatible fashion.
TODO: verify whether this can in fact be used for OAuth 2
"""
if not isinstance(u, unicode_type):
raise ValueError('Only unicode objects are escapable.')
return quote(u.encode('utf-8'), safe=b'~') | python | def escape(u):
"""Escape a string in an OAuth-compatible fashion.
TODO: verify whether this can in fact be used for OAuth 2
"""
if not isinstance(u, unicode_type):
raise ValueError('Only unicode objects are escapable.')
return quote(u.encode('utf-8'), safe=b'~') | [
"def",
"escape",
"(",
"u",
")",
":",
"if",
"not",
"isinstance",
"(",
"u",
",",
"unicode_type",
")",
":",
"raise",
"ValueError",
"(",
"'Only unicode objects are escapable.'",
")",
"return",
"quote",
"(",
"u",
".",
"encode",
"(",
"'utf-8'",
")",
",",
"safe",... | Escape a string in an OAuth-compatible fashion.
TODO: verify whether this can in fact be used for OAuth 2 | [
"Escape",
"a",
"string",
"in",
"an",
"OAuth",
"-",
"compatible",
"fashion",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/utils.py#L71-L79 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/utils.py | generate_age | def generate_age(issue_time):
"""Generate a age parameter for MAC authentication draft 00."""
td = datetime.datetime.now() - issue_time
age = (td.microseconds + (td.seconds + td.days * 24 * 3600)
* 10 ** 6) / 10 ** 6
return unicode_type(age) | python | def generate_age(issue_time):
"""Generate a age parameter for MAC authentication draft 00."""
td = datetime.datetime.now() - issue_time
age = (td.microseconds + (td.seconds + td.days * 24 * 3600)
* 10 ** 6) / 10 ** 6
return unicode_type(age) | [
"def",
"generate_age",
"(",
"issue_time",
")",
":",
"td",
"=",
"datetime",
".",
"datetime",
".",
"now",
"(",
")",
"-",
"issue_time",
"age",
"=",
"(",
"td",
".",
"microseconds",
"+",
"(",
"td",
".",
"seconds",
"+",
"td",
".",
"days",
"*",
"24",
"*",... | Generate a age parameter for MAC authentication draft 00. | [
"Generate",
"a",
"age",
"parameter",
"for",
"MAC",
"authentication",
"draft",
"00",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/utils.py#L82-L87 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/grant_types/implicit.py | ImplicitGrant.create_token_response | def create_token_response(self, request, token_handler):
"""Return token or error embedded in the URI fragment.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:param token_handler: A token handler instance, for example of type
oaut... | python | def create_token_response(self, request, token_handler):
"""Return token or error embedded in the URI fragment.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:param token_handler: A token handler instance, for example of type
oaut... | [
"def",
"create_token_response",
"(",
"self",
",",
"request",
",",
"token_handler",
")",
":",
"try",
":",
"self",
".",
"validate_token_request",
"(",
"request",
")",
"except",
"errors",
".",
"FatalClientError",
"as",
"e",
":",
"log",
".",
"debug",
"(",
"'Fata... | Return token or error embedded in the URI fragment.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
:param token_handler: A token handler instance, for example of type
oauthlib.oauth2.BearerToken.
If the resource owner grants the a... | [
"Return",
"token",
"or",
"error",
"embedded",
"in",
"the",
"URI",
"fragment",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/grant_types/implicit.py#L168-L256 | train |
oauthlib/oauthlib | oauthlib/oauth2/rfc6749/grant_types/implicit.py | ImplicitGrant.validate_token_request | def validate_token_request(self, request):
"""Check the token request for normal and fatal errors.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
This method is very similar to validate_authorization_request in
the AuthorizationCodeGrant but differ in ... | python | def validate_token_request(self, request):
"""Check the token request for normal and fatal errors.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
This method is very similar to validate_authorization_request in
the AuthorizationCodeGrant but differ in ... | [
"def",
"validate_token_request",
"(",
"self",
",",
"request",
")",
":",
"for",
"param",
"in",
"(",
"'client_id'",
",",
"'response_type'",
",",
"'redirect_uri'",
",",
"'scope'",
",",
"'state'",
")",
":",
"try",
":",
"duplicate_params",
"=",
"request",
".",
"d... | Check the token request for normal and fatal errors.
:param request: OAuthlib request.
:type request: oauthlib.common.Request
This method is very similar to validate_authorization_request in
the AuthorizationCodeGrant but differ in a few subtle areas.
A normal error could be a... | [
"Check",
"the",
"token",
"request",
"for",
"normal",
"and",
"fatal",
"errors",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/oauth2/rfc6749/grant_types/implicit.py#L265-L364 | train |
oauthlib/oauthlib | oauthlib/openid/connect/core/grant_types/base.py | GrantTypeBase.validate_authorization_request | def validate_authorization_request(self, request):
"""Validates the OpenID Connect authorization request parameters.
:returns: (list of scopes, dict of request info)
"""
# If request.prompt is 'none' then no login/authorization form should
# be presented to the user. Instead, a ... | python | def validate_authorization_request(self, request):
"""Validates the OpenID Connect authorization request parameters.
:returns: (list of scopes, dict of request info)
"""
# If request.prompt is 'none' then no login/authorization form should
# be presented to the user. Instead, a ... | [
"def",
"validate_authorization_request",
"(",
"self",
",",
"request",
")",
":",
"if",
"request",
".",
"prompt",
"==",
"'none'",
":",
"raise",
"OIDCNoPrompt",
"(",
")",
"else",
":",
"return",
"self",
".",
"proxy_target",
".",
"validate_authorization_request",
"("... | Validates the OpenID Connect authorization request parameters.
:returns: (list of scopes, dict of request info) | [
"Validates",
"the",
"OpenID",
"Connect",
"authorization",
"request",
"parameters",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/openid/connect/core/grant_types/base.py#L27-L38 | train |
oauthlib/oauthlib | oauthlib/openid/connect/core/grant_types/base.py | GrantTypeBase.openid_authorization_validator | def openid_authorization_validator(self, request):
"""Perform OpenID Connect specific authorization request validation.
nonce
OPTIONAL. String value used to associate a Client session with
an ID Token, and to mitigate replay attacks. The value is
passed t... | python | def openid_authorization_validator(self, request):
"""Perform OpenID Connect specific authorization request validation.
nonce
OPTIONAL. String value used to associate a Client session with
an ID Token, and to mitigate replay attacks. The value is
passed t... | [
"def",
"openid_authorization_validator",
"(",
"self",
",",
"request",
")",
":",
"if",
"not",
"request",
".",
"scopes",
"or",
"'openid'",
"not",
"in",
"request",
".",
"scopes",
":",
"return",
"{",
"}",
"prompt",
"=",
"request",
".",
"prompt",
"if",
"request... | Perform OpenID Connect specific authorization request validation.
nonce
OPTIONAL. String value used to associate a Client session with
an ID Token, and to mitigate replay attacks. The value is
passed through unmodified from the Authentication Request to
... | [
"Perform",
"OpenID",
"Connect",
"specific",
"authorization",
"request",
"validation",
"."
] | 30321dd3c0ca784d3508a1970cf90d9f76835c79 | https://github.com/oauthlib/oauthlib/blob/30321dd3c0ca784d3508a1970cf90d9f76835c79/oauthlib/openid/connect/core/grant_types/base.py#L71-L248 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.