-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from fsadannn/develop
merge with develop
- Loading branch information
Showing
17 changed files
with
181 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,6 @@ | |
class UnreachebleURL(Exception): | ||
pass | ||
|
||
|
||
class ProxyConfigError(Exception): | ||
pass | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include Pipfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = "*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
|
||
|
@@ -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" | ||
|
@@ -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) | ||
|
@@ -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]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |