MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / _parse_credentials

Function _parse_credentials

pymongo/client_options.py:47–57  ·  view source on GitHub ↗

Parse authentication credentials.

(
    username: str, password: str, database: Optional[str], options: Mapping[str, Any]
)

Source from the content-addressed store, hash-verified

45
46
47def _parse_credentials(
48 username: str, password: str, database: Optional[str], options: Mapping[str, Any]
49) -> Optional[MongoCredential]:
50 """Parse authentication credentials."""
51 mechanism = options.get("authmechanism", "DEFAULT" if username else None)
52 source = options.get("authsource")
53 if username or mechanism:
54 from pymongo.auth_shared import _build_credentials_tuple
55
56 return _build_credentials_tuple(mechanism, source, username, password, options, database)
57 return None
58
59
60def _parse_read_preference(options: Mapping[str, Any]) -> _ServerMode:

Callers 1

_parse_pool_optionsFunction · 0.85

Calls 2

_build_credentials_tupleFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected