onedrive.util module

Some shared utilities.

onedrive.util.normalized_ospath(path)[source]

Normalize a POSIX path to an OS-dependent path.

E.g., a POSIX path "a/b" will be normalized to the ntpath "a\b" os Windows NT systems.

Parameters:path : str
Returns:normalized_path : str
onedrive.util.normalized_posixpath(path)[source]

Normalize an OS-dependent path to a POSIX path.

E.g., a ntpath "a\b" will be normalized to "a/b".

Parameters:path : str
Returns:normalized_path : str
onedrive.util.pop_query_from_url(url, query_variable)[source]

Strip a certain query_variable from an URL.

E.g., often times we want to strip the access token when printing the URL for informational purposes.

Parameters:

url : str

Original URL.

query_variable : str

Query variable to be striped, e.g., access_token.

Returns:

stripped_url : str

Examples

>>> pop_query_from_url("http://example.com?access_token=142857", "access_token")
'http://example.com'