DEV Community

Discussion on: Is there an api/library in python for ray.so or carbon.now.sh?

Collapse
 
wolfpack9108 profile image
Wolf • Edited
from requests_html import HTMLSession, HTML
import base64

session = HTMLSession()
code = b'x = "hello world"\nprint(x)'
code = base64.b64encode(code)

params = {
    'colors': 'midnight',
    'background': 'true',
    'darkMode': 'true',
    'padding': '16',
    'title': 'hello',
    'code': code,
    'language': 'python',
}
url = 'https://ray.so/'
r = session.get(url, params=params)
print(r.url)
html: HTML = r.html
html.render()
Enter fullscreen mode Exit fullscreen mode

made this but only makes a link not the image I need to get the image from the link generated in this code.