Re: all versions of python fail to indent after conditional statement

2021-04-10 Thread Russell via Python-list
I would recommend reading a book that introduces and explains Python
rather than just diving in. I'm been enjoying "Introducing Python:
Modern Computing in Simple Packages" which can be found at
https://amzn.com/1492051365. It started from the beginning and would
answer the questions/difficulties you've raised here. It would help set
you on your quest to master Python.

mikedianete...@gmail.com wrote:
> 
> 
>The following snap shot of system prompt illustrates my problem. I have
>tried 3.8, 3.92 and 3.10 with the same result. When I run in the window
>interface it doesn't even display one row of ... but does print if I hit
>return twice. I'm new to Python and was excited about learning it but am
>becoming very frustrated over a bug in such a simple conditional statement
>- please help as I would really like to master Python.
> 
>Regards,
> 
>Michael Terry
> 
> 
> 
>Microsoft Windows [Version 10.0.19041.867]
> 
>(c) 2020 Microsoft Corporation. All rights reserved.
> 
>C:\WINDOWS\system32>py
> 
> 
> 
>Python 3.8.8 (tags/v3.8.8:024d805, Feb 19 2021, 13:18:16) [MSC v.1928 64
>bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for
>more information.
> 
> 
> 
>>>> dog_has_fleas=True
> 
>>>> if dog_has_fleas:
> 
>... print('too bad')
> 
>  File "", line 2
> 
>print('too bad')
> 
>^
> 
>IndentationError: expected an indented block
> 
>>>> Microsoft Windows [Version 10.0.19041.867]
> 
> 
> 
> 
> 
>Sent from [1]Mail for Windows 10
> 
> 
> 
> References
> 
>Visible links
>1. https://go.microsoft.com/fwlink/?LinkId=550986

-- 
rust
0x68caecc97f6a90122e51c0692c88d9cb6b58a3dc
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Ann: New Python curses book

2021-04-10 Thread Russell via Python-list
I believe this is it:
https://www.amazon.com/dp/B091CL3DTK/ref=cm_sw_su_dp

But for some reason the ASIN is different.

William Ray Wing  wrote:
> I???ve ordered the book (physical volume). It will fulfill a need I???ve had 
> for some time.  Unfortunately, it is only available in the UK store, so the 
> shipping cost by far outweighs the book???s cost.  Hope for other???s sake, 
> it migrates to the other Amazon stores fairly quickly.
> 
> Thanks,
> Bill
> 
>> On Mar 30, 2021, at 7:12 AM, Alan Gauld via Python-list 
>>  wrote:
>> 
>> I've just published, in Kindle and paperback formats,
>> my book on "Programming curses with Python".
>> 
>> https://www.amazon.co.uk/dp/B091B85B77/
>> 
>> (It should be available in most other Amazon stores too)
> 

-- 
rust
0x68caecc97f6a90122e51c0692c88d9cb6b58a3dc
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: question about basics of creating a PROXY to MONITOR network activity

2021-04-10 Thread Paul Bryan
Cloudflare operates as a reverse proxy in front of your service(s);
clients of your services access them through an endpoint that
Cloudflare stands up. DNS records point to Cloudflare, and TLS
certificates must be provisioned in Cloudflare to match. For all
intents and purposes, you would be outsourcing a part of your service
network infrastructure to Cloudflare.

Paul 

On Sat, 2021-04-10 at 13:35 -0500, Christian Seberino wrote:
> > 
> > a) your reverse proxy must be colocated with the service it fronts
> > on the same machine;
> > b) your network infrastructure transparently encrypts traffic
> > between your proxy and the service; or 
> > c) your proxy must negotiate its own TLS connection(s) with the
> > service.
> > 
> 
> 
> Paul
> 
> Thanks. I'm curious, do you know which of your options CloudFlare
> uses?  It has to stand in between
> you and all the sites you visit while allowing encryption right?
> 
> cs 

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: question about basics of creating a PROXY to MONITOR network activity

