Skip to main content

scrapy_loaders

Scrapy Pipelines Loaders

  • Free software: MIT license

Install

pip install scrapy_loaders

At Your Scrapy project (Example: SpiderProject)

models.py

from sqlalchemy import (
    Column,
    String,
    Text,
)
from sqlalchemy.ext.declarative import declarative_base
DeclarativeBase = declarative_base()

class ItemModel(DeclarativeBase):
    __tablename__ = 'table_name'
    id = Column('id', String(10), primary_key=True)
    name = Column('name', String(60))
    description = Column('description', Text())
    url = Column('url', Text())
    md5sum = Column('md5sum', String(45))
    ...
...

settings.py

...
# Postgres settings, check other SQLAlchemy settings if you wish
DATABASE = {
    'drivername': 'postgresql+psycopg2',
    'host': 'localhost',
    'port': '5432',
    'username': 'username',
    'password': 'password',
    'database': 'attack_mitre',
}
DECLARATIVE_BASE = 'SpiderProject.models.DeclarativeBase'
...
ITEM_PIPELINES = {
   'SpiderProject.pipelines.SpiderProjectDbPipeline': 300,
}
...

pipelines.py

from SpiderProject.models import ItemModel
from scrapy_loaders.db_loaders import DBLoader
from scrapy_loaders.pipelines import DbPipeline

class ItemLoader(DBLoader):
    model = ItemModel
    hash_fields = ['name', 'description']
    update_fields = hash_fields + ['md5sum']
...

class SpiderProjectDbPipeline(DbPipeline):
    db_loaders = {
        'Item': ItemLoader,
    }
...

Features

Tests

TODO: tests

nosetests --with-coverage --cover-inclusive --cover-package=scrapy_loaders --cover-html

Metadata

Release files for scrapy_loaders 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scrapy_loaders 0.0.5
File Size Uploaded Provenance Actions
scrapy_loaders-0.0.5.tar.gz 4.5 kB Without provenance Details for scrapy_loaders-0.0.5.tar.gz

Release files / scrapy_loaders-0.0.5.tar.gz

Download URL scrapy_loaders-0.0.5.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
316f2332306fb958e5bddce7dd2be1ff5145962aa6a665516f96548244499739
BLAKE2b-256 checksum
How to use checksums
e94ea7494f34fed427d52b8c14ea03d69efc38a82265ada37b7373cca4a9869e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.6

Security for scrapy_loaders 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page