Skip to main content

Scrapy extension that logs errors to Sentry

Project description

🐞 scrapy-sentry-errors

A simple Scrapy extension that logs spider errors to your Sentry account, helping you monitor and fix issues with your Scrapy spiders efficiently. 🚀

Note: While this extension captures errors from Scrapy spiders, it does not capture errors elsewhere in Scrapy's operation (e.g., the Scrapy pipeline).

📋 Requirements

  • Python 3.8 or higher
  • A Sentry account.
  • The DSN for your Sentry project.

🛠️ Installation

pip install city-scrapers-sentry

🏗️ Setup

Add SENTRY_DSN and scrapy_sentry_errors.extensions.Errors extension to your Scrapy project's settings.py file:

Example:

# sentry dsn
SENTRY_DSN = 'http://public:secret@example.com/1'
EXTENSIONS = {
    "scrapy_sentry_errors.extensions.Errors": 10,
}

Sentry spider errors will be logged to your Sentry account.

💻 Development

  1. Clone this repository.

  2. Run the dev setup script and follow the prompts. This will create a virtual environment and a .env file with your Sentry DSN:

bash ./scripts/dev_setup.sh
  1. Simulate a failed spider run using the example Scrapy project in this repo:
pipenv run example

🧪 Testing

Run the tests with:

pipenv run test

📦 Publishing

  1. Bump the version number in pyproject.toml

  2. Create a new build with:

pipenv run build
  1. Publish the build to PyPI with:
pipenv run publish

🤝 Contributing

We welcome contributions of all kinds from anyone. Here are some ways you can contribute:

  • Reporting Bugs: If you find a bug, please report it by opening an issue. Be sure to provide a detailed description of the bug and, if possible, steps to reproduce it.
  • Suggesting Enhancements: Have an idea for a new feature or think something could be improved? Let us know by opening an issue.
  • Code Contributions: Feel free to fork the repository and submit pull requests. Whether it's fixing a bug, adding a feature, or improving documentation, your help is welcome.

🙏 Acknowledgements

This project began as a fork of scrapy-sentry, which was developed by Jordi Llonch. We are grateful for his work and those of other contributors.

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

scrapy-sentry-errors-1.0.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

scrapy_sentry_errors-1.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file scrapy-sentry-errors-1.0.0.tar.gz.

File metadata

  • Download URL: scrapy-sentry-errors-1.0.0.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for scrapy-sentry-errors-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1f403ab863e0dd026109e416515b479517b6bb59a38b057ca68a45fa5701943f
MD5 abbcd572981ef03fca9ac2b75ff0b043
BLAKE2b-256 9087d4ad848666ea732de7a2c1982c1c30ad4a25b4848e546a96f52866ba4ad3

See more details on using hashes here.

File details

Details for the file scrapy_sentry_errors-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for scrapy_sentry_errors-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0f2292b9d3b0d304f63493b2764aa83425b17e0bb62acc2fd242c7e10765f58
MD5 f8496a35c81dfb8e0c80c4ca4c10aaf6
BLAKE2b-256 f0dc8dbfa879e528968eaeb1a31ed0de91ba8975df255a4c32e4715a0d49d75a

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