ACIL FM
Dark
Refresh
Current DIR:
/lib/python3.9/site-packages/certbot/_internal
/
lib
python3.9
site-packages
certbot
_internal
Upload
Zip Selected
Delete Selected
Pilih semua
Nama
Ukuran
Permission
Aksi
cli
-
chmod
Open
Rename
Delete
display
-
chmod
Open
Rename
Delete
plugins
-
chmod
Open
Rename
Delete
tests
-
chmod
Open
Rename
Delete
__pycache__
-
chmod
Open
Rename
Delete
account.py
14.3 MB
chmod
View
DL
Edit
Rename
Delete
auth_handler.py
20.58 MB
chmod
View
DL
Edit
Rename
Delete
cert_manager.py
17.59 MB
chmod
View
DL
Edit
Rename
Delete
client.py
36.05 MB
chmod
View
DL
Edit
Rename
Delete
constants.py
7.22 MB
chmod
View
DL
Edit
Rename
Delete
eff.py
4.38 MB
chmod
View
DL
Edit
Rename
Delete
error_handler.py
7.28 MB
chmod
View
DL
Edit
Rename
Delete
hooks.py
10.39 MB
chmod
View
DL
Edit
Rename
Delete
lock.py
9.95 MB
chmod
View
DL
Edit
Rename
Delete
log.py
15.02 MB
chmod
View
DL
Edit
Rename
Delete
main.py
72.57 MB
chmod
View
DL
Edit
Rename
Delete
renewal.py
25.38 MB
chmod
View
DL
Edit
Rename
Delete
snap_config.py
5.93 MB
chmod
View
DL
Edit
Rename
Delete
storage.py
51.46 MB
chmod
View
DL
Edit
Rename
Delete
updater.py
4.64 MB
chmod
View
DL
Edit
Rename
Delete
__init__.py
184 B
chmod
View
DL
Edit
Rename
Delete
Edit file: /lib/python3.9/site-packages/certbot/_internal/eff.py
"""Subscribes users to the EFF newsletter.""" import logging from typing import Optional import requests from certbot import configuration from certbot._internal import constants from certbot._internal.account import Account from certbot._internal.account import AccountFileStorage from certbot.display import util as display_util logger = logging.getLogger(__name__) def prepare_subscription(config: configuration.NamespaceConfig, acc: Account) -> None: """High level function to store potential EFF newsletter subscriptions. The user may be asked if they want to sign up for the newsletter if they have not given their explicit approval or refusal using --eff-mail or --no-eff-mail flag. Decision about EFF subscription will be stored in the account metadata. :param configuration.NamespaceConfig config: Client configuration. :param Account acc: Current client account. """ if config.eff_email is False: return if config.eff_email is True: if config.email is None: _report_failure("you didn't provide an e-mail address") else: acc.meta = acc.meta.update(register_to_eff=config.email) elif config.email and _want_subscription(): acc.meta = acc.meta.update(register_to_eff=config.email) if acc.meta.register_to_eff: storage = AccountFileStorage(config) storage.update_meta(acc) def handle_subscription(config: configuration.NamespaceConfig, acc: Optional[Account]) -> None: """High level function to take care of EFF newsletter subscriptions. Once subscription is handled, it will not be handled again. :param configuration.NamespaceConfig config: Client configuration. :param Account acc: Current client account. """ if config.dry_run or not acc: return if acc.meta.register_to_eff: subscribe(acc.meta.register_to_eff) acc.meta = acc.meta.update(register_to_eff=None) storage = AccountFileStorage(config) storage.update_meta(acc) def _want_subscription() -> bool: """Does the user want to be subscribed to the EFF newsletter? :returns: True if we should subscribe the user, otherwise, False :rtype: bool """ prompt = ( 'Would you be willing, once your first certificate is successfully issued, ' 'to share your email address with the Electronic Frontier Foundation, a ' "founding partner of the Let's Encrypt project and the non-profit organization " "that develops Certbot? We'd like to send you email about our work encrypting " "the web, EFF news, campaigns, and ways to support digital freedom. ") return display_util.yesno(prompt, default=False) def subscribe(email: str) -> None: """Subscribe the user to the EFF mailing list. :param str email: the e-mail address to subscribe """ url = constants.EFF_SUBSCRIBE_URI data = {'data_type': 'json', 'email': email, 'form_id': 'eff_supporters_library_subscribe_form'} logger.info('Subscribe to the EFF mailing list (email: %s).', email) logger.debug('Sending POST request to %s:\n%s', url, data) _check_response(requests.post(url, data=data, timeout=60)) def _check_response(response: requests.Response) -> None: """Check for errors in the server's response. If an error occurred, it will be reported to the user. :param requests.Response response: the server's response to the subscription request """ logger.debug('Received response:\n%s', response.content) try: response.raise_for_status() if not response.json()['status']: _report_failure('your e-mail address appears to be invalid') except requests.exceptions.HTTPError: _report_failure() except (ValueError, KeyError): _report_failure('there was a problem with the server response') def _report_failure(reason: Optional[str] = None) -> None: """Notify the user of failing to sign them up for the newsletter. :param reason: a phrase describing what the problem was beginning with a lowercase letter and no closing punctuation :type reason: `str` or `None` """ msg = ['We were unable to subscribe you the EFF mailing list'] if reason is not None: msg.append(' because ') msg.append(reason) msg.append('. You can try again later by visiting https://act.eff.org.') display_util.notify(''.join(msg))
Simpan
Batal
Isi Zip:
Unzip
Create
Buat Folder
Buat File
Terminal / Execute
Run
Chmod Bulk
All File
All Folder
All File dan Folder
Apply