semvec/pypi-packages huggingface dataset:
sbcli-doc 1.0.0
CLI for managing SimplyBlock cluster


# Simply Block
[![Docker Image Build](https://github.com/simplyblock-io/sbcli/actions/workflows/docker-image.yml/badge.svg)](https://github.com/simplyblock-io/sbcli/actions/workflows/docker-image.yml)

[![Python Unit Testing](https://github.com/simplyblock-io/sbcli/actions/workflows/python-testing.yml/badge.svg)](https://github.com/simplyblock-io/sbcli/actions/workflows/python-testing.yml)

 
## Install
Add the package repo from AWS CodeArtifact using [awscli](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)

```bash
aws codeartifact login --tool pip --repository sbcli --domain simplyblock --domain-owner 565979732541 --region eu-west-1
```
Install package
```bash
pip install --extra-index-url https://pypi.org/simple sbcli-dev
```

# Components 

## Simply Block Core
Contains core logic and controllers for the simplyblock cluster

## Simply Block CLI
Please see this document 
[README.md](../main/simplyblock_cli/README.md)


## Simply Block Web API
Please see this document 
[README.md](../main/simplyblock_web/README.md)
django-oauth-emailbackend 0.1.6
Django emailbackend that using OAuth Gmail API or SMTP server.
Requires Python: >=3.9

# django-oauth-emailbackend
Django emailbackend that using OAuth Gmail API or SMTP server. 


## Installation

First, install the python package.

```
pip install django-oauth-emailbackend
```

Then, add the following to the `settings.py` of your project:

```
INSTALLED_APPS = [
    ...
    'django.contrib.sites',
    'oauth_emailbackend',
    ...
]

#----- django-oauth-emailbackend settings -----#
# EMAIL_BACKEND를 OAuthEmailBackend 설정 
# Celery를 이용하여 발송하는 경우 CELERY_BROKER_URL 값을 설정하여야 합니다.
EMAIL_BACKEND                = 'oauth_emailbackend.backends.OAuthEmailBackend'

# 발송내역을 저장할 DATABASE_NAME
OAUTH_EMAILCLIENT_DBNAME     = 'default'

# OAuth 목록 
OAUTH_EMAILBACKEND_PROVIDERS = (
    'oauth_emailbackend.providers.gmail',
)
# 콜백 도메인을 현재 사이트 도메인과 다르게 지정하려면 설정. 예) https://domain.to
OAUTH_EMAILBACKEND_CALLBACK_HOST    = None
OAUTH_EMAILBACKEND_USE_CELERY       = True
OAUTH_EMAILBACKEND_CELERY_MAX_RETRY = 3 # default=3
# OS SMTP server name
OAUTH_EMAILBACKEND_MTA              = 'postfix' # [None|postfix]


#----- celery settings -----#
# Celery를 이용하여 발송할 경우 CELERY_BROKER_URL 세팅 
CELERY_BROKER_URL = "<broker url for celery>"
#
# * Test run celery in localhost
# celery -A config worker -l info -E

```

Additionally, add this to your project urls.py:

```
urlpatterns = [
    ...
    # Add OAuth Emailbackend urls
    path('oauth_emailbackend/', include('oauth_emailbackend.urls')),
    ...
]
```

## Post-Installation

In your Django root execute the command below to create your database tables:

`python manage.py migrate`


## Register API client on the admin page

Visit `https://<host>/admin/oauth_emailbackend/oauthapi/` and 
add OAuth API and Email Client app sequentially.

## Test

```
from django.core.mail import send_mail

send_mail("Subject here",  
            "Here is the message.", 
            "<sender-email-address>", 
            ["<recipient-email-address>"],
            fail_silently=False)
```


## Providers

### Gmail

- `https://developers.google.com/gmail/api/guides`
- `https://console.cloud.google.com/` API 개설
- 사용자 인증 정보 에서 `OAuth 2.0 클라이언트 ID` 생성 
- OAuth 동의 화면 구성 
- **승인된 리디렉션 URI**에는 `https://<host>/oauth_emailbackend/oauth2callback/gmail`을 입력