Testing an app protected by Okta authorization code with PKCE flow

2022-04-29 Thread George Fischhof
Hi Folks,

has anyone of you a working solution for testing an app protected by Okta
authorization code with PKCE flow?
Meaning to get a bearer token?

I saw / read several articles about it on the net, and several hacks (that
is not problem now ;) ), but it seems that neither of them works with Okta.

We are using Okta's .net backend stuff and Angular widget

BR,
George
-- 
https://mail.python.org/mailman/listinfo/python-list


Instatiating module / Reusing module of command-line tool

2022-04-29 Thread Loris Bennett
Hi,

I have a command-line script in Python to get the correct salutation for
a user name in either English or German from a 'salutation server':

  $ get_salutation alice
  Dear Professor Müller
  $ get_salutation alice -l de
  Sehr geehrte Frau Professorin Müller

The hostname, port, user and password for the 'salutation server' can be
given as options on the command-line, but if omitted are read from a
configuration file.  The program is implemented in two modules without
any classes:

  main.py:

... parse command-line options, read config file  ...

salutation = my_mailer.salutations.get_salutation(args.user,
  args.lang,
  args.host,
  args.port,
  args.user,
  args.secret)

  salutations.py

def get_salutation(uid, lang, host, port, user, secret):
...

I have another program that is intended to run as a cron job and send an
email to certain users.  This is implemented as a number of modules
without any classes and will need to use the 'get_salutation' function
from the first module.

My question: What is the analogue to initialising an object via the
constructor for a module?

My understanding is that a module is a singleton of the class 'module'.
So do I just write a method which reads the config file, or is there
some more standardised way which corresponds to instantiating an object
via

  my_object = MyClass()

in the case of a class.

Cheers,

Loris

-- 
This signature is currently under construction.
-- 
https://mail.python.org/mailman/listinfo/python-list


Match.groupdict: Meaning of default argument?

2022-04-29 Thread Loris Bennett
Hi,

If I do

  import re
  pattern = 
re.compile(r'(?P\d*)(-?)(?P\d\d):(?P\d\d):(?P\d\d)')
  s = '104-02:47:06'
  match = pattern.search(s)
  match_dict = match.groupdict('0')

I get 

  match_dict
  {'days': '104', 'hours': '02', 'minutes': '47', 'seconds': '06'}

However, if the string has no initial part (corresponding to the number of
days), e.g.

  s = '02:47:06'
  match = pattern.search(s)
  match_dict = match.groupdict('0')

I get

  match_dict
  {'days': '', 'hours': '02', 'minutes': '47', 'seconds': '06'}

I thought that 'days' would default to '0'.

What am I doing wrong?

Cheers,

Loris
-- 
This signature is currently under construction.
-- 
https://mail.python.org/mailman/listinfo/python-list