Metadata-Version: 2.1
Name: PyppeSnap
Version: 1.0.6
Summary: Get a snapshot from a website by using Pyppeteer.
Home-page: https://github.com/natlee/PyppeSnap
Author: Nat Lee
Author-email: natlee.work@gmail.com
Project-URL: Documentation, https://github.com/natlee/PyppeSnap
Project-URL: Bug Reports, https://github.com/natlee/PyppeSnap/issues
Project-URL: Source Code, https://github.com/natlee/PyppeSnap
Keywords: pyppeteer,snapshot
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Build Tools
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: websockets (==8.1)
Requires-Dist: pyee (==6.0.0)
Requires-Dist: pyppeteer (>=0.0.25)
Provides-Extra: dev
Requires-Dist: check-manifest ; extra == 'dev'

# PyppeSnap

[![Test](https://github.com/NatLee/PyppeSnap/actions/workflows/test.yml/badge.svg)](https://github.com/NatLee/PyppeSnap/actions/workflows/test.yml)[![Release](https://github.com/NatLee/PyppeSnap/actions/workflows/release.yml/badge.svg)](https://github.com/NatLee/PyppeSnap/actions/workflows/release.yml)

![image](https://i.imgur.com/hgXl2l6.png)

![pdf](https://i.imgur.com/JLe9bYi.png)

This is a tool for getting snapshot with base64 encoding from a website.

As DEMO image you see, just need one URL input to function.

This package support `image` and `pdf` with encoded base64.

## Installation

```bash
pip install pyppesnap
```

Check it on [Pypi](https://pypi.org/project/PyppeSnap/).

## Usage

Common use with code below.

- Get image

```python
from pyppesnap import get_image_snapshot_by_url
url = 'https://www.google.com'
print(get_image_snapshot_by_url(url))
```

- Get PDF

```python
from pyppesnap import get_pdf_snapshot_by_url
url = 'https://www.google.com'
print(get_pdf_snapshot_by_url(url))
```

> You need to give a valid URL like start with `http`, or Pyppeteer cannot navigate it.

- CLI

You can try CLI mode for testing.

```bash
pyppesnap --url https://www.google.com --type img
```

And the output here.

```
------------- Parameters ---------------
URL: https://www.google.com
Type: img
--------------- Base64 ------------------
iVBORw0KGgoAAAANSUhEUgAABkAAAAOECAYAAAD
...
CCAAAAAAAkM7/B83ojRnTa7oSAAAAAElFTkSuQmCC
-------------------------------------
```

This tool can be used with web framworks to get a snapshot, check details in [./example](https://github.com/NatLee/PyppeSnap/tree/main/example).
