Skip to content

Commit

Permalink
real initial commit :)
Browse files Browse the repository at this point in the history
  • Loading branch information
blackcoffeerider committed May 16, 2018
1 parent 4cd9f74 commit 746ad5b
Show file tree
Hide file tree
Showing 18 changed files with 702 additions and 1 deletion.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,10 @@ docs/_build/

# PyBuilder
target/

configs/secrets/

spamenv/
.vscode/tags

configs/mailto/
151 changes: 151 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
{
// Verwendet IntelliSense zum Ermitteln möglicher Attribute.
// Zeigen Sie auf vorhandene Attribute, um die zugehörigen Beschreibungen anzuzeigen.
// Weitere Informationen finden Sie unter https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "weekly2all emailtest",
"type": "python",
"request": "launch",
"program": "${file}",
"args": [
"EMAILTEST",
"en",
"401",
"7831",
"2016",
"02",
"23.02.2016",
"29.02.2016"
]
},
{
"name": "weekly2all twtest",
"type": "python",
"request": "launch",
"program": "${file}",
"args": [
"--showpic",
"--twitter",
"--twpic", "/home/martinix/Schreibtisch/witzige_bilder/C3wrVxcWcAEhtrU.jpg",
"WEEKLYTWTEST",
"en",
"401",
"7831",
"2016",
"02",
"23.02.2016",
"29.02.2016"
],
},
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}"
},
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}",
"port": 3000,
"secret": "my_secret",
"host": "localhost"
},
{
"name": "Python: Terminal (integrated)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Python: Terminal (external)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "externalTerminal"
},
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"debugOptions": [
"RedirectOutput",
"Django"
]
},
{
"name": "Python: Flask (0.11.x or later)",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "${workspaceFolder}/app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
]
},
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"module": "module.name"
},
{
"name": "Python: Pyramid",
"type": "python",
"request": "launch",
"args": [
"${workspaceFolder}/development.ini"
],
"debugOptions": [
"RedirectOutput",
"Pyramid"
]
},
{
"name": "Python: Watson",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/console.py",
"args": [
"dev",
"runserver",
"--noreload=True"
]
},
{
"name": "Python: All debug Options",
"type": "python",
"request": "launch",
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"module": "module.name",
"env": {
"VAR1": "1",
"VAR2": "2"
},
"envFile": "${workspaceFolder}/.env",
"args": [
"arg1",
"arg2"
],
"debugOptions": [
"RedirectOutput"
]
}
]
}
4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"python.pythonPath": "${workspaceFolder}/spamenv/bin/python",
"python.linting.pylintEnabled": false
}
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,53 @@
spamtool


# OSM Weekly "SPAM" Tool
This is the OSM Weekly "SPAM" Tool for sending updates in different languages. It supports posting to a forum,
sending emails via google and sending tweets via twitter.
Feel free to use it as a baseline for simmilar usecases.


> Disclaimer:
> This script is _completely_ unsupported! It comes "as is" besides from request surrounding weeklyosm your issue-tickets or pull-requests will most likely be ignored.
> This software is unlicensed! For more information, please refer to <http://unlicense.org>
On linux run setup.sh to get you started with all requirements for a python environment.

You should first edit configs/configs.yaml to your needs.
Note that by default all weekly_*.yaml files inherit their secrets from the file configs/secrets/weeklysecrets.yaml.
You would need to create that file looking something like this:

```
runnable: False
mail_user: 'somegmailusername'
mail_pw: somegmailssecretpasswort
tw_CONSUMER_KEY: "yourTwitterConsumerKey"
tw_CONSUMER_SECRET: "yourTwitterConsumerSecretFrdsfor09512kljda98324iu21as"
tw_ACCESS_KEY: "123456-YourTWAccessKeyNelsonMandela4Evaaaa"
tw_ACCESS_SECRET: "YourTWAccessSecretlsdkhjkahdkjahsrwqkjhqwkjhewqkjewqh"
```

