Git Product home page Git Product logo

py-carbon's Introduction

py-carbon Badge Badge 2

Fully asynchronous Python library for carbon.now.sh

Installation

$ pip install py-carbon

A quick example

In this example we'll create a carbon image and save it to disk.

import carbon
import asyncio

code = """
defmodule Something do
    def anything() do
        IO.puts "Hello, World"
    end
end
"""  # Any kind of code-block in any language


async def main():
    cb = carbon.Carbon()  # Create a Carbon instance
    opts = carbon.CarbonOptions(code=code)  # Set the options for the image
    image = await cb.generate(opts)  # Generate the image
    await image.save('hello')  # Save the image in png format


asyncio.run(main())

And it'll output something like this:

Carbon Image

Contributing

This package is opensource so anyone with adequate python experience can contribute to this project!

Reporting Issues

If you find any error/bug/mistake with the package or in the code feel free to create an issue and report it here.

Fixing/Editing Content

If you want to contribute to this package, fork the repository, make your changes and then simply create a Pull Request!

Contact

If you want to contact me:
Mail - [email protected]
Discord - wulf

py-carbon's People

Contributors

bwv2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

unknownkz

py-carbon's Issues

Unclosed client session

I used your example and it successfully saved the screenshot, but it raised the following error:

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x10af094e0>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x10af01600>, 144205.561179324)]']
connector: <aiohttp.connector.TCPConnector object at 0x10af094b0>

The Unclosed client session error is usually caused by not properly closing the client session when using asyncio.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.