Skip to main content

Splitter de fichiers pdfs sur S3

Project description

S3PdfSplitter Build Status Coverage Status PyPI version PyPI - Python Version

Python aws-s3 pdf spliter

Usage

basic usage :

from PdfSplitter import Splitter

spliter = Splitter("config.json")
spliter.split(data)

exemple config.json :

{
    "aws" : {
        "access_key_id" : "aws-acces-key",
        "secret_access_key" : "aws secret",
    },
    "s3" : {
        "bucket" : "bucket"
    }
}

Note that the config is managed with ConfigEnv so you can provide an .ini file or overide the config with environement variable ( AWS_S3_BUCKET, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY )

example data :

{
    "input" : [
        "firstFile.pdf",
        "secondFile.pdf"
    ],
    "output": [
        {
            "s3Key": "output1.pdf",
            "pages": [
                { "index": 0, "pages": [0,1] },
                { "index": 1, "pages": [0,1] }
            ]
        },{
            "s3Key": "output2.pdf",
            "pages": [
                { "index": 0, "pages": [0] },
                { "index": 1, "pages": [0] },
                { "index": 0, "pages": [1] },
                { "index": 1, "pages": [1] }
            ]
        }
    ]
}

this will produce 2 pdfs in your s3:

  • the first, output1.pdf, with page 0 and 1 from firstFile and page 0 and 1 from secondFile
  • the second, output2.pdf, with page 0 from firstFile, page 0 from secondFile, page 1 from firstFile and page 1 from secondFile

Developpement guide

installation

with virtualenv :

# create virtualenv
virtualenv -p python3 .venv

# activate venv
source .venv/bin/activate

# install dependancies
pip install -r requirements.txt
pip install -r requirements-dev.txt

testing

with unittest :

# if your test config is setup :
python -m unittest

# if you want to overide your test config :
S3_BUCKET=<your bucket> AWS_ACCESS_KEY_ID=<your key id> AWS_SECRET_ACCESS_KEY=<your key secret> python -m unittest

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

S3PdfSplitter-1.0.8.tar.gz (2.9 kB view details)

Uploaded Source

File details

Details for the file S3PdfSplitter-1.0.8.tar.gz.

File metadata

  • Download URL: S3PdfSplitter-1.0.8.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.6

File hashes

Hashes for S3PdfSplitter-1.0.8.tar.gz
Algorithm Hash digest
SHA256 3f32c214eb8905c1f1353b50ab83a584ae49f48e0bd2a04ea7120b169a62e70b
MD5 80379aeb797b22cf8d02568042e581c5
BLAKE2b-256 72c7c8b5210366b9018e32a5e5d5c2379dfd912f2315d5294ded2020baa40521

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