Skip to content

Commit 81e0e5d

Browse files
committed
add base
0 parents  commit 81e0e5d

File tree

12 files changed

+289
-0
lines changed

12 files changed

+289
-0
lines changed

.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
.pytest_cache
6+
7+
# C extensions
8+
*.so
9+
10+
# Distribution / packaging
11+
.Python
12+
env/
13+
build/
14+
develop-eggs/
15+
dist/
16+
downloads/
17+
eggs/
18+
.eggs/
19+
lib/
20+
lib64/
21+
parts/
22+
sdist/
23+
var/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
28+
# Translations
29+
*.mo
30+
*.pot
31+
32+
# Sphinx documentation
33+
docs/_build/
34+
35+
# PyCharm files
36+
.idea

.travis.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
dist: bionic
2+
language: python
3+
python:
4+
- "3.5"
5+
- "3.6"
6+
- "3.7"
7+
- "3.8"
8+
- "3.9-dev"
9+
- "nightly"
10+
install:
11+
- pip install -r requirements.txt
12+
script:
13+
- python -m pytest -vv
14+
stages:
15+
- test
16+
- deploy
17+
jobs:
18+
allow_failures:
19+
- python: "3.9-dev"
20+
- python: "nightly"
21+
include:
22+
- stage: deploy
23+
if: (NOT type IN (pull_request)) AND (branch = master)
24+
script: cd docs && make html && touch _build/html/.nojekyll && cd ../
25+
before_deploy:
26+
- git config --local user.name "$GITHUB_USERNAME"
27+
- git config --local user.email "$GITHUB_EMAIL"
28+
- export TRAVIS_TAG=v$(grep -Po '[0-9]+(\.[0-9]+)*' byte_api/__init__.py)
29+
deploy:
30+
- provider: pages
31+
skip_cleanup: true
32+
token: $GITHUB_TOKEN
33+
keep_history: true
34+
local_dir: docs/_build/html
35+
- provider: pypi
36+
user: $PYPI_USERNAME
37+
password: $PYPI_PASSWORD
38+
server: https://upload.pypi.org/legacy/
39+
- provider: releases
40+
api_key: $GITHUB_TOKEN
41+
skip_cleanup: true
42+
target_commitish: $TRAVIS_COMMIT
43+
tag_name: $TRAVIS_TAG
44+
branches:
45+
only:
46+
- master
47+
- develop
48+
- /^release-.*$/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 byte-api
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

byte_api/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from .byte_api import ByteApi
2+
3+
4+
__author__ = 'bixnel'
5+
__version__ = '1.0'

byte_api/byte_api.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import json
2+
import requests
3+
4+
5+
class ByteApi(object):
6+
def __init__(self):
7+
self.API_URL = 'https://api.byte.co/'
8+
9+
def get(self, url, params=None, **kwargs):
10+
response = requests.get(self.API_URL + url, params, **kwargs).text
11+
return json.loads(response)
12+
13+
def post(self, url, data=None, json_data=None, **kwargs):
14+
response = requests.post(self.API_URL + url, data, json_data, **kwargs).text
15+
return json.loads(response)

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/conf.py

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# This file only contains a selection of the most common options. For a full
4+
# list see the documentation:
5+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
6+
7+
# -- Path setup --------------------------------------------------------------
8+
9+
# If extensions (or modules to document with autodoc) are in another directory,
10+
# add these directories to sys.path here. If the directory is relative to the
11+
# documentation root, use os.path.abspath to make it absolute, like shown here.
12+
#
13+
import os
14+
import sys
15+
from datetime import datetime
16+
17+
sys.path.insert(0, os.path.abspath('../'))
18+
19+
import byte_api
20+
21+
# -- Project information -----------------------------------------------------
22+
23+
project = 'byte-api'
24+
25+
copyright = '{:%Y}, {}'.format(
26+
datetime.utcnow(),
27+
byte_api.__author__
28+
)
29+
30+
author = byte_api.__author__
31+
32+
# -- General configuration ---------------------------------------------------
33+
34+
# Add any Sphinx extension module names here, as strings. They can be
35+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
36+
# ones.
37+
extensions = [
38+
'sphinx.ext.napoleon',
39+
]
40+
41+
# Add any paths that contain templates here, relative to this directory.
42+
templates_path = ['templates']
43+
44+
# List of patterns, relative to source directory, that match files and
45+
# directories to ignore when looking for source files.
46+
# This pattern also affects html_static_path and html_extra_path.
47+
exclude_patterns = ['build', 'Thumbs.db', '.DS_Store']
48+
49+
# -- Options for HTML output -------------------------------------------------
50+
51+
# The theme to use for HTML and HTML Help pages. See the documentation for
52+
# a list of builtin themes.
53+
#
54+
html_theme = 'sphinx_rtd_theme'
55+
56+
# Add any paths that contain custom static files (such as style sheets) here,
57+
# relative to this directory. They are copied after the builtin static files,
58+
# so a file named "default.css" will overwrite the builtin "default.css".
59+
# html_static_path = ['static']

docs/index.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Welcome to byte-api's documentation!
2+
====================================
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
:caption: Contents:
7+
8+
9+
10+
Indices and tables
11+
==================
12+
13+
* :ref:`genindex`
14+
* :ref:`modindex`
15+
* :ref:`search`

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
if "%1" == "" goto help
14+
15+
%SPHINXBUILD% >NUL 2>NUL
16+
if errorlevel 9009 (
17+
echo.
18+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
19+
echo.installed, then set the SPHINXBUILD environment variable to point
20+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
21+
echo.may add the Sphinx directory to PATH.
22+
echo.
23+
echo.If you don't have Sphinx installed, grab it from
24+
echo.http://sphinx-doc.org/
25+
exit /b 1
26+
)
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
requests
2+
pytest
3+
sphinx
4+
sphinx_rtd_theme

0 commit comments

Comments
 (0)