Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
A
autoprospect
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Samy Haffoudhi
autoprospect
Commits
1b971ffb
Commit
1b971ffb
authored
Feb 06, 2022
by
Samy Haffoudhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lecture d'arguments pour accès au gsheet
parent
7e5fb0af
Pipeline
#65
failed with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
autoprospect.py
autoprospect.py
+5
-1
sheets.py
sheets.py
+3
-3
No files found.
autoprospect.py
View file @
1b971ffb
...
@@ -10,14 +10,18 @@ EMAIL_ADDRESS = os.environ.get('EMAIL_USER')
...
@@ -10,14 +10,18 @@ EMAIL_ADDRESS = os.environ.get('EMAIL_USER')
EMAIL_PASSWORD
=
os
.
environ
.
get
(
'EMAIL_PASS'
)
EMAIL_PASSWORD
=
os
.
environ
.
get
(
'EMAIL_PASS'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'Un script pour l
\'
envoi automatique de mails à une BDD'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'Un script pour l
\'
envoi automatique de mails à une BDD'
)
parser
.
add_argument
(
"sheet"
,
type
=
str
,
help
=
'Nom du fichier google sheet à lire'
)
parser
.
add_argument
(
"colonne"
,
type
=
int
,
help
=
'colonne du fichier contennant les adresses'
)
parser
.
add_argument
(
"contenu"
,
type
=
str
,
help
=
'fichier contenant le mail à envoyer'
)
parser
.
add_argument
(
"contenu"
,
type
=
str
,
help
=
'fichier contenant le mail à envoyer'
)
parser
.
add_argument
(
'-o'
,
'--objet'
,
type
=
str
,
help
=
'object du mail'
,
default
=
''
)
parser
.
add_argument
(
'-o'
,
'--objet'
,
type
=
str
,
help
=
'object du mail'
,
default
=
''
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
nom_sheet
=
args
.
sheet
colonne
=
args
.
colonne
contenu
=
args
.
contenu
contenu
=
args
.
contenu
objet
=
args
.
objet
objet
=
args
.
objet
adresses
=
get_mails
()[
1
:]
adresses
=
get_mails
(
nom_sheet
,
colonne
)[
1
:]
with
open
(
'contenu_mail'
,
'r'
)
as
fichier
:
with
open
(
'contenu_mail'
,
'r'
)
as
fichier
:
contenu
=
fichier
.
read
()
contenu
=
fichier
.
read
()
...
...
sheets.py
View file @
1b971ffb
...
@@ -4,8 +4,8 @@ from oauth2client.service_account import ServiceAccountCredentials
...
@@ -4,8 +4,8 @@ from oauth2client.service_account import ServiceAccountCredentials
scope
=
[
"https://spreadsheets.google.com/feeds"
,
'https://www.googleapis.com/auth/spreadsheets'
,
"https://www.googleapis.com/auth/drive.file"
,
"https://www.googleapis.com/auth/drive"
]
scope
=
[
"https://spreadsheets.google.com/feeds"
,
'https://www.googleapis.com/auth/spreadsheets'
,
"https://www.googleapis.com/auth/drive.file"
,
"https://www.googleapis.com/auth/drive"
]
creds
=
ServiceAccountCredentials
.
from_json_keyfile_name
(
"creds.json"
,
scope
)
creds
=
ServiceAccountCredentials
.
from_json_keyfile_name
(
"creds.json"
,
scope
)
client
=
gspread
.
authorize
(
creds
)
client
=
gspread
.
authorize
(
creds
)
sheet
=
client
.
open
(
"test autoprospect"
)
.
sheet1
def
get_mails
():
def
get_mails
(
nom_sheet
,
colonne
):
adresses
=
sheet
.
col_values
(
3
)
sheet
=
client
.
open
(
nom_sheet
)
.
sheet1
adresses
=
sheet
.
col_values
(
colonne
)
return
adresses
return
adresses
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment