GithubHelp home page GithubHelp logo

xrea's Introduction

XREA API wrapper

This package is simple implementation of XREA API(https://apidoc.xrea.com) wrapper with Python 3.

"XREA" is the web hosting service in Japan.

Short description in Japanese

このPythonパッケージはXREA API(https://apidoc.xrea.com)のラッパーです。 Python3系(3.4以降)で使えます。

Supported services

Requirements

works with

  • Python 3.4+
  • requests

Installation

via pipenv

$ pipenv install xrea

via pip

$ pip install xrea

via setup.py

$ python setup.py install

Examples

Init:

>>> from xrea import Xrea # for CoreServer: from xrea import CoreServer
...
... account = "foo" # your account
... server_name = "z123456.xrea.com" # your server
... api_secret_key = "zajxTrzkHBGkRRfvWs5w397jZFqQKC8L" # your api_secret_key
>>> xrea = Xrea(account=account, server_name=server_name, api_secret_key=api_secret_key)

# for CoreServer
# xrea = CoreServer(account=account, server_name=server_name, api_secret_key=api_secret_key)

Call site/list without optional params:

>>> response = xrea.site.list()
>>> pprint(response.result)
{'1': {'domain': 'blank',
       'ip': '11.22.33.44,
       'no': 1,
       'nodir': 0,
       'phpver': 'php71',
       'redirect_url': '',
       'ssl_info': [],
       'ssl_status': 0},
 '2': {'domain': 'abcde.example.info',
       'ip': '11.22.33.44',
       'no': 2,
       'nodir': 0,
       'phpver': 'php71',
       'redirect_url': '',
       'ssl_info': [],
       'ssl_status': 1}}

Call log/log_list with optional params:

>>> response2 = xrea.log.log_list(type='analog')
>>> pprint(response2.result)
{'abcde.example.info': [{'filedate': '2018-01-14',
                         'filename': 'abcde.example.info.html'},
                        {'filedate': '2018-01-13',
                         'filename': 'abcde.example.info.1.html'}]}

Call aaa/bbb (not valid)

>>> response3 = xrea.aaa.bbb(foo='12345')
xrea.error.XreaApiResponseError: [status: 404, error: 100002]page_name:正しくありません

Author

NAKAMORI Ryosuke - https://github.com/tpdn

Licence

BSD-2-Clause

xrea's People

Contributors

tpdn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.