Skip to content
This repository was archived by the owner on Dec 28, 2023. It is now read-only.

Commit 67a9782

Browse files
committed
Python 3.5 support
1 parent 7772480 commit 67a9782

File tree

6 files changed

+13
-8
lines changed

6 files changed

+13
-8
lines changed

.github/workflows/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
runs-on: ubuntu-18.04
3131
strategy:
3232
matrix:
33-
python-version: [3.6, 3.7, 3.8]
33+
python-version: [3.5, 3.6, 3.7, 3.8]
3434

3535
steps:
3636
- uses: actions/checkout@v2

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ to transparently interact with the [Crawlera Fetch API](https://scrapinghub.atla
88

99
## Requirements
1010

11-
* Python 3.6+
11+
* Python 3.5+
1212
* Scrapy 1.6+
1313

1414

crawlera_fetch/middleware.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def process_request(self, request: Request, spider: Spider) -> Optional[Request]
119119
request.headers.update(additional_headers)
120120

121121
if scrapy.version_info < (2, 0, 0):
122-
original_url_flag = f"original url: {request.url}"
122+
original_url_flag = "original url: {}".format(request.url)
123123
if original_url_flag not in request.flags:
124124
request.flags.append(original_url_flag)
125125

setup.py

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"Development Status :: 1 - Planning",
2020
"License :: OSI Approved :: BSD License",
2121
"Programming Language :: Python",
22+
"Programming Language :: Python :: 3.5",
2223
"Programming Language :: Python :: 3.6",
2324
"Programming Language :: Python :: 3.7",
2425
"Programming Language :: Python :: 3.8",
@@ -28,5 +29,6 @@
2829
"Topic :: Software Development :: Libraries :: Application Frameworks",
2930
"Topic :: Software Development :: Libraries :: Python Modules",
3031
],
32+
python_requires=">=3.5",
3133
install_requires=["scrapy>=1.6.0", "w3lib"],
3234
)

tests/test_stats.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def test_stats(mocked_time):
4949
assert middleware.stats.get_value("crawlera_fetch/avg_latency") == avg_latency
5050
assert middleware.stats.get_value("crawlera_fetch/max_latency") == max_latency
5151
for status in set(status_list):
52-
status_count = middleware.stats.get_value(f"crawlera_fetch/response_status_count/{status}")
53-
assert status_count == status_list.count(status)
52+
sc = middleware.stats.get_value("crawlera_fetch/response_status_count/{}".format(status))
53+
assert sc == status_list.count(status)
5454
for method in set(method_list):
55-
method_count = middleware.stats.get_value(f"crawlera_fetch/request_method_count/{method}")
56-
assert method_count == method_list.count(method)
55+
mc = middleware.stats.get_value("crawlera_fetch/request_method_count/{}".format(method))
56+
assert mc == method_list.count(method)

tox.ini

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = flake8,black,typing,py3.6,py3.7,py3.8
2+
envlist = flake8,black,typing,py3.5,py3.6,py3.7,py3.8
33

44

55
[testenv]
@@ -23,6 +23,9 @@ deps = mypy==0.770
2323
basepython = python3.8
2424
commands = mypy --ignore-missing-imports --follow-imports=skip crawlera_fetch tests
2525

26+
[testenv:py3.5]
27+
basepython = python3.5
28+
2629
[testenv:py3.6]
2730
basepython = python3.6
2831

0 commit comments

Comments
 (0)