2021-04-10 Thread Christian Seberino
>
>
> a) your reverse proxy must be colocated with the service it fronts on the
> same machine;
> b) your network infrastructure transparently encrypts traffic between your
> proxy and the service; or
> c) your proxy must negotiate its own TLS connection(s) with the service.
>

Paul

Thanks. I'm curious, do you know which of your options CloudFlare uses?  It
has to stand in between
you and all the sites you visit while allowing encryption right?

cs
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: question about basics of creating a PROXY to MONITOR network activity

2021-04-10 Thread Michael Torrie
On 4/10/21 8:52 AM, cseb...@gmail.com wrote:
> 
>> Is it even possible to be secure in that way? This is, by definition, 
>> a MITM, and in order to be useful, it *will* have to decrypt 
>> everything. So if someone compromises the monitor, they get 
>> everything. 
> 
> Chris
> 
> I hear all your security concerns and I'm aware of them.  I *really* don't 
> want to have to
> fight SSL.  Encryption was the biggest concern and I'd rather not mess with 
> it to do something 
> useful.
> 
> I've never used CloudFlare but if I'm not mistaken, it can be considered a 
> useful "MITM" service?
> Do they have to decrypt traffic and increase the attack surface to be useful?

Cloudfare does not do any kind of MITM stuff.  Cloudfare requires some
set up on the part of the server owner, and that takes several forms.
One recommended method is have Cloudfare sign a special certificate that
you install on your web server, which encrypts between your server and
Cloudfare.  Then you provide cloudfare with an SSL certificate and key
to use when they serve up your site to the world.

> I just want to create a "safe" MITM service so to speak.

For my own purposes, sometimes I'll create a limited, wildcard
certificate signed by my own authority which works only in my own
browser (this is the same technique used by certain regimes to MITM the
entire country!).  The proxy then uses that certificate.  It's useful
for some debugging tasks.  Or alternatively I'll create a proxy intended
to run on localhost only that proxies an encrypted source to a local,
non-encrypted channel.  For example, I might want to examine why a
connection to an IMAPS port is failing.  So I'll proxy IMAPS to IMAP so
I can sniff the IMAP locally to find out why the interaction is failing.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: question about basics of creating a PROXY to MONITOR network activity

2021-04-10 Thread Paul Bryan
There is absolutely nothing wrong with building your own reverse proxy
in front of your own service, as long as you control both. This
constitutes a tiered network/application architecture, and it's a
common practice. There's no man in the middle; there's no imposter; its
all "you". 

If your proxy becomes the endpoint that clients now must connect to
(i.e. nothing "in front" of your new proxy), you will have to deal with
TLS (aka SSL). Having the TLS certificate match the DNS address of your
new endpoint is a central tenet of security, and allows clients to
trust that they are connecting to the intended endpoint (there is
not a man in the middle).

How you secure the network traffic between your proxy and the service
it fronts becomes an important factor. If you claim that data is always
encrypted in transit, then either:

a) your reverse proxy must be colocated with the service it fronts on
the same machine;
b) your network infrastructure transparently encrypts traffic between
your proxy and the service; or 
c) your proxy must negotiate its own TLS connection(s) with the
service.

Negotiating TLS connections independently for each hop through a
network will add overhead, and degrade the performance of your service.
This can be major pain point when composing an application of
microservices, where each service must be able to securely connect to
another over a network. This is where a service mesh proxy (e.g. Envoy)
comes into play, or even full blown service mesh with service
discovery, certificate management, access policies (e.g. Istio). 


On Sat, 2021-04-10 at 07:52 -0700, cseb...@gmail.com wrote:
> 
> > Is it even possible to be secure in that way? This is, by
> > definition, 
> > a MITM, and in order to be useful, it *will* have to decrypt 
> > everything. So if someone compromises the monitor, they get 
> > everything. 
> 
> Chris
> 
> I hear all your security concerns and I'm aware of them.  I *really*
> don't want to have to
> fight SSL.  Encryption was the biggest concern and I'd rather not
> mess with it to do something 
> useful.
> 
> I've never used CloudFlare but if I'm not mistaken, it can be
> considered a useful "MITM" service?
> Do they have to decrypt traffic and increase the attack surface to be
> useful?
> 
> I just want to create a "safe" MITM service so to speak.
> 
> cs

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: question about basics of creating a PROXY to MONITOR network activity

