Skip to main content

Collect data from various sources

Project description

Rollet

Rollet collects, standardizes and completes from various sources.

PyPI PyPI - Status PyPI - Python Version

Installation

Pypi

The safest way to install rollet is to go through pip

python -m pip install rollet

How to use?

Command script

rollet {extract-txt,extract-csv,extract-json} path
       [-h] [-o [OUTFILE]] [-l [LINK]] [-f [FIELDS]] [--start [START]]
       [--size [SIZE]] [-t [TIMESLEEP]] [--timeout [TIMEOUT]]
       [--blacklist [BLACKLIST]]
positional arguments:
  {extract-txt,extract-csv,extract-json} Choose file type option extraction
  path                                   file path

optional arguments:
  -h, --help                    show this help message and exit
  -o [OUTFILE], --outfile       output file path
  -l [LINK], --link             link field if csv or json
  -f [FIELDS], --fields         fields to keep separated by comma
  --start [START]               number of rows to skip
  --size [SIZE]                 max number of rows to keep
  -t [TIMESLEEP], --timesleep   sleep time in seconds between two pulling
  --timeout [TIMEOUT]           Max GET request timeout in second
  --blacklist [BLACKLIST]       0 (do not use), 1 (use), path (one column domain blacklist file)

Python

Basic usage

from rollet import get_content
from rollet.extractor import BaseExtractor

url = 'https://example.url.com/content-id'

content_dict = get_content(url)

content_object = BaseExtractor(url)
content_object.title            # Title
content_object.abstract         # Abstract
content_object.lang             # Language
content_object.content_type     # Type (pdf, json, html, ...)
content_object.to_dict()        # Same as get_content

Custom extractors

class CustomExtractor(BaseExtractor):
    
    @property
    def title(self):
        return self._page.find('title')

PDF extractors

PDF extraction require Grobid service.
Assuming Grobid API runs on http://localhost:8070

from rollet import grobid_service, get_content
from rollet.extractor import PDFExtractor

grobid_service('localhost', '8070')

url = 'https://example.url.com/pdf-content-id'

content_dict = get_content(url)

pdf_content_object = PDFExtractor(url)

Reading PDF with BaseExtractor will instanciate PDFExtractor object.

And More!

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

rollet-0.2.0a0.tar.gz (67.8 kB view details)

Uploaded Source

Built Distribution

rollet-0.2.0a0-py3-none-any.whl (67.1 kB view details)

Uploaded Python 3

File details

Details for the file rollet-0.2.0a0.tar.gz.

File metadata

  • Download URL: rollet-0.2.0a0.tar.gz
  • Upload date:
  • Size: 67.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for rollet-0.2.0a0.tar.gz
Algorithm Hash digest
SHA256 18d304232f7c2ff89bc8480de0d7c73b5a524eefb1669d5e9c8380f353615de3
MD5 8b8a3e9cb164c3f4e7f0baaeb836ae13
BLAKE2b-256 3a89a40e1cb7bb0159571fd8150b3c3c56e9cfce0685ff84fdf0ad13b7c62b97

See more details on using hashes here.

File details

Details for the file rollet-0.2.0a0-py3-none-any.whl.

File metadata

  • Download URL: rollet-0.2.0a0-py3-none-any.whl
  • Upload date:
  • Size: 67.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for rollet-0.2.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6ea76d5c4dba3e7d0705ab593946e247589520b21f7722e36b263e8476c2407
MD5 034b015b0fdf88c87558cb796bbf0cbf
BLAKE2b-256 d02ac51b13ad99da87ecab3193d0e66dbf80803d41e44b10b50e8cf7589b62ed

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page