Skip to content

Commit

Permalink
Merge pull request #28 from LuqueDaniel/develop
Browse files Browse the repository at this point in the history
Version 4.0.0
  • Loading branch information
LuqueDaniel authored Dec 9, 2016
2 parents c43f223 + c81cc94 commit 93dab8c
Show file tree
Hide file tree
Showing 48 changed files with 2,766 additions and 1,251 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Ignore files .pyc
*.pyc
*.pyo
*.pyd
*.egg-info
__pycache__

# ignore test file
pro.py
test.json

# build/dist files
build/
Expand Down
5 changes: 4 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Pylint config file

[TYPECHECK]
generated-members=objects

[REPORTS]
msg-template="{path}:{line}:{column} - [{msg_id} in {obj}]: ({symbol}), {msg}
msg-template={path}:{line}:{column} - [{msg_id} in {obj}]: ({symbol}), {msg}
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,28 @@ language: python
python:
- "2.6"
- "2.7"
- "3.2"
- "3.3"
- "3.4"
- "3.5"

branches:
- develop
- master

install:
# Install requests
- pip install -r requirements.txt

# Install pylint
- sudo apt-get install pylint
# Install requests
- pip install requests

before_script:
# Remove python binari files
# Remove python binary files
- rm --recursive --force --verbose *.py[cod]
- rm --recursive --force --verbose pybooru/__pycache__
# Run pylint
- pylint --errors-only --rcfile=.pylintrc pybooru/

script:
# Run pylint
- pylint --errors-only --rcfile=".pylintrc" pybooru/
# Run test script, but at the moment is a provisional test
- python provisional_test.py
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License

