1
0
mirror of https://github.com/gryf/slack-backup.git synced 2025-12-17 11:30:25 +01:00

4 Commits
v0.2 ... v0.3

Author SHA1 Message Date
b5e9c150ed Merge to head 2016-11-26 19:23:03 +01:00
af7f24e9a9 Dropping Python 2 support 2016-11-26 19:13:12 +01:00
11241e9d8b Readme update 2016-11-26 18:40:54 +01:00
c8c1dd4bfe Small fixes, version bump, alpha stage, added emoji map. 2016-11-26 18:03:29 +01:00
8 changed files with 18 additions and 46 deletions

View File

@@ -1,8 +1,6 @@
language: python
env:
- TOXENV=py27
- TOXENV=py34
- TOXENV=py27-flake8
- TOXENV=py34-flake8
install: pip install tox
script: tox

View File

@@ -4,15 +4,18 @@ Slack backup
.. image:: https://travis-ci.org/gryf/slack-backup.svg?branch=master
:target: https://travis-ci.org/gryf/slack-backup
This project aim is to collect conversations from Slack using its API and
.. image:: https://img.shields.io/pypi/v/slack-backup.svg
:target: https://pypi.python.org/pypi/slack-backup
The project aim is to collect conversations from Slack using its API and
optionally user account information, and provides convenient way to represent
as a log.
Requirements
------------
This project is written in Python 2.7, and 3.4+, although version 2.7, which
should work, wasn't tested as extensively as it should be.
This project is written in Python 3, 3.4 to be precise, although it may work on
earlier version of Python3. Sorry no support for Python2.
Other than that, required packages are as follows:

View File

@@ -2,12 +2,15 @@
"""
Setup for the slack-backup project
"""
from distutils.core import setup
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(name="slack-backup",
packages=["slack_backup"],
version="0.2",
version="0.3",
description="Make copy of slack converstaions",
author="Roman Dobosz",
author_email="gryf73@gmail.com",

View File

@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
This module contains emoji list
"""

View File

@@ -1,19 +1,14 @@
# -*- coding: utf-8 -*-
"""
Reporters module.
There are several classes for specific format reporting, and also some of the
slack conversation/convention parsers.
"""
from __future__ import absolute_import, division, print_function
import os
import errno
import html.parser
import logging
import re
try:
from html.parser import HTMLParser
except ImportError:
from HTMLParser import HTMLParser
from slack_backup import objects as o
from slack_backup import utils
@@ -209,7 +204,6 @@ class TextReporter(Reporter):
"""return formatter for file"""
groups = self._slackid_pat[0].match(msg.text).groupdict()
text = msg.text.replace(groups['replace'], '')
text = self._filter_slackid(msg.text)
filename = msg.file.filepath
if filename:
filename = os.path.relpath(msg.file.filepath, start=self.out)
@@ -217,9 +211,8 @@ class TextReporter(Reporter):
filename = msg.file.url
if not filename:
logging.warning("There is have a file object, but nothing has "
"found. Name of the file object is `%s'",
msg.file.name)
logging.warning("There is a file object, but without filename."
"Name of the file object is `%s'", msg.file.name)
filename = msg.file.name
text = self._filter_slackid(text)
@@ -269,7 +262,7 @@ class TextReporter(Reporter):
def _remove_entities(self, text):
"""replace html entites into appropriate chars"""
text = HTMLParser().unescape(text)
return html.parser.HTMLParser().unescape(text)
def _filter_slackid(self, text):
"""filter out all of the id from slack"""

View File

@@ -1,8 +1,5 @@
from unittest import TestCase
try:
from unittest.mock import MagicMock
except ImportError:
from mock import MagicMock
from unittest.mock import MagicMock
from slack_backup import client
from slack_backup import objects as o

View File

@@ -1,10 +1,5 @@
# -*- coding: utf-8 -*-
from unittest import TestCase
try:
from unittest.mock import MagicMock
except ImportError:
from mock import MagicMock
from unittest.mock import MagicMock
from slack_backup import reporters as r
@@ -45,7 +40,3 @@ class TestReporter(TestCase):
text = ('<@U111BBBBB|user2>Praesent vel enim sed eros luctus '
'imperdiet.\nMauris neque ante, <@U111DDDDD> placerat at, '
'mollis vitae, faucibus quis, <@U111CCCCC>leo. Ut feugiat.')
# Praesent vel enim sed eros luctus imperdiet. Vivamus urna quam, congue
# vulputate, convallis non, cursus cursus, risus. Quisque aliquet. Donec
# vulputate egestas elit. Morbi dictum, sem sit amet aliquam.

14
tox.ini
View File

@@ -1,5 +1,5 @@
[tox]
envlist = py27,py34,{py27,py34}-flake8
envlist = py34,py34-flake8
usedevelop = True
@@ -10,18 +10,6 @@ commands = py.test --cov=slack_backup --cov-report=term-missing
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:py27]
usedevelop={[testenv]usedevelop}
setenv = {[testenv]setenv}
commands = {[testenv]commands}
deps = {[testenv]deps}
mock
[testenv:py27-flake8]
basepython = python2.7
deps = flake8
commands = flake8 {posargs}
[testenv:py34-flake8]
basepython = python3.4
deps = flake8