Пример #1
0
def edit_secrets(
    path,
    env,
    *,
    quiet=False,
    default=DEFAULT_SECRETS,
    secrets_header=DEFAULT_ENCRIPTED_HEADER,
    master_key_env=MASTER_KEY_ENV,
    intro_msg=INTRO_MSG,
):
    """Edit your encrypted secrets in the default text editor."""
    path = Path(path)
    filepath = path / (ENCRYPTED_FILE % (env,))
    key = read_key(path, env, master_key_env=master_key_env)
    keyfile = KEY_FILE % (env,)

    if filepath.exists():
        if not key:
            raise IOError(
                f"Key not found. Either put a `{keyfile}` or a `{MASTER_KEY_FILE}`"
                " beside your encrypted secrets, or set and environment"
                f" variable `{master_key_env}` with the key value"
                " (the environment variable takes precendence over the file)."
            )
        content = read_secrets(filepath, key) or default
    else:
        if quiet or not confirm(f"{filepath} does not exists. Create?", default=False):
            return
        if not key:
            key = new_key_file(path / keyfile)
        content = default

    if not quiet and intro_msg:
        print(intro_msg)
    new_content = texteditor.open(content, extension=filepath.suffix)
    save_secrets(filepath, key, new_content, header=secrets_header)
Пример #2
0
def OpenReadme():
    text = texteditor.open(filename='README.md')
Пример #3
0
def notepad(filename, content):

    result = texteditor.open(filename=filename, text=content)

    print(result)
Пример #4
0
def edit_conf():
    """
    opens the config file in the default editor
    """
    texteditor.open(filename=utils.conf)
Пример #5
0
    def showHistory(self):
        # write self.history to file
        self.history2Txt()

        # uses texteditor function to open file with default editor
        texteditor.open(filename='calc_history.txt')
Пример #6
0
def showLog():
    texteditor.open(filename='calcHistory.txt')
Пример #7
0
def show_read_me():
    texteditor.open(filename='manual.txt')
Пример #8
0
 

import requests
from bs4 import BeautifulSoup
import urllib.parse as urlparse
import re
import base64
import texteditor

def request(url):
    try:
        return requests.get(url)
    except requests.exceptions.ConnectionError:
        pass


target_url = "https://www.officeholidays.com/countries/india/2020"
response = request(target_url)
result = texteditor.open(filename="write.txt",text=str(response.content))

parsed_html =  BeautifulSoup(response.content, 'html.parser').encode("utf-8")
print(parsed_html)
# table = re.match(r'<table.*?</table>', parsed_html,flags=0)
# try: 
#     for table in tables_list:
#         print(table)
# except:
#     pass