Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 832

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 839
diff --git a/CHANGELOG.md b/CHANGELOG.md index 52ccfc6f..f13a2b38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ The change log is also available on the [GitHub Releases Page](https://github.com/rollbar/pyrollbar/releases). +**1.1.1** + +Fixed #465 httpx 0.28.0 not compatible with pyrollbar by @danielmorell in [#466](https://github.com/rollbar/pyrollbar/pull/466) + **1.1.0** - Updated supported/tested frameworks and modernized tests and packaging by @danielmorell in [#455](https://github.com/rollbar/pyrollbar/pull/455) diff --git a/rollbar/__init__.py b/rollbar/__init__.py index 53ef0d60..2a3a62d7 100644 --- a/rollbar/__init__.py +++ b/rollbar/__init__.py @@ -24,7 +24,7 @@ from rollbar.lib import events, filters, dict_merge, transport, defaultJSONEncode -__version__ = '1.1.0' +__version__ = '1.1.1' __log_name__ = 'rollbar' log = logging.getLogger(__log_name__) diff --git a/rollbar/lib/_async.py b/rollbar/lib/_async.py index 4c233069..163671e5 100644 --- a/rollbar/lib/_async.py +++ b/rollbar/lib/_async.py @@ -132,10 +132,16 @@ async def _post_api_httpx(path, payload_str, access_token=None): 'proxy_password': rollbar.SETTINGS.get('http_proxy_password'), } proxies = transport._get_proxy_cfg(proxy_cfg) + mounts = None + if proxies: + mounts = { + 'http://': httpx.HTTPTransport(proxy=proxies['http']), + 'https://': httpx.HTTPTransport(proxy=proxies['https']), + } url = urljoin(rollbar.SETTINGS['endpoint'], path) async with httpx.AsyncClient( - proxies=proxies, verify=rollbar.SETTINGS.get('verify_https', True) + mounts=mounts, verify=rollbar.SETTINGS.get('verify_https', True) ) as client: resp = await client.post( url, diff --git a/rollbar/lib/transport.py b/rollbar/lib/transport.py index 4e8653f4..320c5e49 100644 --- a/rollbar/lib/transport.py +++ b/rollbar/lib/transport.py @@ -1,3 +1,5 @@ +from typing import Optional + import requests import threading @@ -12,19 +14,19 @@ def _session(): return _local.session -def _get_proxy_cfg(kw): +def _get_proxy_cfg(kw: dict) -> Optional[dict]: proxy = kw.pop('proxy', None) proxy_user = kw.pop('proxy_user', None) proxy_password = kw.pop('proxy_password', None) if proxy and proxy_user and proxy_password: return { - 'http': 'http://{}:{}@{}'.format(proxy_user, proxy_password, proxy), - 'https': 'http://{}:{}@{}'.format(proxy_user, proxy_password, proxy), + 'http': f'http://{proxy_user}:{proxy_password}@{proxy}', + 'https': f'http://{proxy_user}:{proxy_password}@{proxy}', } elif proxy: return { - 'http': 'http://{}'.format(proxy), - 'https': 'http://{}'.format(proxy), + 'http': f'http://{proxy}', + 'https': f'http://{proxy}', } diff --git a/rollbar/test/test_lib.py b/rollbar/test/test_lib.py index fbaeaed0..cc85d3b6 100644 --- a/rollbar/test/test_lib.py +++ b/rollbar/test/test_lib.py @@ -1,4 +1,5 @@ from rollbar.lib import dict_merge, prefix_match, key_match, key_depth +from rollbar.lib.transport import _get_proxy_cfg from rollbar.test import BaseTest @@ -108,3 +109,19 @@ def test_dict_merge_dicts_select_poll(self): self.assertEqual(42, result['a']['b']) self.assertIn('y', result['a']) self.assertRegex(result['a']['y'], r'Uncopyable obj') + + def test_transport_get_proxy_cfg(self): + result = _get_proxy_cfg({}) + self.assertEqual(None, result) + + result = _get_proxy_cfg({'proxy': 'localhost'}) + self.assertEqual({'http': 'http://localhost', 'https': 'http://localhost'}, result) + + result = _get_proxy_cfg({'proxy': 'localhost:8080'}) + self.assertEqual({'http': 'http://localhost:8080', 'https': 'http://localhost:8080'}, result) + + result = _get_proxy_cfg({'proxy': 'localhost', 'proxy_user': 'username', 'proxy_password': 'password'}) + self.assertEqual({ + 'http': 'http://username:password@localhost', + 'https': 'http://username:password@localhost', + }, result)