Skip to content

Commit bed6a33

Browse files
2.0.12 (#417)
Pull request ============ Description ----------- Fixed error with urllib3, added Python 3.12 to testing and modules updates How Has This Been Tested ------------------------ GitHub Actions with pytest Types of changes ---------------- - [x] Bug fix (#416) - [x] Added Python 3.12 support, removed Python 3.7 - [x] Dependencies updated - [x] Vulnerabilities fixes --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 2a5f8e8 commit bed6a33

File tree

16 files changed

+105
-67
lines changed

16 files changed

+105
-67
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
language: ["python"]
2323
steps:
2424
- name: Checkout repository
25-
uses: actions/checkout@v3
25+
uses: actions/checkout@v4
2626
- name: Initialize CodeQL
2727
uses: github/codeql-action/init@v2
2828
with:

.github/workflows/codestyle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
name: Check code style
1717
steps:
18-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v4
1919
- uses: RojerGS/python-black-check@master
2020
with:
2121
line-length: "88"

.github/workflows/publish.yml

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,35 @@ jobs:
1616
test:
1717
environment:
1818
name: Testing
19-
runs-on: ubuntu-latest
2019
strategy:
20+
fail-fast: false
2121
matrix:
22-
python-version: [3.7, 3.8, 3.9, "3.10"]
22+
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"]
23+
os: [ubuntu-latest, windows-latest, macos-latest]
24+
include:
25+
- os: ubuntu-latest
26+
path: ~/.cache/pip
27+
- os: macos-latest
28+
path: ~/Library/Caches/pip
29+
- os: windows-latest
30+
path: ~\AppData\Local\pip\Cache
31+
runs-on: ${{ matrix.os }}
2332
steps:
24-
- uses: actions/checkout@v3
33+
- uses: actions/checkout@v4
2534
- name: Set up Python ${{ matrix.python-version }}
26-
uses: actions/setup-python@v4
35+
uses: actions/setup-python@v5
2736
with:
2837
python-version: ${{ matrix.python-version }}
2938
- name: Cache pip
30-
uses: actions/cache@v3
39+
uses: actions/cache@v4
3140
with:
32-
path: ~/.cache/pip
33-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
41+
path: ${{ matrix.path }}
42+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}-${{ matrix.python-version }}
43+
- name: Update pip, wheel and setuptools
44+
run: |
45+
python -m pip install --upgrade pip wheel setuptools
3446
- name: Install dependencies
3547
run: |
36-
python -m pip install --upgrade pip wheel
3748
pip install -r requirements.txt
3849
pip install .
3950
- name: Test with pytest
@@ -45,16 +56,16 @@ jobs:
4556
name: Build and publish Python 🐍 distributions 📦 to PyPI
4657
runs-on: ubuntu-latest
4758
steps:
48-
- uses: actions/checkout@v3
49-
- name: Set up Python 3.9
50-
uses: actions/setup-python@v4
59+
- uses: actions/checkout@v4
60+
- name: Set up Python 3.12
61+
uses: actions/setup-python@v5
5162
with:
52-
python-version: 3.9
63+
python-version: "3.12"
5364
- name: Cache pip
54-
uses: actions/cache@v3
65+
uses: actions/cache@v4
5566
with:
5667
path: ~/.cache/pip
57-
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
68+
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}-${{ matrix.python-version }}
5869
restore-keys: |
5970
${{ runner.os }}-pip-
6071
- name: Install requirements
@@ -65,7 +76,7 @@ jobs:
6576
run: |
6677
python setup.py sdist
6778
- name: Publish distribution 📦 to PyPI
68-
uses: pypa/gh-action-pypi-publish@v1.5.1
79+
uses: pypa/gh-action-pypi-publish@v1.5.2
6980
with:
7081
password: ${{ secrets.pypi_password }}
7182
release:
@@ -75,7 +86,7 @@ jobs:
7586
runs-on: ubuntu-latest
7687
steps:
7788
- name: Checkout code
78-
uses: actions/checkout@v3
89+
uses: actions/checkout@v4
7990
- name: Create Release
8091
id: create_release
8192
uses: actions/create-release@v1.1.4

.github/workflows/wiki.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111
runs-on: ubuntu-latest
1212

1313
steps:
14-
- uses: actions/checkout@v3
15-
- name: Install Python 3.8
16-
uses: actions/setup-python@v4
14+
- uses: actions/checkout@v4
15+
- name: Install Python 3.12
16+
uses: actions/setup-python@v5
1717
with:
18-
python-version: 3.8
18+
python-version: 3.12
1919
- name: Install dependencies
2020
run: >-
2121
pip install pydoc-markdown mkdocs

codeforces_api/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
You should have received a copy of the GNU General Public License
1515
along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
"""
17+
1718
__all__ = ["CodeforcesApi", "CodeforcesApiRequestMaker", "CodeforcesParser"]
1819
from codeforces_api.api_request_maker import CodeforcesApiRequestMaker
1920
from codeforces_api.api_requests import CodeforcesApi

codeforces_api/api_request_maker.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
You should have received a copy of the GNU General Public License
1515
along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
"""
17+
1718
import collections
1819
import hashlib
1920
import json
2021
import random
2122
import time
2223

23-
import requests
24+
import urllib
2425

2526

2627
class CodeforcesApiRequestMaker:
@@ -68,7 +69,7 @@ def generate_request(self, method_name, **fields):
6869
fields["time"] = str(int(current_time))
6970
api_signature = str(self._rand) + "/" + method_name + "?"
7071
fields = collections.OrderedDict(sorted(fields.items()))
71-
api_signature += requests.urllib3.request.urlencode(fields, safe=";")
72+
api_signature += urllib.parse.urlencode(fields, safe=";")
7273
api_signature += "#" + str(self._secret)
7374
hashed_signature = hashlib.sha512(api_signature.encode("utf-8"))
7475
fields["apiSig"] = str(self._rand) + str(hashed_signature.hexdigest())

codeforces_api/api_requests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
You should have received a copy of the GNU General Public License
1515
along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
"""
17+
1718
import requests
1819

1920
from codeforces_api.api_request_maker import CodeforcesApiRequestMaker

codeforces_api/parse_methods.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
You should have received a copy of the GNU General Public License
1515
along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
"""
17+
1718
import requests
1819
from lxml import html
1920

@@ -43,7 +44,12 @@ def get_solution(self, contest_id, submit_id):
4344
"https://codeforces.com/contest/"
4445
+ str(contest_id)
4546
+ "/submission/"
46-
+ str(submit_id)
47+
+ str(submit_id),
48+
cookies={
49+
"RCPC": "333e1cab3b9ab19c225e45305669bef8",
50+
"expires": "Thu, 31-Dec-37 23:55:55 GMT",
51+
"path": "/",
52+
},
4753
)
4854
if int(solutionPage.status_code) != 200:
4955
raise Exception("Returned not OK code " + str(solutionPage))

codeforces_api/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
Source of inspiration: https://github.com/eternnoir/pyTelegramBotAPI/blob/master/telebot/types.py
1717
"""
18+
1819
import json
1920

2021

codeforces_api/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "2.0.11"
1+
__version__ = "2.0.12"

0 commit comments

Comments
 (0)