Skip to content

Commit ea717bb

Browse files
authored
Merge branch 'main' into patch-1
2 parents 32836f9 + 6dfe1be commit ea717bb

File tree

25 files changed

+1095
-629
lines changed

25 files changed

+1095
-629
lines changed

.coveragerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ omit =
99
*/python?.?/*
1010
*/site-packages/*
1111
*/pypy/*
12-
*kombu/async/http/urllib3_client.py
12+
*kombu/async/http/curl.py
1313
*kombu/five.py
1414
*kombu/transport/mongodb.py
1515
*kombu/transport/filesystem.py

.github/workflows/linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
python-version: ["3.13"]
2121
steps:
2222
- name: Install system packages
23-
run: sudo apt-get update && sudo apt-get install libssl-dev
23+
run: sudo apt-get update && sudo apt-get install libcurl4-openssl-dev libssl-dev
2424
- name: Check out code from GitHub
2525
uses: actions/checkout@v4
2626
- name: Set up Python ${{ matrix.python-version }}

.github/workflows/python-package.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
steps:
4040
- name: Install apt packages
4141
if: startsWith(matrix.os, 'blacksmith-4vcpu-ubuntu')
42-
run: sudo apt-get update && sudo apt-get install libssl-dev
42+
run: sudo apt-get update && sudo apt-get install libcurl4-openssl-dev libssl-dev
4343
- uses: actions/checkout@v4
4444
- name: Set up Python ${{ matrix.python-version }}
4545
uses: useblacksmith/setup-python@v6
@@ -104,7 +104,7 @@ jobs:
104104

105105
steps:
106106
- name: Install apt packages
107-
run: sudo apt-get update && sudo apt-get install libssl-dev
107+
run: sudo apt-get update && sudo apt-get install libcurl4-openssl-dev libssl-dev
108108

109109
- uses: actions/checkout@v4
110110
- name: Set up Python ${{ matrix.python-version }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ env
3939
.coverage.*
4040
control/
4141
.env
42+
.hypothesis/*
43+
junit.xml

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Adam Gaca <[email protected]>
77
Adam Nelson <[email protected]>
88
Adam Wentz
99
Alan Justino <[email protected]>
10+
Alex Jones
1011
Alex Koshelev <[email protected]>
1112
Alexandre Bourget <[email protected]>
1213
Anastasis Andronidis <[email protected]>

docs/reference/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Kombu Asynchronous
7171
kombu.asynchronous.debug
7272
kombu.asynchronous.http
7373
kombu.asynchronous.http.base
74-
kombu.asynchronous.http.urllib3_client
74+
kombu.asynchronous.http.curl
7575
kombu.asynchronous.aws
7676
kombu.asynchronous.aws.connection
7777
kombu.asynchronous.aws.sqs

docs/reference/kombu.asynchronous.http.urllib3_client.rst

Lines changed: 0 additions & 11 deletions
This file was deleted.

kombu/asynchronous/aws/connection.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from vine import promise, transform
99

10-
from kombu.asynchronous.aws.ext import AWSRequest, get_cert_path, get_response
10+
from kombu.asynchronous.aws.ext import AWSRequest, get_response
1111
from kombu.asynchronous.http import Headers, Request, get_client
1212

1313

@@ -92,8 +92,7 @@ def getrequest(self):
9292
headers = Headers(self.headers)
9393
return self.Request(self.path, method=self.method, headers=headers,
9494
body=self.body, connect_timeout=self.timeout,
95-
request_timeout=self.timeout,
96-
validate_cert=True, ca_certs=get_cert_path(True))
95+
request_timeout=self.timeout, validate_cert=False)
9796

9897
def getresponse(self, callback=None):
9998
request = self.getrequest()

kombu/asynchronous/aws/ext.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import boto3
77
from botocore import exceptions
88
from botocore.awsrequest import AWSRequest
9-
from botocore.httpsession import get_cert_path
109
from botocore.response import get_response
1110
except ImportError:
1211
boto3 = None
@@ -20,9 +19,8 @@ class BotoCoreError(Exception):
2019
exceptions.BotoCoreError = BotoCoreError
2120
AWSRequest = _void()
2221
get_response = _void()
23-
get_cert_path = _void()
2422

2523

2624
__all__ = (
27-
'exceptions', 'AWSRequest', 'get_response', 'get_cert_path',
25+
'exceptions', 'AWSRequest', 'get_response'
2826
)

kombu/asynchronous/aws/sqs/connection.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,28 @@
2020
class AsyncSQSConnection(AsyncAWSQueryConnection):
2121
"""Async SQS Connection."""
2222

23-
def __init__(self, sqs_connection, debug=0, region=None, fetch_message_attributes=None, **kwargs):
23+
def __init__(
24+
self,
25+
sqs_connection,
26+
debug=0,
27+
region=None,
28+
message_system_attribute_names=None,
29+
message_attribute_names=None,
30+
**kwargs
31+
):
2432
if boto3 is None:
2533
raise ImportError('boto3 is not installed')
2634
super().__init__(
2735
sqs_connection,
2836
region_name=region, debug=debug,
2937
**kwargs
3038
)
31-
self.fetch_message_attributes = (
32-
fetch_message_attributes if fetch_message_attributes is not None
33-
else ["ApproximateReceiveCount"]
39+
self.message_system_attribute_names = (
40+
message_system_attribute_names if message_system_attribute_names else ["ApproximateReceiveCount"]
41+
)
42+
self.message_attribute_names = (
43+
[message_attribute_names] if isinstance(message_attribute_names, str)
44+
else (message_attribute_names or [])
3445
)
3546

3647
def _create_query_request(self, operation, params, queue_url, method):
@@ -160,13 +171,17 @@ def receive_message(
160171
):
161172
params = {'MaxNumberOfMessages': number_messages}
162173
proto_params = {'query': {}, 'json': {}}
163-
attrs = attributes if attributes is not None else self.fetch_message_attributes
174+
attrs = attributes if attributes is not None else self.message_system_attribute_names
175+
msg_attr_names = self.message_attribute_names if self.message_attribute_names else None
164176

165177
if visibility_timeout:
166178
params['VisibilityTimeout'] = visibility_timeout
167179
if attrs:
168-
proto_params['json'].update({'AttributeNames': list(attrs)})
169-
proto_params['query'].update(_query_object_encode({'AttributeName': list(attrs)}))
180+
proto_params['json'].update({'MessageSystemAttributeNames': list(attrs)})
181+
proto_params['query'].update(_query_object_encode({'MessageSystemAttributeName': list(attrs)}))
182+
if msg_attr_names:
183+
proto_params['json'].update({'MessageAttributeNames': list(msg_attr_names)})
184+
proto_params['query'].update(_query_object_encode({'MessageAttributeNames': list(msg_attr_names)}))
170185
if wait_time_seconds is not None:
171186
params['WaitTimeSeconds'] = wait_time_seconds
172187

kombu/asynchronous/http/__init__.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
from __future__ import annotations
22

3+
from typing import TYPE_CHECKING
4+
35
from kombu.asynchronous import get_event_loop
4-
from kombu.asynchronous.http.base import BaseClient, Headers, Request, Response
6+
from kombu.asynchronous.http.base import Headers, Request, Response
57
from kombu.asynchronous.hub import Hub
68

7-
__all__ = ('Client', 'Headers', 'Response', 'Request', 'get_client')
9+
if TYPE_CHECKING:
10+
from kombu.asynchronous.http.curl import CurlClient
11+
12+
__all__ = ('Client', 'Headers', 'Response', 'Request')
813

914

10-
def Client(hub: Hub | None = None, **kwargs: int) -> BaseClient:
15+
def Client(hub: Hub | None = None, **kwargs: int) -> CurlClient:
1116
"""Create new HTTP client."""
12-
from .urllib3_client import Urllib3Client
13-
return Urllib3Client(hub, **kwargs)
17+
from .curl import CurlClient
18+
return CurlClient(hub, **kwargs)
1419

1520

16-
def get_client(hub: Hub | None = None, **kwargs: int) -> BaseClient:
21+
def get_client(hub: Hub | None = None, **kwargs: int) -> CurlClient:
1722
"""Get or create HTTP client bound to the current event loop."""
1823
hub = hub or get_event_loop()
1924
try:

kombu/asynchronous/http/base.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
if TYPE_CHECKING:
1717
from types import TracebackType
1818

19-
__all__ = ('Headers', 'Response', 'Request', 'BaseClient')
19+
__all__ = ('Headers', 'Response', 'Request')
2020

2121
PYPY = hasattr(sys, 'pypy_version_info')
2222

@@ -236,12 +236,6 @@ def header_parser(keyt=normalize_header):
236236

237237

238238
class BaseClient:
239-
"""Base class for HTTP clients.
240-
241-
This class provides the basic structure and functionality for HTTP clients.
242-
Subclasses should implement specific HTTP client behavior.
243-
"""
244-
245239
Headers = Headers
246240
Request = Request
247241
Response = Response

0 commit comments

Comments
 (0)