Skip to content
This repository has been archived by the owner on Jul 22, 2023. It is now read-only.

Commit

Permalink
update notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Aug 20, 2016
1 parent 304fb2c commit fa348b0
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 93 deletions.
184 changes: 92 additions & 92 deletions _doc/notebooks/send_email.ipynb
Original file line number Diff line number Diff line change
@@ -1,97 +1,97 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Send email"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"with open(\"erty.txt\", \"w\") as f : f.write(\"try.try.try\")"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import pymmails"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"server = pymmails.create_smtp_server(\"gmail\", \"xavier.somebody@gmail.com\", \"pwd\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In fonction create_smtp_server, the string ``gmail`` is replaced by ``smtp.gmail.com:567`` (tls version). By default, the server cannot be accessed unless IMAP is enabled (see [Problems sending mail with POP or IMAP](https://support.google.com/mail/answer/78775)). You can usually find this string by searching on internet for ``your provider smtp server``, you find pages such as [configuration des serveurs sortants et entrants des principaux comptes mails](http://assistance.orange.fr/configuration-des-serveurs-sortants-et-entrants-des-principaux-comptes-mails-1222.php). However, by doing this, you need to send your password. You should remove your password wherever it appears as soon as you don't need it anymore. If you forget, I advise you to change it."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"pymmails.send_email(server, \"xavier.somebody@gmail.com\", \"xavier.somebodyelse@else.com\",\n",
" \"results\", \"body\", attachements = [ \"erty.txt\" ])"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
"cells": [
{
"data": {
"text/plain": [
"(221, b'2.0.0 closing connection e18sm17176289wjz.27 - gsmtp')"
"cell_type": "markdown",
"metadata": {},
"source": [
"# Send email"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"with open(\"erty.txt\", \"w\") as f : f.write(\"try.try.try\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import pymmails"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"server = pymmails.create_smtp_server(\"gmail\", \"xavier.somebody@gmail.com\", \"pwd\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In fonction create_smtp_server, the string ``gmail`` is replaced by ``smtp.gmail.com:567`` (tls version). By default, the server cannot be accessed unless IMAP is enabled (see [Problems sending mail with POP or IMAP](https://support.google.com/mail/answer/78775)). You can usually find this string by searching on internet for ``your provider smtp server``, you find pages such as [configuration des serveurs sortants et entrants des principaux comptes mails](http://assistance.orange.fr/configuration-des-serveurs-sortants-et-entrants-des-principaux-comptes-mails-1222.php). However, by doing this, you need to send your password. You should remove your password wherever it appears as soon as you don't need it anymore. If you forget, I advise you to change it."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"pymmails.send_email(server, \"xavier.somebody@gmail.com\", \"xavier.somebodyelse@else.com\",\n",
" \"results\", \"body\", attachements = [ \"erty.txt\" ])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"(221, b'2.0.0 closing connection e18sm17176289wjz.27 - gsmtp')"
]
},
"execution_count": null,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"server.quit()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": []
}
],
"source": [
"server.quit()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": []
}
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 0
],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 0
}
5 changes: 4 additions & 1 deletion _unittests/ut_module/test_convert_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

from pyquickhelper.loghelper import fLOG
from pyquickhelper.filehelper import explore_folder_iterfile
from pyquickhelper.ipythonhelper import upgrade_notebook
from pyquickhelper.ipythonhelper import upgrade_notebook, remove_execution_number


class TestConvertNotebooks(unittest.TestCase):
Expand All @@ -56,6 +56,9 @@ def test_convert_notebooks(self):
t = upgrade_notebook(nbf)
if t:
fLOG("modified", nbf)
# remove numbers
remove_execution_number(nbf, nbf)

fold2 = os.path.normpath(os.path.join(fold, "..", "..", "_unittests"))
for nbf in explore_folder_iterfile(fold2, pattern=".*[.]ipynb"):
t = upgrade_notebook(nbf)
Expand Down

0 comments on commit fa348b0

Please sign in to comment.