/usr/lib/python3/dist-packages/CloudFlare/utils.py is in python3-cloudflare 2.0.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | """ misc utilities for Cloudflare API"""
from __future__ import absolute_import
import sys
import requests
from . import __version__
def user_agent():
""" misc utilities for Cloudflare API"""
# the default User-Agent is something like 'python-requests/2.11.1'
# this additional data helps support @ Cloudflare help customers
return ('python-cloudflare/' + __version__ + '/' +
'python-requests/' + str(requests.__version__) + '/' +
'python/' + '.'.join(map(str, sys.version_info[:3]))
)
def sanitize_secrets(secrets):
""" misc utilities for Cloudflare API"""
redacted_phrase = 'REDACTED'
if secrets is None:
return None
secrets_copy = secrets.copy()
if 'password' in secrets_copy:
secrets_copy['password'] = redacted_phrase
elif 'X-Auth-Key' in secrets_copy:
secrets_copy['X-Auth-Key'] = redacted_phrase
elif 'X-Auth-User-Service-Key' in secrets_copy:
secrets_copy['X-Auth-User-Service-Key'] = redacted_phrase
return secrets_copy
|