This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: units issues


, 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]