2021-04-10 Thread cseb...@gmail.com


> Is it even possible to be secure in that way? This is, by definition, 
> a MITM, and in order to be useful, it *will* have to decrypt 
> everything. So if someone compromises the monitor, they get 
> everything. 

Chris

I hear all your security concerns and I'm aware of them.  I *really* don't want 
to have to
fight SSL.  Encryption was the biggest concern and I'd rather not mess with it 
to do something 
useful.

I've never used CloudFlare but if I'm not mistaken, it can be considered a 
useful "MITM" service?
Do they have to decrypt traffic and increase the attack surface to be useful?

I just want to create a "safe" MITM service so to speak.

cs
-- 
https://mail.python.org/mailman/listinfo/python-list


PyDev 8.3.0 Released

2021-04-10 Thread Fabio Zadrozny
PyDev 8.3.0 Release Highlights

   -

   *Java 11* is now required to run PyDev.
   -

   *External linters*
   - Configurations of the linters can be saved to the project or user
  settings.
  - Flake8 has a more flexible UI for configuration.
   -

   *Others*
   - Option to add comments all at a single indent (note: this is now the
  default).
  - LRU for context-insensitive completion/quick fix.
  - Fixed some code-completion cases where *self* was wrongly added.
  - Environment variables are now supported in *.pydevproject*
  (expected format: *${env_var:VAR_NAME}*).

About PyDev

PyDev is an open-source Python IDE on top of Eclipse for Python, Jython and
IronPython development, now also available for Python on Visual Studio Code.

It comes with goodies such as code completion, syntax highlighting, syntax
analysis, code analysis, refactor, debug, interactive console, etc.

It is also available as a standalone through LiClipse with goodies such as
multiple cursors, theming and support for many other languages, such as
Django Templates, Jinja2, Html, JavaScript, etc.

Links:

PyDev: http://pydev.org
PyDev Blog: http://pydev.blogspot.com
PyDev on VSCode: http://pydev.org/vscode
LiClipse: http://www.liclipse.com
PyVmMonitor - Python Profiler: http://www.pyvmmonitor.com/

Cheers,

Fabio Zadrozny
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: HELP Please, Python Program Help

2021-04-10 Thread dn via Python-list
On 10/04/2021 22.57, Joseph Roffey wrote:
> Hi, Im looking for some help with my program, I have been set a task to make 
> a Strain Calculator. I need it to input two numbers, choosing either Metres 
> or Inches for the 'Change in Length' divided by the 'Original Length' which 
> can also be in Metres or Inches, the out put number also needs to give an 
> option for the answer to be in metres or inches.
> 
> this is what i have come up with so far...

What is the problem?


> txt = "Strain Calculator"
> x = txt.title()

what is the above/


> print(x)
> 
> # This function divides two numbers
> def divide(x, y):
>   return x / y

Why use a function instead of operating in-line?

-- 
Regards,
=dn
-- 
https://mail.python.org/mailman/listinfo/python-list


HELP Please, Python Program Help

2021-04-10 Thread Joseph Roffey
Hi, Im looking for some help with my program, I have been set a task to make a 
Strain Calculator. I need it to input two numbers, choosing either Metres or 
Inches for the 'Change in Length' divided by the 'Original Length' which can 
also be in Metres or Inches, the out put number also needs to give an option 
for the answer to be in metres or inches.

this is what i have come up with so far...


txt = "Strain Calculator"
x = txt.title()
print(x)

# This function divides two numbers
def divide(x, y):
return x / y

print("Select operation.")
print("1.Strain")

while True:
# Take input from the user
choice = input("Enter choice(1): ")

# Check if choice is one of the five options
if choice in ('1'):
num1 = float(input("Change in Length: "))
num2 = float(input("Original Length: "))

if choice == '1':
 print(num1, "/", num2, "=", divide(num1, num2)) 
break
else:
print("Invalid Input")


-- 
https://mail.python.org/mailman/listinfo/python-list