Skip to content

Commit

Permalink
Merge pull request #273 from rennerocha/fix-docs-examples
Browse files Browse the repository at this point in the history
docs: Fixed inconsistent examples
  • Loading branch information
rennerocha authored Sep 11, 2020
2 parents de1cd20 + af20abc commit f0bf02a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
4 changes: 2 additions & 2 deletions docs/source/howto/stats-collection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ To enable it, include the following code in your project settings:

.. code-block:: python
# myproject/settings.py
# tutorial/settings.py
STATS_CLASS = (
"spidermon.contrib.stats.statscollectors.LocalStorageStatsHistoryCollector"
)
Expand All @@ -34,7 +34,7 @@ returned in the previous spider executions.

.. code-block:: python
# myproject/monitors.py
# tutorial/monitors.py
from spidermon import Monitor, MonitorSuite, monitors
Expand Down
18 changes: 11 additions & 7 deletions docs/source/item-validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ that need to be validated.
# settings.py
SPIDERMON_VALIDATION_MODELS: [
'myproject.validators.DummyItemModel'
SPIDERMON_VALIDATION_MODELS = [
'tutorial.validators.DummyItemModel'
]
If you are working on a spider that produces multiple items types, you can define it
Expand All @@ -157,9 +157,11 @@ as a `dict`:
# settings.py
SPIDERMON_VALIDATION_MODELS: {
DummyItem: 'myproject.validators.DummyItemModel',
OtherItem: 'myproject.validators.OtherItemModel',
from tutorial.items import DummyItem, OtherItem
SPIDERMON_VALIDATION_MODELS = {
DummyItem: 'tutorial.validators.DummyItemModel',
OtherItem: 'tutorial.validators.OtherItemModel',
}
.. _SPIDERMON_VALIDATION_SCHEMAS:
Expand All @@ -175,7 +177,7 @@ A `list` containing the location of the item schema. Could be a local path or a
# settings.py
SPIDERMON_VALIDATION_SCHEMAS: [
SPIDERMON_VALIDATION_SCHEMAS = [
'/path/to/schema.json',
's3://bucket/schema.json',
'https://example.com/schema.json',
Expand All @@ -188,7 +190,9 @@ as a `dict`:
# settings.py
SPIDERMON_VALIDATION_SCHEMAS: {
from tutorial.items import DummyItem, OtherItem
SPIDERMON_VALIDATION_SCHEMAS = {
DummyItem: '/path/to/dummyitem_schema.json',
OtherItem: '/path/to/otheritem_schema.json',
}
Expand Down
10 changes: 5 additions & 5 deletions docs/source/monitors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ First we define a new action that will close the spider when executed:

.. code-block:: python
# myproject/actions.py
# tutorial/actions.py
from spidermon.core.actions import Action
class CloseSpiderAction(Action):
Expand All @@ -181,8 +181,8 @@ and then take an action if it fails:

.. code-block:: python
# myproject/monitors.py
from myproject.actions import CloseSpiderAction
# tutorial/monitors.py
from tutorial.actions import CloseSpiderAction
@monitors.name('Periodic job stats monitor')
class PeriodicJobStatsMonitor(Monitor, StatsMonitorMixin):
Expand All @@ -203,10 +203,10 @@ The last step is to configure the suite to be executed every 60 seconds:

.. code-block:: python
# myproject/settings.py
# tutorial/settings.py
SPIDERMON_PERIODIC_MONITORS = {
'myproject.monitors.PeriodicMonitorSuite': 60, # time in seconds
'tutorial.monitors.PeriodicMonitorSuite': 60, # time in seconds
}
What to monitor?
Expand Down
2 changes: 1 addition & 1 deletion docs/source/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ For example, the following suite will be executed every 30 minutes:
.. code-block:: python
SPIDERMON_PERIODIC_MONITORS = {
'myproject.monitors.PeriodicMonitorSuite': 1800,
'tutorial.monitors.PeriodicMonitorSuite': 1800,
}
.. _SPIDERMON_SPIDER_CLOSE_MONITORS:
Expand Down

0 comments on commit f0bf02a

Please sign in to comment.