pax_global_header 0000666 0000000 0000000 00000000064 12720552361 0014515 g ustar 00root root 0000000 0000000 52 comment=7ca692051a444418855e346ea1fdda77d1ab3ffc
db2twitter-0.6/ 0000775 0000000 0000000 00000000000 12720552361 0013454 5 ustar 00root root 0000000 0000000 db2twitter-0.6/.gitignore 0000664 0000000 0000000 00000000375 12720552361 0015451 0 ustar 00root root 0000000 0000000 db2twitter.ini
db2twitter.ini.avec_id_defini
__pycache__
db2twitter.db
.coverage
db2twitter.egg-info
linuxjobsfrnew.sql
linuxjobsfrold.sql
linuxjobsfrbefore.sql
*.swp
1461837260_logoTPT.jpg
fallback_1461837260_logoTPT.jpg
set_env_and_fire.sh
docs/build
db2twitter-0.6/.travis.yml 0000664 0000000 0000000 00000000415 12720552361 0015565 0 ustar 00root root 0000000 0000000 language: python
python:
- "3.3"
- "3.4"
- "3.5"
# command to install dependencies
install:
- pip install -r requirements.txt
- pip install coveralls
# command to run tests
script:
coverage3 run --source=db2twitter setup.py test
after_success:
coveralls
db2twitter-0.6/README.md 0000664 0000000 0000000 00000004226 12720552361 0014737 0 ustar 00root root 0000000 0000000 [
](https://travis-ci.org/chaica/db2twitter)
# db2twitter
db2twitter automatically extracts fields from your database, use them to feed a template of
tweet and send the tweet.
### Quick Install
* Install db2twitter from PyPI
# pip3 install db2twitter
* Install db2twitter from sources
# tar zxvf db2twitter-0.6.tar.gz
# cd db2twitter
# python3.4 setup.py install
# # or
# python3.4 setup.py install --install-scripts=/usr/bin
### Use db2twitter
* Create or modify db2twitter.ini file in order to configure db2twitter:
[twitter]
consumer_key=pPskvBmlE1yatbrFsLMdQL1r3m
consumer_secret=lkjerpleRZER4xf948sfsrfgmlkezrZERgl1234ljfeqIdIie4
access_token=1234823497-912qsdfkerR913U5hjzer34234kerPzAQHoP9ez
access_token_secret=ljsERZE987h8k1klr123k9kezr09h134HLKJER98er5K1
tweet={} recrute un {} https://www.linuxjobs.fr/jobs/{}
hashtags=devops,linux,debian,redhat,python,java,php,mysql,postgresql
upper_first_char=true
[database]
; use the following for MySQL - you need mysql_connector_python
dbconnector=mysql+mysqlconnector
; use the following for PostgreSQL - you need psycopg2 python library
; dbconnector=postgresql+psycopg2
dbhost=localhost
database=jobboard
dbuser=jobboard
dbpass=V3rYS3cr3t
dbtables=jobs,
jobs_rows=companyname,jobtitle,id,logo
jobs_image=true
; send custom sql filter to the request with the following line
; jobs_sqlfilter=status=1
[sqlite]
sqlitepath=/home/chaica/progra/python/db2twitter/db2twitter.db
[media]
image_path=/var/www/jobboard/images/
[timer]
days=mon-fri,
hours=0-11,14-17,
[circle]
last_tweets=3
each_time=2
; no_image=true
* Launch db2twitter
$ db2twitter /path/to/db2twitter.ini
### Authors
Carl Chenet
### License
This software comes under the terms of the GPLv3+. See the LICENSE file for the complete text of the license.
db2twitter-0.6/db2twitter.py 0000775 0000000 0000000 00000000170 12720552361 0016121 0 ustar 00root root 0000000 0000000 #!/usr/bin/env python3
# app libraries imports
from db2twitter.main import Main
if __name__ == '__main__':
Main()
db2twitter-0.6/db2twitter/ 0000775 0000000 0000000 00000000000 12720552361 0015546 5 ustar 00root root 0000000 0000000 db2twitter-0.6/db2twitter/__init__.py 0000664 0000000 0000000 00000000000 12720552361 0017645 0 ustar 00root root 0000000 0000000 db2twitter-0.6/db2twitter/cliparse.py 0000664 0000000 0000000 00000004405 12720552361 0017725 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright © 2015-2016 Carl Chenet
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# CLI parsing
'''CLI parsing'''
# standard libraries imports
from argparse import ArgumentParser
import os.path
import sys
class CliParse(object):
'''CliParse class'''
def __init__(self):
'''Constructor for the CliParse class'''
self.epilog = 'For more information: https://db2twitter.readthedocs.io'
self.description = 'db2twitter automatically extracts fields from your database, use them to feed a template of tweet and send the tweet'
self.main()
def main(self):
'''main of CliParse class'''
parser = ArgumentParser(prog='db2twitter',
description=self.description,
epilog=self.epilog)
parser.add_argument('pathtoconf', metavar='FILE', type=str,
help='the path to the retweet configuration')
parser.add_argument('-c', '--circle', action='store_true',
default=False, help='circling the last tweets')
parser.add_argument('--dry-run', dest='dryrun', action='store_true',
default=False, help='simulate the execution, no tweet sent')
self.cliargs = parser.parse_args()
if not os.path.exists(self.cliargs.pathtoconf):
sys.exit('the path you provided for db2twitter configuration file does not exist')
if not os.path.isfile(self.cliargs.pathtoconf):
sys.exit('the path you provided for db2twitter configuration is not a file')
@property
def args(self):
'''return the cli arguments'''
return self.cliargs
db2twitter-0.6/db2twitter/confparse.py 0000664 0000000 0000000 00000014062 12720552361 0020103 0 ustar 00root root 0000000 0000000 # -*- coding: utf-8 -*-
# Copyright © 2015-2016 Carl Chenet
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see