Skip to content

Commit

Permalink
Release new version 0.7.1 (#190)
Browse files Browse the repository at this point in the history
* change version

* to 0.7.1a1

* pre release

* to 071a1

* update a1

* change to dev

* to a1

* to a1

* to dev

* update version

* to b1

* update history

* change history

* fix bug of datetime for stats

* to rc1

* change history

* to 0.7.1
  • Loading branch information
Germey authored Mar 28, 2021
1 parent fff0d82 commit adbc69e
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.7.1-b1
current_version = 0.7.1
commit = False
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>\w+))?
Expand Down
2 changes: 1 addition & 1 deletion .cookiecutterrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ cookiecutter:
use_pypi_deployment_with_travis: n
use_pytest: y
use_requiresio: y
version: 0.7.1-b1
version: 0.7.1
year: 2011-2021
9 changes: 9 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ History

.. comment:: bumpversion marker

0.7.1 (2021-03-27)
------------------
* Fixes datetime parse error for redis-py 3.x.
* Add support for stats extensions.

0.7.1-rc1 (2021-03-27)
----------------------
* Fixes datetime parse error for redis-py 3.x.

0.7.1-b1 (2021-03-22)
---------------------
* Add support for stats extensions.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.1-b1
0.7.1
2 changes: 1 addition & 1 deletion src/scrapy_redis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

__author__ = 'Rolando Espinoza'
__email__ = 'rolando at rmax.io'
__version__ = '0.7.1-b1'
__version__ = '0.7.1'
7 changes: 7 additions & 0 deletions src/scrapy_redis/stats.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from scrapy.statscollectors import StatsCollector
from .connection import from_settings as redis_from_settings
from .defaults import STATS_KEY, SCHEDULER_PERSIST
from datetime import datetime


class RedisStatsCollector(StatsCollector):
Expand Down Expand Up @@ -29,6 +30,10 @@ def _get_key(self, spider=None):
def from_crawler(cls, crawler):
return cls(crawler)

@classmethod
def from_spider(cls, spider):
return cls(spider.crawler)

def get_value(self, key, default=None, spider=None):
"""Return the value of hash stats"""
if self.server.hexists(self._get_key(spider), key):
Expand All @@ -42,6 +47,8 @@ def get_stats(self, spider=None):

def set_value(self, key, value, spider=None):
"""Set the value according to hash key of stats"""
if isinstance(value, datetime):
value = value.timestamp()
self.server.hset(self._get_key(spider), key, value)

def set_stats(self, stats, spider=None):
Expand Down

0 comments on commit adbc69e

Please sign in to comment.