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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file carbonsh-0.2.0.tar.gz.

File metadata

  • Download URL: carbonsh-0.2.0.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for carbonsh-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e5a1c8a9f86b255bd28ccbcd6909e1622ec6b973878ca56f34e083934fd16c33
MD5 3da7e9c21351b5ea9a577efa64876119
BLAKE2b-256 905bec98f6c102b13ab9d70b88c2dc2c4413cf182f9aa5769fd2722709ad4d81

See more details on using hashes here.

File details

Details for the file carbonsh-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: carbonsh-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for carbonsh-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 262f8074b5e015f400755f5b60d62659b7ec250f2948cb04c3db6dd30e0af801
MD5 cfbb7c340e9c59c9cbcf2daed8485d25
BLAKE2b-256 30460e92c653b9cba3cba6d8e77e4385ab8af0ce2c484e18f8e96dd786b58b48

See more details on using hashes here.

Supported by

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