Difference between revisions of "Tweet-toot"

From Fixme.ch
Jump to: navigation, search
(code script bash)
 
(14 intermediate revisions by 2 users not shown)
Line 5: Line 5:
  
 
[https://github.com/ayush-sharma/tweet-toot tweet-toot]
 
[https://github.com/ayush-sharma/tweet-toot tweet-toot]
 +
 +
- Déployé sur fixme.ch et lancé depuis [https://github.com/fixme-lausanne/Twitter-Hackerspace-Status/blob/master/twitter.pl twitter.pl]
  
 
== Installation ==
 
== Installation ==
Line 10: Line 12:
 
=== clonage du projet ===
 
=== clonage du projet ===
  
git clone https://github.com/ayush-sharma/tweet-toot.git
+
git clone https://github.com/ayush-sharma/tweet-toot.git
 +
 
 +
Creation répertoire log
 +
 
 +
cd tweet-toot
 +
mkdir log
  
 
=== creation de virtualenv ===
 
=== creation de virtualenv ===
  
 
Pre-requis :
 
Pre-requis :
apt-get install python3-venv
 
  
 +
python3 , virtuelen
 +
 +
apt-get install python3-venv
 +
 +
----
  
 
  cd tweet-toot
 
  cd tweet-toot
Line 25: Line 36:
 
=== installation requirement ===
 
=== installation requirement ===
  
pip install -r requirements.txt
+
  pip install -r requirements.txt
  
  
Line 31: Line 42:
 
configuration in file config.json
 
configuration in file config.json
  
{
+
{
"gen.APP_NAME": "Tweet-Toot",
+
"gen.APP_NAME": "Tweet-Toot",
"gen.log_timestamp": "%Y-%m-%d %H:%M:%S",
+
"gen.log_timestamp": "%Y-%m-%d %H:%M:%S",
"tweets.source_account_url": "https://twitter.com/_fixme",
+
"tweets.source_account_url": "https://twitter.com/_fixme",
"toots.host_instance": "https://tooting.ch",
+
"toots.host_instance": "https://tooting.ch",
"toots.app_secure_token": "cK2YcOkkAB7UGUPjd3JX4VJSX6EfvNdT2TIm1k0AOIc",
+
"toots.app_secure_token": "cK2YcOkkAB7UGUPjd3JX4VJSX6?fvNdT2TIm1k0AO?c",
"toots.cache_path": "/tmp/"
+
"toots.cache_path": "/tmp/"
}
+
}
  
 
toots.app_secure_token : authorize application to write  on mastodon. connexion  sur le serveurMastodon ,Creation application ....
 
toots.app_secure_token : authorize application to write  on mastodon. connexion  sur le serveurMastodon ,Creation application ....
  
 +
== Exécution ==
 +
 +
=== Manuel ===
 +
 +
on se place dans le répertoire applicatif
 +
 +
----
 +
 +
cd tweet-toot
 +
source  venv/bin/activate
 +
python run.py
 +
 +
=== script ===
  
 +
==== code script bash ====
 +
 +
#! /usr/bin/bash
 +
export VENV=/home/pboizot/src/tweet-toot/venv
 +
. $VENV/bin/activate
 +
DATEDAY=`date +"%j-%H-%M"`
 +
python run.py >log/lastweet-${DATEDAY}.log
 +
cat log/lastweet-${DATEDAY}.log
  
Manuellement on lance :
 
  
cd tweet-toot
+
----
  
source venv/bin/activate
+
==== Exécution ====
python run.py
+
  
 +
./tweet-toot.bash
  
Appel du script :
 
./tweet-toot.bash
 
  
  

Latest revision as of 20:55, 10 January 2020

Application creation de toot

Script Python3 dont le code est sur github .

tweet-toot

- Déployé sur fixme.ch et lancé depuis twitter.pl

Installation

clonage du projet

git clone https://github.com/ayush-sharma/tweet-toot.git

Creation répertoire log

cd tweet-toot
mkdir log

creation de virtualenv

Pre-requis :

python3 , virtuelen

apt-get install python3-venv

cd tweet-toot
python3 -m venv venv

after activate venv

installation requirement

 pip install -r requirements.txt


configuration in file config.json

{
"gen.APP_NAME": "Tweet-Toot",
"gen.log_timestamp": "%Y-%m-%d %H:%M:%S",
"tweets.source_account_url": "https://twitter.com/_fixme",
"toots.host_instance": "https://tooting.ch",
"toots.app_secure_token": "cK2YcOkkAB7UGUPjd3JX4VJSX6?fvNdT2TIm1k0AO?c",
"toots.cache_path": "/tmp/"
}

toots.app_secure_token : authorize application to write on mastodon. connexion sur le serveurMastodon ,Creation application ....

Exécution

Manuel

on se place dans le répertoire applicatif


cd tweet-toot
source  venv/bin/activate
python run.py

script

code script bash

#! /usr/bin/bash
export VENV=/home/pboizot/src/tweet-toot/venv
. $VENV/bin/activate
DATEDAY=`date +"%j-%H-%M"`
python run.py >log/lastweet-${DATEDAY}.log
cat log/lastweet-${DATEDAY}.log



Exécution

./tweet-toot.bash


TO-DO

appel depuis appli trigger...