Note that you have to enable sending e-mails via that account in your google-mail-account settings.

You can override the mail distribution lists with some private mail adress.
I.E. configs/mailto/weekly.pb could be created with the following content:

```
mail_to:
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
```

That would replace the mail_to: property from the file config/weekly_pb.yaml
leading to additional mail sent to the first three lines instead of only to the brasilian osm-lists.


For calling this from a script within the prepared environment call the shellscript runenvweekly2all.sh.
It takes the same parameters as the python script but fixes PYTHONIOENCODING to UTF-8 and LC_CTYPE to C.UFT-8 avoiding issues when called from node or other environments.

```
./runenvweekly2all.sh --twitter --twpic ~/downloads/C3wrVxcWcAEhtrU.jpg --showpic "WEEKLYTWTEST" "en" "401" "7831" "2016" "02" "23.02.2016" "29.02.2016"
```

24 changes: 24 additions & 0 deletions configs/configs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This creates a hierarchy of files which are loaded after each other
# Each config which is loaded passes its settings down to files which are loaded as children
# Children as such can override settings from their parrents
# Each config which leaves its "runnable" flag set to True
# Will be added by context and language to the list of available configurations
# Note that if you don't provide a new context or language key in a file
# the child might overwrite any other existing configuration with the same context name and language
# - in some cases this might be wanted behaviour - like keeping e-mail adresses secret


- secrets/weeklysecrets.yaml:
- weekly_base.yaml:
- weekly_en.yaml:
- mailto/weekly_en.yaml
- weekly_es.yaml:
- mailto/weekly_en.yaml
- weekly_pb.yaml:
- mailto/weekly_en.yaml
- weekly_fr.yaml:
- mailto/weekly_en.yaml
- emailtest.yaml:
- mailto/emailtest.yaml
- secrets/weeklytwtest_secrets.yaml:
- weeklytwtest_en.yaml
24 changes: 24 additions & 0 deletions configs/emailtest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
context: 'EMAILTEST'
lang: 'en'
runnable: False
mail_smtp_host: "smtp.gmail.com"
mail_smtp_port: 587
url: "http://www.weeklyosm.eu/"
do_mail: True # " wenn dieses auskommentiert wird, wird der paramterer "--mail" ignoriert
do_twitter: False #" wenn dieses auskommentiert wird, wird der paramterer "--twitter" ignoriert und NICHT getwittert
do_forum: False
mail_subject: 'Python email test'
mail_to:
- "[email protected]" # this property gets overwritten in the file with the same name found in mailto/ folder
mail_body: |
This is test...
This is _only_ a test!
With a link: {c.url}
and empty lines:
lots!
If you can read this be happy! the spamtool is now available with yaml-config files!
4 changes: 4 additions & 0 deletions configs/weekly_base.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
context: 'WEEKLY'
url: "http://www.weeklyosm.eu/{c.lang}/archives/{c.url_nr}/"
mail_smtp_host: "smtp.gmail.com"
mail_smtp_port: 587
32 changes: 32 additions & 0 deletions configs/weekly_en.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

