Skip to content

Commit

Permalink
Merge pull request #1 from fsadannn/develop
Browse files Browse the repository at this point in the history
merge with develop
  • Loading branch information
fsadannn authored Oct 25, 2019
2 parents c52a38c + c5161c0 commit 9a3d7aa
Show file tree
Hide file tree
Showing 17 changed files with 181 additions and 61 deletions.
11 changes: 8 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
*.pyc
.vscode
auth.py
data_test
.directory
__pycache__
test.py
.directory
coverage.xml
.coverage
.directory
build
CubaCrawler.egg-info
1 change: 1 addition & 0 deletions .todo
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ Todo:
✔ Texto @done(18-09-27 16:16)
✔ Separar proxy `http` y `https` @done(19-07-30 10:46)
✔ Generate a requirements.txt @done(19-07-30 10:46)
☐ Escribir los test
27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

language: python

cache: pip

python:
- 3.6

install: make install
script: make test
after_success: make cov

deploy:
- provider: pypi
user: $PYPI_USER
password: $PYPI_PASSWORD
distributions: "sdist bdist_wheel"
on:
tags: true

- provider: pypi
user: $TEST_PYPI_USER
password: $TEST_PYPI_PASSWORD
distributions: "sdist bdist_wheel"
server: https://test.pypi.org/legacy/
on:
branch: develop
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion Crawler/ScrapBase.py → CubaCrawler/ScrapBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
class UnreachebleURL(Exception):
pass


class ProxyConfigError(Exception):
pass

Expand Down
2 changes: 1 addition & 1 deletion Crawler/__init__.py → CubaCrawler/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .crawler import Crawler
from .Cubadebate import CubaDebate
from .Granma import Granma
from .ScrapBase import UnreachebleURL, ProxyConfigError
from .ScrapBase import UnreachebleURL, ProxyConfigError, UnreachebleURL
File renamed without changes.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Frank S. Naranjo

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include Pipfile
19 changes: 19 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
pytest = "*"
pytest-cov = "*"
pylint = "*"
codecov = "*"
pylint-exit = "*"
mock = "*"

[packages]
toml = "*"
beautifulsoup4 = "*"
bs4 = "*"
lxml = "*"
requests = "*"
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<img alt="PyPI - License" src="https://img.shields.io/pypi/l/CubaCrawler.svg"> <img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/CubaCrawler.svg"> <img alt="PyPI" src="https://img.shields.io/pypi/v/CubaCrawler.svg"> <img alt="Travis (.org)" src="https://img.shields.io/travis/fsadannn/CubaCrawler/master.svg"> <img alt="Codecov" src="https://img.shields.io/codecov/c/github/fsadannn/CubaCrawler.svg">
# CubaCrawler

Esta biblioteca apunta a obtener información de los sitios de
noticias cubanas (Ahora mismo solo funciona [Cubadebate](http://www.cubadebate.cu/)).
noticias cubanas (Ahora mismo solo funcionan [Cubadebate](http://www.cubadebate.cu/) y
[Granma](http://www.granma.cu/)).

## Como se usa

```python
from Crawler import Crawler
from CubaCrawler import Crawler

data = Crawler()

Expand All @@ -18,7 +20,7 @@ print(data.comment)
En caso de tener que pasar por un proxy se puede usar de la siguiente manera

```python
from Crawler import Crawler
from CubaCrawler import Crawler

config = {
"proxy": "http://user:[email protected]:port"
Expand All @@ -33,7 +35,7 @@ print(data.comment)
O, se pude llamar explicitamente a un Scrapper

```python
from Crawler import Cubadebate
from CubaCrawler import Cubadebate

url = "http://www.cubadebate.cu/noticias/2018/09/26/fundada-la-primera-empresa-biotecnologica-cubano-estadounidense-innovative-immunotherapy-alliance-sa/#.W6uvSBQpDeM"
cubadebate = Cubadebate(url)
Expand All @@ -46,4 +48,6 @@ Esta biblioteca es desarrollada por GIA (Grupo de Inteligencia Artificial), cual

thanks,

los autores
Frank Sadan Naranjo Noda <[email protected]>

Hian Cañizares Díaz <[email protected]>
23 changes: 23 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.PHONY: build clean install test lint cov

# TODO: Update your project folder
PROJECT=CubaCrawler

build:
pipenv run python setup.py sdist bdist_wheel

clean:
git clean -fxd

install:
pip install pipenv
pipenv install --dev --skip-lock

test:
make lint && pipenv run pytest --doctest-modules --cov=$(PROJECT) --cov-report=xml -v

lint:
pipenv run pylint $(PROJECT) || pipenv run pylint-exit $$?

cov:
pipenv run codecov
8 changes: 0 additions & 8 deletions requeriments.txt

This file was deleted.

59 changes: 59 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# coding: utf8

import toml
from setuptools import setup


# TODO: Update version whenever changes
VERSION = '1.0.0'


def get_install_requirements():
"""Automatically pull requirements from Pipfile.
Adapted from: <https://medium.com/homeaway-tech-blog/simplifying-python-builds-74e76802444f>
"""
try:
# read my pipfile
with open('Pipfile', 'r') as fh:
pipfile = fh.read()
# parse the toml
pipfile_toml = toml.loads(pipfile)
except FileNotFoundError:
return []
# if the package's key isn't there then just return an empty
# list
try:
required_packages = pipfile_toml['packages'].items()
except KeyError:
return []
# If a version/range is specified in the Pipfile honor it
# otherwise just list the package
return ["{0}{1}".format(pkg, ver) if ver != "*"
else pkg for pkg, ver in required_packages]


setup(
name='CubaCrawler',
packages=['CubaCrawler'],
url='https://github.com/fsadannn/CubaCrawler', # cambiar
download_url='https://github.com/fsadannn/CubaCrawler/tarball/{}'.format(VERSION), # cambiar
license='MIT',
author='Frank Sadan Naranjo Noda, Hian Cañizares Días',
author_email='[email protected], [email protected]',
description='This library aims to obtain information from the sites of Cuban news.',

# This should automatically take your long description from Readme.md
long_description=open('README.md').read(),
long_description_content_type='text/markdown',

# This should automatically pull your requirements from `Pipfile`
install_requires=get_install_requirements(),
version=VERSION,

classifiers=[
'Development Status :: 5 - Production/Stable',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.6',
'Topic :: Software Development :: Libraries :: Python Modules',
]
)
43 changes: 0 additions & 43 deletions test.py

This file was deleted.

12 changes: 12 additions & 0 deletions tests/test_module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# coding: utf8
import CubaCrawler
""" Pending to write
"""


def test_fake():
""" fake test, when i write the test i remove these,
in the mean time thie is for simulate that pass all
test and travis compile the module
"""
assert 1 == 1

0 comments on commit 9a3d7aa

Please sign in to comment.