def get_html(url): fpath = Path(__file__).change( new_basename="{}.html".format(fingerprint.of_text(url))) if fpath.exists(): html = fpath.read_text(encoding="utf-8") else: # i am lazy, I don't want to login, session_id is the key headers = { "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36", "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3", "accept-encoding": "gzip, deflate, br", "accept-language": "en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7,zh-TW;q=0.6,ja;q=0.5", "sec-fetch-mode": "navigate", "sec-fetch-site": "none", # "cookie": "csrftoken=9999JP9mz49NwmqfykyrMupzywy3XZNGgq7Rly23j0u2QuEHdDcOreAnWIjGIhtj; _ga=GA1.2.1853091755.1574187377; _gid=GA1.2.909819738.1574187377; intercom-id-aaaa73km=aaaa1111-18b1-48af-849d-94ad2564a3bc; ga_cid=1853091755.1574187377; sessionid=t2xtsqy6pkf3mkndvd8oljs102ffp6bc; intercom-session-aaaa73km=bXI5eG01b1pJdHlmSk9mYU1jSzZPNGVpWng0KzR6Snk3MngwUjJtNVRzWHhzSHlEenBqTXYyNDRwMWZaekxydC0tUmtTUVo1bjlaNmo3SDVIVFVhcGpCZz09--d927dd0ff0f890889144d645e77525943c851cf5" } res = requests.get(url, headers=headers) html = res.text fpath.write_text(html, encoding="utf-8") return html
# -*- coding: utf-8 -*- import os import json from pathlib_mate import Path from cookiecutter_pygitrepo.config import Config from cookiecutter_pygitrepo.helpers import strip_comments repo_dir = os.getcwd() path_cookiecutter_pygitrepo_json = Path( "{{ cookiecutter.path_cookiecutter_pygitrepo_json }}") config_data = json.loads( strip_comments(path_cookiecutter_pygitrepo_json.read_text())) del config_data["_please_ignore_this"] config = Config(**config_data) help_msg = """ Things to do next after generated the project skeleton: - Update ``{{ cookiecutter.repo_name }}/AUTHORS.rst`` file for Author information - Update ``{{ cookiecutter.repo_name }}/LICENSE.txt`` and ``__license__`` variable in ``{{ cookiecutter.repo_name }}/{{ cookiecutter.package_name }}/__init__.py`` (It uses MIT by default). If you don't know how to choose an open source license, read this https://choosealicense.com/ . """.strip() print(help_msg) msg = """ - If you choose to use CircleCI for CI/CD, you can update the ``{{ cookiecutter.repo_name }}/.circleci/config.yml`` file to customize CI/CD workflow. The auto-generated one should works out-of the box.