Azure-Samples / Azure-Samples/ms-identity-python-daemon
Close key file after reading in Python example
- Ngôn ngữ chính
- PowerShell
- Star
- 62
- Fork
- 27
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Don't open a file in Python without closing it. This code is bad mojo:
```
app = msal.ConfidentialClientApplication(
config["client_id"], authority=config["authority"],
client_credential={"thumbprint": config["thumbprint"], "private_key": open(config['private_key_file']).read()},
)
```
Prefer:
```
with open(config['private_key_file']) as f:
key = f.read()
app = msal.ConfidentialClientApplication(
config["client_id"], authority=config["authority"],
client_credential={"thumbprint": config["thumbprint"], "private_key": key },
)
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.