docs(credentials_searches): replace single quotes for backticks

This commit is contained in:
eslopfer 2023-01-30 15:58:27 +00:00
parent 3e7cd64c92
commit dad3fd234a
1 changed files with 10 additions and 10 deletions

View File

@ -4,17 +4,17 @@
Create a file `credentials_searches.py` that contains a function `credentials_search` which takes no parameters and searches for the keys `password` and `secret` in a file called `logs.json`. Create a file `credentials_searches.py` that contains a function `credentials_search` which takes no parameters and searches for the keys `password` and `secret` in a file called `logs.json`.
- If both keys are found, the function should create a new json file named 'credentials.json' and save the values of those keys in it. - If both keys are found, the function should create a new json file named `credentials.json` and save the values of those keys in it.
- If only one of the keys is found, the function should create a new json file named 'credentials.json' and save the value of that key in it. - If only one of the keys is found, the function should create a new json file named `credentials.json` and save the value of that key in it.
- If neither key is found, the function should not create the 'credentials.json' file. - If neither key is found, the function should not create the `credentials.json` file.
- If the 'logs.json' file is empty or is not a json file, the function should not create the 'credentials.json' file. - If the `logs.json` file is empty or is not a json file, the function should not create the `credentials.json` file.
- If the 'logs.json' file does not exist, the function should not create the 'credentials.json' file. - If the `logs.json` file does not exist, the function should not create the `credentials.json` file.
- If the keys are found in a nested object, the function should create the 'credentials.json' file and save the values of the keys in it. - If the keys are found in a nested object, the function should create the `credentials.json` file and save the values of the keys in it.
### Usage ### Usage
@ -47,13 +47,13 @@ Your function should generate this file `credentials.json`:
### Hints ### Hints
- The json module can be used to read and write JSON files. - The `json` module can be used to read and write JSON files.
- The os module can be used to check if a file exists and remove a file. - The `os` module can be used to check if a file exists and remove a file.
- Remember that the function should be able to search for the keys password and secret in nested json objects. - Remember that the function should be able to search for the keys `password` and `secret` in nested json objects.
- Using the isinstance function could be useful to check if a value is for example a dict. - Using the `isinstance` function could be useful to check if a value is for example a dict.
### References ### References