semvec/pypi-packages huggingface dataset:
apiflash-client 0.2
ApiFlash.com Client
License: MIT
Requires Python: >=3.7


ApiFlash.com Client
===================

The ApiFlash Client is a Python module for interacting with apiflash_. It requires Python 3.7+.

Installation
------------

In a Python virtual environment::

    $ pip install apiflash-client


Example usage
-------------

Setup a client::

    from apiflash import ApiFlashClient

    access_key = '<your-access-key>'

    client = ApiFlashClient(access_key)


Check the quota of your account::

    print(client.quota())


Capture a screenshot of a URL::

    resp = client.capture(
        'https://google.com',
    )
    print(resp['url'])


Capture a screenshot of a URL with some parameters::

    from apiflash import ImageFormat

    resp = client.capture(
        'https://google.com',
        width=400,
        height=600,
        format=ImageFormat.WEBP,
    )
    print(resp['url'])


Capture a screenshot of a URL, but return the image data, rather than a screentshot URL::

    from apiflash import ResponseType

    data = client.capture(
        'https://google.com',
        response_type=ResponseType.IMAGE,
    )

    with open('my-file.png', 'wb') as filehandle:
        filehandle.write(data)


All available capture options can be found here_.


Command line usage
------------------

Once installed in your virtual environment, you can use the command line interface. You will need to pass ``--access-key <your-access-key>`` or set ``APIFLASH_ACCESS_KEY`` in your environment for the command line to authenticate with apiflash.com::

    $ apiflash quota
    {'limit': 100, 'remaining': 91, 'reset': 1703265314}

    $ apiflash capture https://google.com
    https://api.apiflash.com/v1/urltoimage/cache/8jzv236knw.png?access_key=<your-access-key>

    $ apiflash capture https://google.com -o width 400 -o height 600
    https://api.apiflash.com/v1/urltoimage/cache/5asdf65asd.png?access_key=<your-access-key>

If you are using ngrok_ to expose a local development environment, you will need to pass ``-o headers ngrok-skip-browser-warning=yes`` to the command line utility. The same can be passed as a keyword argument to the ``capture()`` method, if retrieving the screenshot programmatically.


.. _apiflash: https://apiflash.com
.. _here: https://apiflash.com/documentation#parameters
.. _ngrok: https://ngrok.com
ddd-subplots 1.0.27
Python package making it easier to handle mixed 3d and 2d subplots.
License: MIT

DDD Subplots
=========================================================================================
|pip| |downloads|

Python package making it easier to handle mixed 3d and 2d subplots.

How do I install this package?
----------------------------------------------
As usual, just download it using pip:

.. code:: shell

    pip install ddd_subplots

Usage Example
-----------------------------------------------

3D subplots
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get a set of 3d subplots just import `subplots`:

.. code:: python

    from ddd_subplots import subplots

    fig, axes = subplots(1, 3, figsize=(15, 5))


Rotating 3D scatter plots
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The library also offers a method to render 3D scatter plots. Here's a complete example:

.. code:: python

    from ddd_subplots import subplots, rotate
    import numpy as np
    from sklearn import datasets
    from sklearn.decomposition import PCA


    def write_frame(X_reduced, y):
        colors = np.array(["red", "green", "blue"])[y]
        fig, axes = subplots(1, 3, figsize=(15, 5))
        for axis in axes.flatten():
            axis.scatter(*X_reduced.T, depthshade=False,
                        c=colors, marker='o', s=20)
        fig.tight_layout()
        return fig, axes

    X, y = datasets.load_iris(return_X_y=True)
    X_reduced = PCA(n_components=3).fit_transform(X)

    rotate(
        write_frame,
        X_reduced,
        "test_animation.gif",
        y,
        duration=10,
        verbose=True
    )


Output:

.. image:: https://github.com/LucaCappelletti94/ddd_subplots/blob/master/test_animation.gif?raw=true


.. |pip| image:: https://badge.fury.io/py/ddd-subplots.svg
    :target: https://badge.fury.io/py/ddd-subplots
    :alt: Pypi project

.. |downloads| image:: https://pepy.tech/badge/ddd-subplots
    :target: https://pepy.tech/badge/ddd-subplots
    :alt: Pypi total project downloads