semvec/pypi-packages huggingface dataset:
string-between 0.0.7
TBA
License: MIT
Requires Python: >=2.7

string_between

Using string_between
====================

.. code-block:: python

    from string_between import string_between
    
    # syntax
    string_between(left, right, subject, [,start [,end]] [,greedy=False] [,inclusive=False] [,repl=None] [,retn_all_on_fail=False] [,retn_class=False] [,rightmost=False]) -> str

    Return the substring delineated by `left` and `right` within the search
    space subject[start:end].  Optional default_arguments `start` and `end` 
    are interpreted as per slice notation.
    
    Return the string between `left` and `right` or empty string on failure

    @param left str|re|list: left anchor, or '' for start of subject; regex must be compiled
    @param right str|re|list: right anchor, or '' for end of subject; regex must be compiled
    @param subject: string to be searched
    @param start: start index for search
    @param end: start and end are interpreted as in slice notation.
    @param greedy: match biggest substring possible
    @param inclusive: include anchors in result
    @param repl [str|callable]: replace matched substring with repl in result
    @param retn_all_on_fail: return original string if match not made
    @param retn_class: return result as StringBetweenResult object
    @param rightmost: match rightmost substring, possible by greedily searching for `left`; implies `greedy`
    @return matched substring | original string | empty | StringBetweenResult object
    
    Note: regular expressions must be compiled

    If left and right are lists, then string_between() takes a value from
    each list and uses them as left and right on subject. If right has
    fewer values than left, then an empty string is used for the rest of
    replacement values. The converse applies. If left is a list and right 
    is a string, then this replacement string is used for every value of left. 
    The converse also applies.

    Examples:
    ---------

    >>> s = 'The *quick* brown [fox] jumps _over_ the **lazy** [dog]'
    >>> string_between('[', ']', s)
    'fox'

    >>> string_between('[', ']', s, inclusive=True)
    '[fox]'

    >>> string_between('[', ']', s, rightmost=True)
    'dog'

    >>> string_between('[', ']', s, inclusive=True, greedy=True)
    '[fox] jumps _over_ the **lazy** [dog]'
    
    > b'result'

Changelog
=========

0.0.1: initial release (2021-09-07)

0.0.6: many things since then (2020-09-16)
django-google-oauth-rest 1.0
"Django Google auth"
License: MIT
Requires Python: >=3
Keywords: django google auth oauth

**Django Google Auth**
======================

This project help with Google Authentication flow when you prefer API
approach. It uses existing User model in your database and no other
tables are created. It also lets you modify parameters based on your
business logic and current authentication flow.

**Quick Start**
---------------

1. Add “google_auth” to your INSTALLED_APPS setting like this:

.. code-block:: python

    INSTALLED_APPS = [
        ...
        'google_auth',
    ]

2. Add “email” field to your user table if it doesn’t already exist.

3. (OPTIONAL) To have user retrieved info saved in your add these fields
   to your user table:

   -  given_name
   -  family_name

4. Add a new url to your projects url.py like this:

.. code-block:: python

   re_path('auth/url', views.AuthURL.as_view(), name="auth_url")

5. Create a new view which is a subclass of ‘**AuthCallback**’ like
   this:
   
.. code-block:: python

   class CallbackView(AuthCallback):
      def get(self, request):
         user = super(CallbackView, self).get(request)         
         # create new token and authenticate user. Return token and required parameters here``

6. Add another new url to your projects url.py like this:

.. code-block:: python

   re_path('auth/calback', views.CallbackView.as_view(), name="auth_calback_url")

**Configuration parameter**
---------------------------

-  AUTH_USER_MODEL: Authentication user table in your models
-  CLIENT_ID: Retrieved from Google console
-  CLIENT_SECRET: Retrieved from Google console
-  REDIRECT_URI: Redirect url same as redirect url in google console
   (Usually it should route to your front-end url)
-  VALIDATE_STATE: (OPTIONAL) state is a server side generated security
   feature suggested by google. It will be saved in session. default
   value it True. If set to False it will bypass this security check.
-  SET_REGISTER_USER_FIELD: (OPTIONAL) If you want to set some value in
   User table after login/register process is successful, you can set it
   here. In example below, we set user verified field to True when
   login/register process is successful:
   
   .. code-block:: python
   
      SET_REGISTER_USER_FIELD = {
        "verified": True
      }
      
-  USER_INFO_REQUEST_URI: (OPTIONAL) Google verification url. Should be
   fine with default value.

**URLs Flow**
--------------

1. First call ‘auth/url’ by POST(Empty body) or GET Method.

   -  GET method will return generated URL in JSON response. Your front
      end should redirect to this URL.
   -  POST method will return 302 status code with redirect url.

2. After redirecting to received URL from step 1, user can verify from
   Google. If verification is successful Google will call your
   redirect_uri.
3. when redirect_uri is called your frontend should call the Callback
   url you already created (step 6 in Quick start).

   -  IMPORTANT: You must add all query params received from Google in
      this step to ‘auth/callback’ as query params.