Changeset 1191:0db341c8c3b3 for src/mlx


Ignore:
Timestamp:
05/30/25 17:37:04 (2 days ago)
Author:
István Váradi <ivaradi@…>
Branch:
python3
Phase:
public
Tags:
tip
Message:

context is used instead of cafile in urlopen()

Location:
src/mlx
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/mlx/common.py

    r1047 r1191  
    11import os
     2import ssl
     3import certifi
    24
    35#-----------------------------------------------------------------------------
     
    4446
    4547    return newDict
     48
     49#-------------------------------------------------------------------------------
     50
     51sslContext = ssl.create_default_context(cafile = certifi.where())
  • src/mlx/gui/flight.py

    r1176 r1191  
    3030from io import StringIO
    3131import lxml.html
    32 import certifi
    3332
    3433#-----------------------------------------------------------------------------
     
    38833882
    38843883            # Obtaining the xml
    3885             response = urllib.request.urlopen(link,
    3886                                               cafile = certifi.where())
     3884            response = urllib.request.urlopen(link, context = sslContext)
    38873885            content = etree.iterparse(response)
    38883886
  • src/mlx/rpc.py

    r1170 r1191  
    33from . import gates
    44
    5 from .common import MAVA_BASE_URL, fixUnpickled
     5from .common import MAVA_BASE_URL, fixUnpickled, sslContext
    66
    77import jsonrpclib
     
    1010import calendar
    1111import sys
    12 import ssl
    13 import certifi
    1412
    1513#---------------------------------------------------------------------------------------
     
    727725        self._getCredentialsFn = getCredentialsFn
    728726
    729         sslContext = ssl.SSLContext()
    730         sslContext.load_verify_locations(cafile = certifi.where())
    731727        transport = jsonrpclib.jsonrpc.SafeTransport(jsonrpclib.config.DEFAULT,
    732728                                                     sslContext)
  • src/mlx/update.py

    r977 r1191  
    1212import traceback
    1313import io
    14 import certifi
    1514
    1615if os.name=="nt":
     
    233232    f = None
    234233    try:
     234        from .common import sslContext
     235
    235236        updateManifest = Manifest()
    236237        reply = urllib.request.urlopen(updateURL + "/" + manifestName,
    237                                        cafile = certifi.where())
     238                                       context = sslContext)
    238239        charset = reply.headers.get_content_charset()
    239240        content = reply.read().decode("utf-8" if charset is None else charset)
     
    370371               
    371372            with open(targetFile, "wb") as fout:
     373                from .common import sslContext
     374
    372375                fin = urllib.request.urlopen(updateURL + "/" + path,
    373                                              cafile = certifi.where())
     376                                             context = sslContext)
    374377                while True:
    375378                    data = fin.read(256*1024)
  • src/mlx/web.py

    r1181 r1191  
    66from . import rpccommon
    77
    8 from .common import MAVA_BASE_URL
     8from .common import MAVA_BASE_URL, sslContext
    99from .pirep import PIREP
    1010
     
    629629                "cookie": "akamai_pilotweb_access=true;"
    630630            });
    631             f = urllib.request.urlopen(request, timeout = 10.0, cafile=certifi.where())
     631            f = urllib.request.urlopen(request, timeout = 10.0,
     632                                       context = sslContext)
    632633            try:
    633634                data = f.read(16384)
     
    666667        try:
    667668            url += data
    668             f = urllib.request.urlopen(url, timeout = 10.0, cafile = certifi.where())
     669            f = urllib.request.urlopen(url, timeout = 10.0,
     670                                       context = sslContext)
    669671            try:
    670672                for line in f.readlines():
Note: See TracChangeset for help on using the changeset viewer.