Skip to main content

Title

Description

For those who are tired to use scrapy's brackets and quotes. In one line of code this library will increase the readability of your code, make it more stable to human error. And will introduce IDEs code completion features to your scrapy items. You will be able to use scrapy items as normal python objects using dot syntax.

The regular bulky way to do it:

regular_scrapy_item['some_field'] = 42
print(regular_scrapy_item.get('some_field'))

The simple dot-items way:

scrapy_dot_item.some_field = 42
print(scrapy_dot_item.some_field)

Installation

pip install scrapy-dot-items

Usage

Apply to a single scrapy item class

You can add functionality with the dot_item decorator to a single class

from scrapy_dot_items import dot_item

@dot_item
class RealEstateItem(scrapy.Item):
    price = scrapy.Field()

dot_scrapy_item = RealEstateItem()

dot_scrapy_item.price = 1000
print(dot_scrapy_item.price)  # prints 1000

Apply to all scrapy items

You can apply this functionality globally

from scrapy_dot_items import dot_items_globally

dot_items_globally()  # now every scrapy.Item class will have this functionality

class RealEstateItem(scrapy.Item):
    price = scrapy.Field()

dot_scrapy_item = RealEstateItem()

dot_scrapy_item.price = 1000
print(dot_scrapy_item.price)  # prints 1000

Backwards compatibility

scrapy-dot-items are backwards compatible. You can install it into your old project and mix regular and dot style.

dot_scrapy_item['price'] = 2000  # you can still set and get the items the regular way too
print(dot_scrapy_item.get('price'))  # prints 2000
print(dot_scrapy_item.price)  # prints 2000

For contributers

This project uses pipenv instead of pip. Setup:

  • intall pipenv with 'pip install pipenv'
  • create a virtual environment using pipenv with 'pipenv shell' in the root directory
  • install the dependencies with 'pipenv install'

Attention: Please install all packages with 'pipenv install <package_name>'. Do NOT use 'pip install ...'. The same for unistalling 'pipenv uninstall <package_name>'

Metadata

Release files for scrapy-dot-items 1.0.4

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-dot-items 1.0.4
File Size Uploaded
scrapy-dot-items-1.0.4.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scrapy-dot-items 1.0.4
File Interpreter ABI Platform
scrapy_dot_items-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 6.3 kB

Release files / scrapy-dot-items-1.0.4.tar.gz

Download URL scrapy-dot-items-1.0.4.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1eac1984c150ae2936f9033ce76e36facf42f108fd15ec19f009b3a168f18432
BLAKE2b-256 checksum
How to use checksums
66b06cb5291e42c676ab6f2f4de466e072288853d0ed9c7672ed20aa4f591048
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release files / scrapy_dot_items-1.0.4-py3-none-any.whl

Download URL scrapy_dot_items-1.0.4-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
079c93021a1ee40b641d27d78d123d2a0c452c138f10c91073e0fec68ac615ba
BLAKE2b-256 checksum
How to use checksums
5e3d23e5cce3d52e82f1446a18aafa2bd8b7d6a79a2c7882afb66e3e79542b61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.5

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.1

1 release file

0.1.0

1 release file

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