Skip to content

Commit

Permalink
Update README.md and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dormant-user committed Oct 26, 2023
1 parent a37a6c9 commit 23f6377
Show file tree
Hide file tree
Showing 11 changed files with 363 additions and 107 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

[![pages-build-deployment](https://github.com/thevickypedia/gmail-connector/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/thevickypedia/gmail-connector/actions/workflows/pages/pages-build-deployment)
[![pypi-publish](https://github.com/thevickypedia/gmail-connector/actions/workflows/python-publish.yml/badge.svg)](https://github.com/thevickypedia/gmail-connector/actions/workflows/python-publish.yml)
[![none-shall-pass](https://github.com/thevickypedia/gmail-connector/actions/workflows/markdown-validation.yml/badge.svg)](https://github.com/thevickypedia/gmail-connector/actions/workflows/markdown-validation.yml)

[![Pypi-format](https://img.shields.io/pypi/format/gmail-connector)](https://pypi.org/project/gmail-connector/#files)
[![Pypi-status](https://img.shields.io/pypi/status/gmail-connector)](https://pypi.org/project/gmail-connector)
Expand Down
1 change: 0 additions & 1 deletion doc_generator/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import os
import sys

sys.path.insert(0, os.path.abspath('../gmailconnector'))
sys.path.insert(0, os.path.abspath('..'))

# -- Project information -----------------------------------------------------
Expand Down
27 changes: 17 additions & 10 deletions docs/README.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ <h3>Navigation</h3>
<p><a class="reference external" href="https://pypi.org/project/gmail-connector"><img alt="Pypi-version" src="https://img.shields.io/pypi/v/gmail-connector" /></a>
<a class="reference external" href="https://www.python.org/"><img alt="Python" src="https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10-blue" /></a></p>
<p><a class="reference external" href="https://github.com/thevickypedia/gmail-connector/actions/workflows/pages/pages-build-deployment"><img alt="pages-build-deployment" src="https://github.com/thevickypedia/gmail-connector/actions/workflows/pages/pages-build-deployment/badge.svg" /></a>
<a class="reference external" href="https://github.com/thevickypedia/gmail-connector/actions/workflows/python-publish.yml"><img alt="pypi-publish" src="https://github.com/thevickypedia/gmail-connector/actions/workflows/python-publish.yml/badge.svg" /></a></p>
<a class="reference external" href="https://github.com/thevickypedia/gmail-connector/actions/workflows/python-publish.yml"><img alt="pypi-publish" src="https://github.com/thevickypedia/gmail-connector/actions/workflows/python-publish.yml/badge.svg" /></a>
<a class="reference external" href="https://github.com/thevickypedia/gmail-connector/actions/workflows/markdown-validation.yml"><img alt="none-shall-pass" src="https://github.com/thevickypedia/gmail-connector/actions/workflows/markdown-validation.yml/badge.svg" /></a></p>
<p><a class="reference external" href="https://pypi.org/project/gmail-connector/#files"><img alt="Pypi-format" src="https://img.shields.io/pypi/format/gmail-connector" /></a>
<a class="reference external" href="https://pypi.org/project/gmail-connector"><img alt="Pypi-status" src="https://img.shields.io/pypi/status/gmail-connector" /></a>
<a class="reference external" href="https://github.com/thevickypedia/gmail-connector/network/dependents"><img alt="dependents" src="https://img.shields.io/librariesio/dependents/pypi/gmail-connector" /></a></p>
Expand All @@ -69,21 +70,27 @@ <h2>Installation<a class="headerlink" href="#installation" title="Permalink to t
<section id="env-vars">
<h2>Env Vars<a class="headerlink" href="#env-vars" title="Permalink to this heading"></a></h2>
<p>Environment variables can be loaded from any <code class="docutils literal notranslate"><span class="pre">.env</span></code> file.</p>
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="c1"># For authentication</span>
<span class="nv">GMAIL_USER</span><span class="o">=</span><span class="s1">&#39;[email protected]&#39;</span>,
<div class="highlight-bash notranslate"><div class="highlight"><pre><span></span><span class="nv">GMAIL_USER</span><span class="o">=</span><span class="s1">&#39;[email protected]&#39;</span>,
<span class="nv">GMAIL_PASS</span><span class="o">=</span><span class="s1">&#39;&lt;ACCOUNT_PASSWORD&gt;&#39;</span>

<span class="c1"># For outbound SMS</span>
<span class="nv">PHONE</span><span class="o">=</span><span class="s1">&#39;1234567890&#39;</span>
</pre></div>
</div>
<p><em>Optionally <code class="docutils literal notranslate"><span class="pre">.env</span></code> files can also be scanned for:</em></p>
<details>
<summary><strong>Env variable customization</strong></summary><p>To load a custom <code class="docutils literal notranslate"><span class="pre">.env</span></code> file, set the filename as the env var <code class="docutils literal notranslate"><span class="pre">env_file</span></code> before importing <code class="docutils literal notranslate"><span class="pre">gmailconnector</span></code></p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">os</span>
<span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">&#39;env_file&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;custom&#39;</span> <span class="c1"># to load a custom .env file</span>
<span class="kn">import</span> <span class="nn">gmailconnector</span> <span class="k">as</span> <span class="nn">gc</span>
</pre></div>
</div>
<p>To avoid using env variables, arguments can be loaded during object instantiation.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">gmailconnector</span> <span class="k">as</span> <span class="nn">gc</span>

<span class="n">gc</span><span class="o">.</span><span class="n">load_env</span><span class="p">(</span><span class="n">scan</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">kwargs</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span><span class="n">gmail_user</span><span class="o">=</span><span class="s1">&#39;EMAIL_ADDRESS&#39;</span><span class="p">,</span>
<span class="n">gmail_pass</span><span class="o">=</span><span class="s1">&#39;PASSWORD&#39;</span><span class="p">,</span>
<span class="n">encryption</span><span class="o">=</span><span class="n">gc</span><span class="o">.</span><span class="n">Encryption</span><span class="o">.</span><span class="n">SSL</span><span class="p">,</span>
<span class="n">timeout</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
<span class="n">email_obj</span> <span class="o">=</span> <span class="n">gc</span><span class="o">.</span><span class="n">SendEmail</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</pre></div>
</div>
</section>
</details></section>
<section id="usage">
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this heading"></a></h2>
<section id="send-sms">
Expand Down
24 changes: 17 additions & 7 deletions docs/_sources/README.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

[![pages-build-deployment](https://github.com/thevickypedia/gmail-connector/actions/workflows/pages/pages-build-deployment/badge.svg)](https://github.com/thevickypedia/gmail-connector/actions/workflows/pages/pages-build-deployment)
[![pypi-publish](https://github.com/thevickypedia/gmail-connector/actions/workflows/python-publish.yml/badge.svg)](https://github.com/thevickypedia/gmail-connector/actions/workflows/python-publish.yml)
[![none-shall-pass](https://github.com/thevickypedia/gmail-connector/actions/workflows/markdown-validation.yml/badge.svg)](https://github.com/thevickypedia/gmail-connector/actions/workflows/markdown-validation.yml)

[![Pypi-format](https://img.shields.io/pypi/format/gmail-connector)](https://pypi.org/project/gmail-connector/#files)
[![Pypi-status](https://img.shields.io/pypi/status/gmail-connector)](https://pypi.org/project/gmail-connector)
Expand All @@ -27,20 +28,29 @@ pip install gmail-connector
## Env Vars
Environment variables can be loaded from any `.env` file.
```bash
# For authentication
GMAIL_USER='[email protected]',
GMAIL_PASS='<ACCOUNT_PASSWORD>'

# For outbound SMS
PHONE='1234567890'
```

*Optionally `.env` files can also be scanned for:*
<details>
<summary><strong>Env variable customization</strong></summary>

To load a custom `.env` file, set the filename as the env var `env_file` before importing `gmailconnector`
```python
import os
os.environ['env_file'] = 'custom' # to load a custom .env file
import gmailconnector as gc

gc.load_env(scan=True)
```
To avoid using env variables, arguments can be loaded during object instantiation.
```python
import gmailconnector as gc
kwargs = dict(gmail_user='EMAIL_ADDRESS',
gmail_pass='PASSWORD',
encryption=gc.Encryption.SSL,
timeout=5)
email_obj = gc.SendEmail(**kwargs)
```
</details>

## Usage
### [Send SMS](https://github.com/thevickypedia/gmail-connector/blob/master/gmailconnector/send_sms.py)
Expand Down
Loading

0 comments on commit 23f6377

Please sign in to comment.