Browse Source

py38: upgrade requests (#24468)

josh 3 years ago
parent
commit
c51e74dfb9

+ 1 - 1
requirements-base.txt

@@ -43,7 +43,7 @@ rb==1.9.0
 redis-py-cluster==2.1.0
 redis==3.4.1
 requests-oauthlib==1.2.0
-requests[security]==2.20.1
+requests==2.25.1
 # [start] jsonschema format validators
 rfc3339-validator==0.1.2
 rfc3986-validator==0.1.1

+ 1 - 2
src/sentry/filestore/gcs.py

@@ -17,7 +17,6 @@ from google.cloud.storage.client import Client
 from google.resumable_media.common import DataCorruption
 from requests.exceptions import RequestException
 
-from sentry.http import OpenSSLError
 from sentry.net.http import TimeoutAdapter
 from sentry.utils import metrics
 
@@ -57,7 +56,7 @@ def try_repeated(func):
             metrics_tags.update({"success": "1"})
             metrics.timing(metrics_key, idx, tags=metrics_tags)
             return result
-        except (DataCorruption, TransportError, RefreshError, RequestException, OpenSSLError) as e:
+        except (DataCorruption, TransportError, RefreshError, RequestException) as e:
             if idx >= GCS_RETRIES:
                 metrics_tags.update({"success": "0", "exception_class": e.__class__.__name__})
                 metrics.timing(metrics_key, idx, tags=metrics_tags)

+ 3 - 15
src/sentry/http.py

@@ -31,18 +31,6 @@ MAX_URL_LENGTH = 150
 # UrlResult.body **must** be bytes
 UrlResult = namedtuple("UrlResult", ["url", "headers", "body", "status", "encoding"])
 
-# In case SSL is unavailable (light builds) we can't import this here.
-try:
-    from OpenSSL.SSL import Error as OpenSSLError
-    from OpenSSL.SSL import ZeroReturnError
-except ImportError:
-
-    class ZeroReturnError(Exception):
-        pass
-
-    class OpenSSLError(Exception):
-        pass
-
 
 class BadSource(Exception):
     error_type = EventError.UNKNOWN_ERROR
@@ -230,13 +218,13 @@ def fetch_file(
                         # We want size in megabytes to format nicely
                         "max_size": float(settings.SENTRY_SOURCE_FETCH_MAX_SIZE) / 1024 / 1024,
                     }
-                elif isinstance(exc, (RequestException, ZeroReturnError, OpenSSLError)):
+                elif isinstance(exc, RequestException):
                     error = {
                         "type": EventError.FETCH_GENERIC_ERROR,
-                        "value": str(type(exc)),
+                        "value": f"{type(exc)}",
                     }
                 else:
-                    logger.exception(str(exc))
+                    logger.exception(f"{exc}")
                     error = {"type": EventError.UNKNOWN_ERROR}
 
                 # TODO(dcramer): we want to be less aggressive on disabling domains

+ 0 - 9
src/sentry/lang/javascript/processor.py

@@ -16,15 +16,6 @@ from django.conf import settings
 from requests.utils import get_encoding_from_headers
 from symbolic import SourceMapView
 
-# In case SSL is unavailable (light builds) we can't import this here.
-try:
-    from OpenSSL.SSL import ZeroReturnError
-except ImportError:
-
-    class ZeroReturnError(Exception):
-        pass
-
-
 from sentry import http
 from sentry.interfaces.stacktrace import Stacktrace
 from sentry.models import EventError, Organization, ReleaseFile