lang: 'en'
runnable: True
#do_mail: False " wenn dies auskommentiert wird, wird der parameter "--mail" ignoriert
#do_twitter: False " wenn dies auskommentiert wird, wird der parameter "--twitter" ignoriert und es wird NICHT getwittert
mail_from: "weeklyteam <{c.mail_user}@gmail.com>"
mail_subject: 'weeklyOSM #{c.post_nr} {c.daterange_str}'
mail_to:
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
tw_text: "weeklyOSM issue {c.post_nr} now available in *English* the news from the #openstreetmap #osm world http://www.weeklyosm.eu/archives/{c.url_nr}"
mail_body: |
The weekly round-up of OSM news, issue # {c.post_nr},
is now available online in English, giving as always a summary of all things happening in the openstreetmap world:
{c.url}
Enjoy!
weeklyOSM?
who: https://wiki.openstreetmap.org/wiki/WeeklyOSM#Available_Languages
where?: https://umap.openstreetmap.fr/en/map/weeklyosm-is-currently-produced-in_56718#2/8.6/108.3
24 changes: 24 additions & 0 deletions configs/weekly_es.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
lang: 'es' ### overwrite language
runnable: True
#do_mail: False " wenn dieses auskommentiert wird, wird der paramterer "--mail" ignoriert
#do_twitter: False " wenn dieses auskommentiert wird, wird der paramterer "--twitter" ignoriert und NICHT getwittert
mail_subject: 'semanarioOSM Nº {c.post_nr} {c.daterange_str}'
mail_to:
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
tw_text: "El semanario Nº {c.post_nr} de OSM en *ESPAÑOL* está online, noticias del mundo #openstreetmap #osm - http://www.weeklyosm.eu/es/archives/{c.url_nr}"
mail_body: |
Hola, el semanario Nº {c.post_nr}, el sumario de todo lo que está ocurriendo en el mundo de openstreetmap está en línea en *español*:
{c.url}
¡Disfruta!
semanarioOSM?
¿Dónde?: https://wiki.openstreetmap.org/wiki/WeeklyOSM#Available_Languages
¿Quién?: https://umap.openstreetmap.fr/en/map/weeklyosm-is-currently-produced-in_56718#2/8.6/108.3
28 changes: 28 additions & 0 deletions configs/weekly_fr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
lang: 'fr' ### overwrite language
runnable: True
#do_mail: False " wenn dieses auskommentiert wird, wird der paramterer "--mail" ignoriert
#do_twitter: False " wenn dieses auskommentiert wird, wird der paramterer "--twitter" ignoriert und NICHT getwittert
mail_subject: 'hebdoOSM Nº {c.post_nr} {c.daterange_str}'
mail_to:
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
- "[email protected]"
tw_text: "Une semaine d'actualité #OpenStreetMap : hebdoOSM n°{c.post_nr} à lire *en français* sur http://www.weeklyosm.eu/fr/archives/{c.url_nr}"
mail_body: |
Bonjour,
Le résumé hebdomadaire n° {c.post_nr} de l'actualité OpenStreetMap vient de paraître *en français*. Un condensé à retrouver sur :
{c.url}
Bonne lecture !
hebdoOSM ?
Qui : https://wiki.openstreetmap.org/wiki/WeeklyOSM#Available_Languages
Où : https://umap.openstreetmap.fr/en/map/weeklyosm-is-currently-produced-in_56718#2/8.6/108.3
21 changes: 21 additions & 0 deletions configs/weekly_pb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
lang: 'pb' ### overwrite language
runnable: True
#do_mail: False " wenn dieses auskommentiert wird, wird der paramterer "--mail" ignoriert
#do_twitter: False " wenn dieses auskommentiert wird, wird der paramterer "--twitter" ignoriert und NICHT getwittert
mail_subject: 'semanárioOSM Nº {c.post_nr} {c.daterange_str}'
mail_to:
- "[email protected]"
- "[email protected]"
tw_text: "O semanário nº {c.post_nr} está disponível em *português*. Conheça as novidades do mundo #openstreetmap http://www.weeklyosm.eu/pb/archives/{c.url_nr}"
mail_body: |
Bom dia,
O semanárioOSM Nº {c.post_nr}, o resumo de tudo o que acontece no mundo OpenStreetMap, está publicado *em português*:
{c.url}
Aproveite!
semanarioOSM?
Quem?: https://wiki.openstreetmap.org/wiki/WeeklyOSM#Available_Languages
Onde?: https://umap.openstreetmap.fr/en/map/weeklyosm-is-currently-produced-in_56718#2/8.6/108.3
Loading

0 comments on commit 746ad5b

Please sign in to comment.