Copyright (c) 2012 - 2015 - Daniel Luque
Copyright (c) 2012 - 2016 - Daniel Luque

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include README.md changelog.md LICENSE requirements.txt
74 changes: 47 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,69 +1,89 @@
# Pybooru - Library for Danbooru/Moebooru API.
[![Build Status](https://travis-ci.org/LuqueDaniel/pybooru.svg?branch=master)](https://travis-ci.org/LuqueDaniel/pybooru)
# Pybooru - Package for Danbooru/Moebooru API.
[![PyPI](https://img.shields.io/pypi/v/Pybooru.svg?style=flat-square)](https://pypi.python.org/pypi/Pybooru/)
[![Build Status](https://travis-ci.org/LuqueDaniel/pybooru.svg?branch=master)](https://travis-ci.org/LuqueDaniel/pybooru) [![PyPI](https://img.shields.io/pypi/status/Pybooru.svg?style=flat-square)](https://pypi.python.org/pypi/Pybooru/)
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://raw.githubusercontent.com/LuqueDaniel/pybooru/master/LICENSE)
[![Documentation Status](https://readthedocs.org/projects/pybooru/badge/?version=stable)](http://pybooru.readthedocs.io/en/stable/?badge=stable)

**Pybooru** is a Python library to access API of Danbooru/Moebooru based sites.
**Pybooru** is a Python package to access to the API of Danbooru/Moebooru based sites.

- Version: **3.0.1**
- Version: **4.0.0**
- Licensed under: **MIT License**

## Dependencies.
- Python: >= 2.6 or Python: >= 3
- [requests.](http://docs.python-requests.org/en/latest/)
- Python: >= 2.6 or Python: >= 3.3
- [requests](http://docs.python-requests.org/en/latest/)

## Installation
### from Python Package Index (Pypi)
Pypi - Python Package Index:
[Pybooru on Pypi.](https://pypi.python.org/pypi/Pybooru/)

```bash
sudo pip install Pybooru
```
or
```bash
sudo easy_install Pybooru
pip install --user Pybooru
```

### Manual installation
```bash
git clone git://github.com/luquedaniel/pybooru.git
cd pybooru
pip install --user -r requirements.txt
sudo python setup.py build
sudo python setup.py install
python setup.py install
```

## Examples of use
```python
from pybooru import Pybooru
See [More examples.](https://github.com/LuqueDaniel/pybooru/tree/master/examples)

client = Pybooru('Konachan')
### Danbooru
```python
from pybooru import Danbooru

artists = client.artists('ma')
client = Danbooru('danbooru')
artists = client.artist_list('ma')

for artist in artists:
print("Name: {0}".format(artist['name']))
```

### Login example
#### Default sites
#### Login example
```python
from pybooru import Pybooru
from pybooru import Danbooru

client = Pybooru('Konachan', username='your-username', password='your-password')
client = Danbooru('danbooru', username='your-username', api_key='your-apikey')
client.comment_create(post_id=id, body='Comment content')
```

### Moebooru
```python
from pybooru import Moebooru

client.comments_create(post_id=id, comment_body='Comment content')
client = Moebooru('konachan')
artists = client.artist_list(name='neko')

for artist in artists:
print("Name: {0}".format(artist['name']))
```

#### Other sites
#### Login example
##### Default sites
```python
from pybooru import Pybooru
from pybooru import Moebooru

client = Pybooru('konachan.com', username='your-username', password='your-password',
hashString='So-I-Heard-You-Like-Mupkids-?--{0}--')
client = Moebooru('konachan', username='your-username', password='your-password')
client.comment_create(post_id=id, comment_body='Comment content')
```

##### Not default sites
```python
from pybooru import Moebooru

client.comments_create(post_id=id, comment_body='Comment content')
client = Moebooru('konachan.com', username='your-username', password='your-password',
hash_string='So-I-Heard-You-Like-Mupkids-?--{0}--')
client.comment_create(post_id=id, comment_body='Comment content')
```

[More examples.](https://github.com/LuqueDaniel/pybooru/tree/master/examples)
## Documentation
You can consult the documentation on **[Read the Docs](http://pybooru.readthedocs.io/en/stable/)**

## CI Report
- https://travis-ci.org/LuqueDaniel/pybooru
Expand Down
26 changes: 15 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
Pybooru - Library for Danbooru/Moebooru API.
Pybooru - Package for Danbooru/Moebooru API.
============================================
.. image:: https://travis-ci.org/LuqueDaniel/pybooru.svg?branch=master
:target: https://travis-ci.org/LuqueDaniel/pybooru
.. image:: https://img.shields.io/pypi/v/Pybooru.svg?style=flat-square :target:
.. image:: https://img.shields.io/pypi/status/Pybooru.svg?style=flat-square :target:
.. image:: https://img.shields.io/pypi/l/Pybooru.svg?style=flat-square :target: https://raw.githubusercontent.com/LuqueDaniel/pybooru/master/LICENSE
.. image:: https://img.shields.io/pypi/wheel/Pybooru.svg?style=flat-square :target:
.. image:: https://img.shields.io/pypi/format/Pybooru.svg?style=flat-square :target:

Pybooru is a Python library to access API of Danbooru/Moebooru based sites.

Licensed under: **MIT License**.

Examples of use
---------------
.. code-block:: python
from pybooru import Danbooru
from pybooru import Pybooru
client = Pybooru('Konachan')
artists = client.artists('ma')
client = Danbooru('danbooru')
artists = client.artist_list('ma')
for artist in artists:
print("Name: {0}".format(artist['name']))
..
..
See more examples of `Danbooru <https://github.com/LuqueDaniel/pybooru/tree/develop/examples/danbooru>`_ and `Moebooru <https://github.com/LuqueDaniel/pybooru/tree/develop/examples/moebooru>`_.

See more examples: https://github.com/LuqueDaniel/pybooru/tree/develop/examples
Documentation
-------------
You can consult the documentation on `Read the Docs <http://pybooru.readthedocs.io/en/stable/>`_

Changelog
---------
Expand Down
15 changes: 15 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Pybooru - Changelog

## Pybooru 4.0.0 - (12/09/2016)
- Added support to Danbooru.
- Now Danbooru and Moebooru are two separed classes.
- Pybooru has been refactored.
- Moebooru (only): added support for API versioning.
- Added PybooruAPIError exception.
- Added **last_call** attribute to Danbooru and Moebooru to store last request information.
- Examples has been updated.
- Added **[documentation](http://pybooru.readthedocs.io/en/stable/)** to Pybooru (with Sphinx).
- Added some tools for Pybooru (tools folder)
- Refactored setup.py.
- End of Python 3.2.x support.
- Fixed parameter comparison (python 2.X only)
- In this version there's a nice amount of improvements.

## Pybooru 3.0.1 - (01/13/2015)
- Minors changes

Expand Down
3 changes: 0 additions & 3 deletions clean_pycs.sh

This file was deleted.

20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = Pybooru
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
36 changes: 36 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build
set SPHINXPROJ=Pybooru

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%

:end
popd
6 changes: 6 additions & 0 deletions docs/source/api_danbooru.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Danbooru API Reference
======================

.. automodule:: pybooru.api_danbooru
:show-inheritance:
:members:
6 changes: 6 additions & 0 deletions docs/source/api_moebooru.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Moebooru API Reference
======================

.. automodule:: pybooru.api_moebooru
:show-inheritance:
:members:
Loading

0 comments on commit 93dab8c

Please sign in to comment.