-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
12 changed files
with
61 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ pip install gmail-connector | |
``` | ||
|
||
## Env Vars | ||
Environment variables can be loaded from a `.env` file. | ||
Environment variables can be loaded from any `.env` file. | ||
```bash | ||
# For authentication | ||
GMAIL_USER='[email protected]', | ||
|
@@ -38,6 +38,13 @@ RECIPIENT='[email protected]' | |
PHONE='1234567890' | ||
``` | ||
|
||
*Optionally `.env` files can also be scanned for:* | ||
```python | ||
import gmailconnector as gc | ||
|
||
gc.load_env(scan=True) | ||
``` | ||
|
||
### [Send SMS](https://github.com/thevickypedia/gmail-connector/blob/master/gmailconnector/send_sms.py) | ||
```python | ||
import gmailconnector as gc | ||
|
@@ -84,8 +91,7 @@ print(response.body) | |
```python | ||
import gmailconnector as gc | ||
|
||
email_addr = '[email protected]' | ||
validation_result = gc.validate_email(email_address=email_addr) | ||
validation_result = gc.validate_email(email_address='[email protected]') | ||
if validation_result.ok is True: | ||
print('valid') # Validated and found the recipient address to be valid | ||
elif validation_result.ok is False: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,7 @@ <h2>Installation<a class="headerlink" href="#installation" title="Permalink to t | |
</section> | ||
<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 a <code class="docutils literal notranslate"><span class="pre">.env</span></code> file.</p> | ||
<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">'[email protected]'</span>, | ||
<span class="nv">GMAIL_PASS</span><span class="o">=</span><span class="s1">'<ACCOUNT_PASSWORD>'</span> | ||
|
@@ -80,6 +80,12 @@ <h2>Env Vars<a class="headerlink" href="#env-vars" title="Permalink to this head | |
<span class="nv">PHONE</span><span class="o">=</span><span class="s1">'1234567890'</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> | ||
<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> | ||
</pre></div> | ||
</div> | ||
<section id="send-sms"> | ||
<h3><a class="reference external" href="https://github.com/thevickypedia/gmail-connector/blob/master/gmailconnector/send_sms.py">Send SMS</a><a class="headerlink" href="#send-sms" title="Permalink to this heading">¶</a></h3> | ||
<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> | ||
|
@@ -127,8 +133,7 @@ <h3><a class="reference external" href="https://github.com/thevickypedia/gmail-c | |
<p><strong>To verify recipient email before sending. Authentication not required, uses SMTP port <code class="docutils literal notranslate"><span class="pre">25</span></code></strong></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">email_addr</span> <span class="o">=</span> <span class="s1">'[email protected]'</span> | ||
<span class="n">validation_result</span> <span class="o">=</span> <span class="n">gc</span><span class="o">.</span><span class="n">validate_email</span><span class="p">(</span><span class="n">email_address</span><span class="o">=</span><span class="n">email_addr</span><span class="p">)</span> | ||
<span class="n">validation_result</span> <span class="o">=</span> <span class="n">gc</span><span class="o">.</span><span class="n">validate_email</span><span class="p">(</span><span class="n">email_address</span><span class="o">=</span><span class="s1">'[email protected]'</span><span class="p">)</span> | ||
<span class="k">if</span> <span class="n">validation_result</span><span class="o">.</span><span class="n">ok</span> <span class="ow">is</span> <span class="kc">True</span><span class="p">:</span> | ||
<span class="nb">print</span><span class="p">(</span><span class="s1">'valid'</span><span class="p">)</span> <span class="c1"># Validated and found the recipient address to be valid</span> | ||
<span class="k">elif</span> <span class="n">validation_result</span><span class="o">.</span><span class="n">ok</span> <span class="ow">is</span> <span class="kc">False</span><span class="p">:</span> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ pip install gmail-connector | |
``` | ||
|
||
## Env Vars | ||
Environment variables can be loaded from a `.env` file. | ||
Environment variables can be loaded from any `.env` file. | ||
```bash | ||
# For authentication | ||
GMAIL_USER='[email protected]', | ||
|
@@ -38,6 +38,13 @@ RECIPIENT='[email protected]' | |
PHONE='1234567890' | ||
``` | ||
|
||
*Optionally `.env` files can also be scanned for:* | ||
```python | ||
import gmailconnector as gc | ||
|
||
gc.load_env(scan=True) | ||
``` | ||
|
||
### [Send SMS](https://github.com/thevickypedia/gmail-connector/blob/master/gmailconnector/send_sms.py) | ||
```python | ||
import gmailconnector as gc | ||
|
@@ -84,8 +91,7 @@ print(response.body) | |
```python | ||
import gmailconnector as gc | ||
|
||
email_addr = '[email protected]' | ||
validation_result = gc.validate_email(email_address=email_addr) | ||
validation_result = gc.validate_email(email_address='[email protected]') | ||
if validation_result.ok is True: | ||
print('valid') # Validated and found the recipient address to be valid | ||
elif validation_result.ok is False: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters