Skip to main content

carbon.now.sh python module

Project description

carbonsh

Tests PyPI - Wheel PyPI PyPI - Python Version

Python module for carbon.now.sh

Install

pip install carbonsh

** pyppeteer requires to download Chromium the first time you use it, go to its documentation for more information

Usage

import carbonsh
import asyncio
code = ("const test = 'test';"
        "let x = 0.1 + 0.2;"
        "console.log(test, x)")

config = carbonsh.Config(language=carbonsh.languages.JAVASCRIPT)

# returns >>> 'https://carbon.now.sh/?bg=rgba(...'
carbon_url = carbonsh.code_to_url(code, config)

loop = asyncio.get_event_loop()

# saves the image as carbon.png where expected
loop.run_until_complete(carbonsh.url_to_file(carbon_url, '/path/to/save/screenshot/'))

loop.run_until_complete(carbonsh.code_to_file(code,config,'/path/to/save/screenshot/'))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

carbonsh-0.2.0.tar.gz (19.8 kB view hashes)

Uploaded Source

Built Distribution

carbonsh-0.2.0-py3-none-any.whl (21.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page