Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release-v0.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
SamR1 committed Jul 15, 2022
2 parents a88485a + 7a41c52 commit a807516
Show file tree
Hide file tree
Showing 76 changed files with 2,213 additions and 1,469 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.venv
__pycache__
.pytest_cache
.mypy_cache
/.coverage
/.eggs/
/build/
Expand Down
14 changes: 10 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
image: python:3.9
image: python:3.10

stages:
- lint
Expand All @@ -17,10 +17,11 @@ lint:
script:
- pytest --flake8 --isort --black -m "flake8 or isort or black" twootfeed

python-3.6:
stage: tests
type-check:
stage: lint
extends: .python
image: python:3.6
script:
- mypy twootfeed

python-3.7:
stage: tests
Expand All @@ -33,6 +34,11 @@ python-3.8:
image: python:3.8

python-3.9:
stage: tests
extends: .python
image: python:3.9

python-3.10:
stage: tests
before_script:
- pip install -e .[test]
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Change log

## Version 0.7.0 (2022/07/15)

#### New Features

* [PR#29](https://github.com/SamR1/python-twootfeed/pull/29) - Add token to access feeds ⚠️ **breaking changes**
* [PR#28](https://github.com/SamR1/python-twootfeed/pull/28) - Add Mastodon home timeline

#### Misc
* [PR#30](https://github.com/SamR1/python-twootfeed/pull/30) - URLs update ⚠️ **breaking changes**
* dependencies update


## Version 0.6.8 (2021/10/05)

#### Misc
Expand Down
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@ include Makefile.config
-include Makefile.custom.config
.SILENT:

check: type-check lint test

clean:
rm -rf .mypy_cache
rm -rf .pytest_cache

clean-all: clean
rm -fr $(VENV)
rm -fr *.egg-info
rm -fr .eggs
rm -rf .pytest_cache
rm -fr build
rm -rf dist
rm -rf *.log

create-mastodon-cli:
$(PYTHON) $(FLASK_APP)/utils/create_mastodon_client.py
Expand All @@ -31,9 +37,11 @@ lint-fix:
$(BLACK) $(FLASK_APP)

serve:
echo 'Running on http://$(HOST):$(PORT)'
$(FLASK) run --with-threads -h $(HOST) -p $(PORT)

run:
echo 'Running on http://$(HOST):$(PORT)'
FLASK_ENV=production && $(GUNICORN) -b 127.0.0.1:5000 "$(FLASK_APP):create_app()" --error-logfile $(GUNICORN_LOG)

venv:
Expand All @@ -42,3 +50,7 @@ venv:

test:
$(PYTEST) $(FLASK_APP) --cov $(FLASK_APP) --cov-report term-missing $(PYTEST_ARGS)

type-check:
echo 'Running mypy...'
$(MYPY) $(FLASK_APP)
2 changes: 2 additions & 0 deletions Makefile.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export FLASK_ENV=development
export TWOOTFEED_CONFIG_DIR=$(APP_PATH)/
export TWOOTFEED_CONFIG_FILE=$(APP_PATH)/config.yml
export TWOOTFEED_LOG=twootfeed.log
export TWOOTFEED_SETTINGS=DevelopmentConfig

GUNICORN_LOG=gunicorn.log

Expand All @@ -18,6 +19,7 @@ FLASK = $(VENV)/bin/flask
PYTEST = $(VENV)/bin/py.test
GUNICORN = $(VENV)/bin/gunicorn
BLACK = $(VENV)/bin/black
MYPY = $(VENV)/bin/mypy

#Sphinx Docs
SPHINXOPTS ?=
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# python-twootfeed
**generate an RSS feed from parsed Twitter or Mastodon search and Mastodon bookmarks/favorites**
**generate an RSS feed from parsed Twitter or Mastodon search and Mastodon bookmarks/favorites/home timeline**

[![PyPI version](https://img.shields.io/pypi/v/twootfeed.svg)](https://pypi.org/project/twootfeed/)
[![Downloads](https://pepy.tech/badge/twootfeed)](https://pepy.tech/project/twootfeed)
[![Python Version](https://img.shields.io/badge/python-3.6+-brightgreen.svg)](https://python.org)
[![Flask Version](https://img.shields.io/badge/flask-2.1-brightgreen.svg)](http://flask.pocoo.org/)
[![code style: black](https://img.shields.io/badge/code%20style-black-black)](https://black.readthedocs.io/en/stable/)
[![type check: mypy](https://img.shields.io/badge/type%20check-mypy-blue)](http://mypy-lang.org/)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/14d1c00121c04cd2b81453c597639ca6)](https://www.codacy.com/app/SamR1/python-twootfeed)
[![Coverage Status](https://coveralls.io/repos/github/SamR1/python-twootfeed/badge.svg?branch=master)](https://coveralls.io/github/SamR1/python-twootfeed?branch=master)
[![pipeline status](https://gitlab.com/SamR1/python-twootfeed/badges/master/pipeline.svg)](https://gitlab.com/SamR1/python-twootfeed/commits/master)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.6.8
0.7.0
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 82efcb603edc85f98bbde204ec7fe6f9
config: ac015f087c3654ff4e74bcd47b106784
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file removed docs/_images/FreshRSS.png
Binary file not shown.
Binary file removed docs/_images/MastodonFreshRSS.png
Binary file not shown.
Binary file removed docs/_images/MastodonRSSFeed.png
Binary file not shown.
Binary file removed docs/_images/RSSFeed.png
Binary file not shown.
Binary file removed docs/_images/mastodon.png
Binary file not shown.
Binary file removed docs/_images/twitter.png
Binary file not shown.
12 changes: 12 additions & 0 deletions docs/_sources/changelog.md.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Change log

## Version 0.7.0 (2022/07/15)

#### New Features

* [PR#29](https://github.com/SamR1/python-twootfeed/pull/29) - Add token to access feeds ⚠️ **breaking changes**
* [PR#28](https://github.com/SamR1/python-twootfeed/pull/28) - Add Mastodon home timeline

#### Misc
* [PR#30](https://github.com/SamR1/python-twootfeed/pull/30) - URLs update ⚠️ **breaking changes**
* dependencies update


## Version 0.6.8 (2021/10/05)

#### Misc
Expand Down
48 changes: 3 additions & 45 deletions docs/_sources/features.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Features
Description
~~~~~~~~~~~

**twootfeed** generate an RSS feed from **Twitter** or **Mastodon** search and from **Mastodon** bookmarks/favorites.
**twootfeed** generate an RSS feed from **Twitter** or **Mastodon** search and from **Mastodon** bookmarks/favorites/home timeline.

The feed displays only the original tweets (not the retweets) and toots, with:

Expand All @@ -20,49 +20,7 @@ The feed displays only the original tweets (not the retweets) and toots, with:
- location (only for Twitter)
- numbers of retweets and likes for tweets and boosts and favourites for toots



.. warning::

**twootfeed** was originally developed for personal use.
Mastodon bookmarks/favorites toots are displayed for user associated to API key.


Examples
~~~~~~~~

- Search on Twitter

.. figure:: _images/twitter.png
:alt: Twitter search
:figclass: doc-img

Results in RSS Feed:

.. figure:: _images/RSSFeed.png
:alt: RSS Feed
:figclass: doc-img

Display on FreshRSS, a great free self-hosted aggregator (https://github.com/FreshRSS/FreshRSS):

.. figure:: _images/FreshRSS.png
:alt: FreshRSS
:figclass: doc-img

- Search on Mastodon

.. figure:: _images/mastodon.png
:alt: Mastodon search
:figclass: doc-img

Results in RSS Feed:

.. figure:: _images/MastodonRSSFeed.png
:alt: Mastodon Feed
:figclass: doc-img

Display on FreshRSS:

.. figure:: _images/MastodonFreshRSS.png
:alt: Mastodon FreshRSS
:figclass: doc-img
| **twootfeed** is developed for a personal use.
| Tweets and toots are displayed with the user account associated to the API keys (feeds may contain items with **restricted visibility**).
2 changes: 1 addition & 1 deletion docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Welcome to twootfeed's documentation!
=====================================

**twootfeed** generate a rss feed from parsed Twitter or Mastodon search and from Mastodon bookmarks and favorites
**twootfeed** generate a rss feed from parsed Twitter or Mastodon search and from Mastodon bookmarks, favorites and home timeline.

.. toctree::
:maxdepth: 1
Expand Down
75 changes: 54 additions & 21 deletions docs/_sources/installation.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Installation and usage
Requirements
~~~~~~~~~~~~

- Python 3.6+
- Python 3.7+
- API keys Twitter and/or Mastodon


Expand Down Expand Up @@ -41,16 +41,45 @@ Installation
Update the `feed and app parameters <parameters.html>`_.

.. versionadded:: 0.7.0

- The files location can be changed with the following environment variables:
Since **twootfeed** is connected to the user account, feeds may display items with **restricted visibility**.

========================= =============================================== ===========================================================================================
variable description app default value
========================= =============================================== ===========================================================================================
`TWOOTFEED_CONFIG_DIR` configuration and credentials files directory **'~/.config/twootfeed/'**
`TWOOTFEED_CONFIG_FILE` config file full path config dir + **'config.yml'** => with default value: **'~/.config/twootfeed/config.yml'**
`TWOOTFEED_LOG` application log file _no default value (log printed on the console)_
========================= =============================================== ===========================================================================================
A token is now mandatory to start the application and access feeds (minimum length: 25 characters).

Some examples for token generation:

> with Python

.. code-block:: bash
$ python
Python 3.10.5 (main, Jun 6 2022, 18:49:26) [GCC 12.1.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import secrets
>>> secrets.token_urlsafe()
'pgoeS3qOsLHxduzNY_gmn6p5vWZqSzqBgnb_VPupQ7o'
>>>
> with a linux command line

.. code-block:: bash
$ date | sha256sum | base64 | head -c 25; echo
NWU2MzE1ZGM0MmVlZDg5NDNhN
- The files location and settings can be changed with the following environment variables:

=========================== =============================================== ===========================================================================================
variable description app default value
=========================== =============================================== ===========================================================================================
``TWOOTFEED_CONFIG_DIR`` configuration and credentials files directory **'~/.config/twootfeed/'**
``TWOOTFEED_CONFIG_FILE`` config file full path config dir + **'config.yml'** => with default value: **'~/.config/twootfeed/config.yml'**
``TWOOTFEED_LOG`` application log file `no default value (log printed on the console)`
``TWOOTFEED_SETTINGS`` application settings **'ProductionConfig'**
=========================== =============================================== ===========================================================================================

- Start the app

Expand All @@ -62,30 +91,34 @@ Installation
Usage
~~~~~

The RSS feeds are available on these urls:
.. versionchanged:: 0.7.0

The following RSS feeds are available:

- for Twitter search:

- http://localhost:8080/tweets/<keywords>
- http://localhost:8080/<keywords> (*will be deprecated in a next version*)
- http://localhost:8080/tweets?q=<query>&token=<token>

- for Mastodon search:

- keyword as a hashtag:
- hashtag:

- http://localhost:8080/toots/<hashtag> (without the leading #)
- http://localhost:8080/toots/tags/<hashtag>?token=<token> (without the leading #)

- query:

- http://localhost:8080/toots/search/<query>
- http://localhost:8080/toot_search/<query> (*will be deprecated in a next version*)
- http://localhost:8080/toots/search?q=<query>&token=<token>

- for Mastodon user favorites:

- http://localhost:8080/toots/favorites?token=<token>

- for Mastodon connected user favorites:
- for Mastodon user bookmarks:

- http://localhost:8080/toots/favorites
- http://localhost:8080/toot_favorites (*will be deprecated in a next version*)
- http://localhost:8080/toots/bookmarks?token=<token>

- for Mastodon connected user bookmarks:
- for Mastodon user home timeline:

- http://localhost:8080/toots/bookmarks
- http://localhost:8080/toots/home_timeline?token=<token>

where ``<token>`` is the token set in configuration.
20 changes: 11 additions & 9 deletions docs/_sources/parameters.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,28 @@ Application parameters are stored in ``config.yml`` file:
twitter:
consumerKey: ''
consumerSecret: ''
title: 'Recherche Twitter : '
title: 'Twitter Search Feed:'
link: 'https://twitter.com/search?q='
description: "Résultat d'une recherche Twitter retournée dans un flux RSS via Tweepy."
description: 'Twitter search results.'
mastodon:
url: 'https://mastodon.social'
client_id_file: 'tootrss_clientcred.txt'
access_token_file: 'tootrss_usercred.txt'
app_name: 'tootrss' # Used to identify authenticated apps
title: 'Recherche Mastodon : '
description: "Résultat d'une recherche Mastodon retournée dans un flux RSS."
title: 'Mastodon Feed:'
description: 'Mastodon generated feed from search.'
feed:
language: 'fr'
author_name: ''
feed_url: 'http://localhost:5000/'
feed_url: 'http://localhost:8080'
timezone: 'Europe/Paris'
text_length_limit: 100
max_items: 100
max_items: 20
token: ''
app:
host: '0.0.0.0'
host: 'localhost'
port: '8080'
# nb_workers: 4 # if not defined, the number is defined by the app
nb_workers: 2 # if not defined, the number is defined by the app
Twitter
Expand All @@ -54,8 +55,9 @@ Feed
* **timezone**: Feed timezone
* **text_length_limit:** title length of a Feed item
* **max_items**: maximum number of displayed items
* **token**: token for feeds access

App
~~~
* **host** and **port**: host and port used by Gunicorn (WSGI HTTP Server)
* **nb_workers**: number of workers used by Gunicorn (not mandatory, if not defined, the number is defined by the app)
* **nb_workers**: number of workers used by Gunicorn (not mandatory, if not defined, the number is calculated by the app)
Loading

0 comments on commit a807516

Please sign in to comment.