graviteeio_cli/commands/apim/pages/update.py
def update_content(obj, page_id, api_id, file):
    """Update content for page documentation."""
    page_content = None

    if file.startswith("http://") or file.startswith("https://"):
        try:
            page_content = requests.get(file).text
        except Exception:
            raise GraviteeioError(f'Invalid value for "--file" / "-f": Call error for URL "{file}".')

    else:
        if os.path.exists(file):
            with open(file, "r") as reader:
                page_content = reader.read()
        else:
            raise GraviteeioError(f'Invalid value for "--file" / "-f": Path "{file}" does not exist.')

    page_client: PageClient = obj['page_client']
    page_client.update_content(page_id, api_id, page_content)

    if api_id:
        click.echo(f"API [{api_id}] Documentation is uptodate.")
    else:
        click.echo("Documentation is uptodate.")
Update content for page documentation.
Update content for page documentation.
Update content for page documentation .
def update_content(obj, page_id, api_id, file):
    page_content = None
    if file.startswith("http://") or file.startswith("https://"):
        try:
            page_content = requests.get(file).text
        except Exception:
            raise GraviteeioError(f'Invalid value for "--file" / "-f": Call error for URL "{file}".')
    else:
        if os.path.exists(file):
            with open(file, "r") as reader:
                page_content = reader.read()
        else:
            raise GraviteeioError(f'Invalid value for "--file" / "-f": Path "{file}" does not exist.')
    page_client: PageClient = obj['page_client']
    page_client.update_content(page_id, api_id, page_content)
    if api_id:
        click.echo(f"API [{api_id}] Documentation is uptodate.")
    else:
        click.echo("Documentation is uptodate.")
def update_content ( obj , page_id , api_id , file ) : page_content = None if file . startswith ( "http://" ) or file . startswith ( "https://" ) : try : page_content = requests . get ( file ) . text except Exception : raise GraviteeioError ( f'Invalid value for "--file" / "-f": Call error for URL "{file}".' ) else : if os . path . exists ( file ) : with open ( file , "r" ) as reader : page_content = reader . read ( ) else : raise GraviteeioError ( f'Invalid value for "--file" / "-f": Path "{file}" does not exist.' ) page_client : PageClient = obj [ 'page_client' ] page_client . update_content ( page_id , api_id , page_content ) if api_id : click . echo ( f"API [{api_id}] Documentation is uptodate." ) else : click . echo ( "Documentation is uptodate." )
Update content for page documentation.
Update content for page documentation .
"""Update content for page documentation."""
obj
page_id
api_id
file