This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
Re: units issues
- From: Doug Henderson <djndnbvg at gmail dot com>
- To: cygwin-apps at cygwin dot com
- Date: Wed, 24 May 2017 20:07:12 -0600
- Subject: Re: units issues
- Authentication-results: sourceware.org; auth=none
- References: <c2742327-a4d3-6e3c-88ad-5cf95af89b8a@SystematicSw.ab.ca> <e0dfcba3-ad13-ff05-6128-02cecc66a67e@cygwin.com> <e65a0c0b-737e-2d10-b5c9-ef1ee5d6f99d@SystematicSw.ab.ca> <7f2814c4-518a-c097-de05-f4c694dbf362@SystematicSw.ab.ca> <8c55fe7c-5e1c-4bec-dab5-b04e86c59ec4@cygwin.com> <b2d200f9-2401-50a2-ecc3-567fcad95923@SystematicSw.ab.ca> <f16d69d5-9b9b-0089-b73a-2b0abdc0ce3d@SystematicSw.ab.ca> <2e0bdfd4-9b99-1ae8-bd82-2b986529e0a4@dronecode.org.uk> <977d9380-31dc-78de-a260-16689664129d@SystematicSw.ab.ca> <5d9a21b5-2c14-c1e8-2c33-6038aef22ace@SystematicSw.ab.ca> <8737bvjxdp.fsf@Rainer.invalid> <2a783f3e-7c6a-20ab-2130-0d8b42c73111@SystematicSw.ab.ca> <871sre5dj6.fsf@Rainer.invalid> <0107427b-3af6-739d-fe6e-5ad14a9c0708@SystematicSw.ab.ca>
, On 24 May 2017 at 18:16, Brian Inglis wrote:
> I would appreciate it if anyone has any experience with, or can point me
> to, any python3 code in any Cygwin package which works Windows proxy
> authentication?
I had a glance at the source. I recall adapting it to load SQL tables
with units data. I recall writing code very similar to that in the
units_cur{2|3} python sources to keep the table current.
units_cur2 is the python2 version, units_cur3 is the python3 version
of the updater.
It is using the urllib and ElementTree packages which are parts of the
standard python release.
A possibly more featureful replacement for urllib is the requests
package, available in the cygwin packages python2-requests and
python3-requests. See http://docs.python-requests.org/en/master/ for
the documentation. It claims "HTTP(S) Proxy Support" however I have
not used that feature.
There are two similar lines that use urllib:
... urllib.request.urlopen('URL1>') ...
... urllib.request.urlopen('<URL2>?f=xml') ...
Using requests, they become:
... requests.get('<URL1>').text ...
... requests.get('<URL2>', params={'f':'xml'}).text ...
Some additional code is required to support proxies, but I can't help
much there.
See http://docs.python-requests.org/en/master/user/advanced/#proxies for info.
HTH
Doug
--
Doug Henderson, Calgary, Alberta, Canada - from gmail.com