LibreOffice plugin to pipe whole Writer documents through Google Translate, that ought to keep most of the page formatting.

⌈⌋ ⎇ branch:  PageTranslate


Check-in [01879969de]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Check for existence of create_default_context
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 01879969de5ae4ee0ae737916ecc6c51eb04cc0b
User & Date: mario 2021-01-30 12:02:19
Context
2021-01-30
12:05
Note on buggy options dialog check-in: c9ba80cd17 user: mario tags: trunk
12:02
Check for existence of create_default_context check-in: 01879969de user: mario tags: trunk
11:06
remove if sys.platform != 'win32': test for adhoc ssl support check-in: c90a192a1a user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to pythonpath/httprequests.py.

40
41
42
43
44
45
46


47
48
49
50
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65
66
    class fake_requests:
        content = ""
        ssl_args = {}
        headers = {}

        def __init__(self):
            import ssl


            context = ssl.create_default_context();
            context.check_hostname = False
            context.verify_mode = ssl.CERT_NONE
            self.ssl_args["context"] = context
            
        def get(self, url):
            self.content = urlopen(
                Request(url, headers=self.headers), **self.ssl_args
            ).read()
            return self
    
    http = fake_requests()


# headers
http.headers.update({
    "User-Agent": "Mozilla/5.0 (X11; Linux; LibreOffice/6.3), TradutorLibreText/1.3+PageTranslate/1.6",
    "Accept-Language": "*; q=1.0",
    "Accept-Encoding": "utf-8"
})








>
>












>








40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
    class fake_requests:
        content = ""
        ssl_args = {}
        headers = {}

        def __init__(self):
            import ssl
            if not hasattr(ssl, "create_default_context"):
                return
            context = ssl.create_default_context();
            context.check_hostname = False
            context.verify_mode = ssl.CERT_NONE
            self.ssl_args["context"] = context
            
        def get(self, url):
            self.content = urlopen(
                Request(url, headers=self.headers), **self.ssl_args
            ).read()
            return self
    
    http = fake_requests()
    log.info("using fake_requests() for now")

# headers
http.headers.update({
    "User-Agent": "Mozilla/5.0 (X11; Linux; LibreOffice/6.3), TradutorLibreText/1.3+PageTranslate/1.6",
    "Accept-Language": "*; q=1.0",
    "Accept-Encoding": "utf-8"
})