Không có mô tả

JoostSijm a91de04627 Improve war info 4 năm trước cách đây
src a91de04627 Improve war info 4 năm trước cách đây
tests a91de04627 Improve war info 4 năm trước cách đây
.gitignore 49457a811c Update gitignore 4 năm trước cách đây
LICENSE baaed2455a Add setup.py and license, moved some files 4 năm trước cách đây
Pipfile d2cda50cf6 Add missing packages 4 năm trước cách đây
Pipfile.lock d2cda50cf6 Add missing packages 4 năm trước cách đây
README.md b773e40c68 Update readme 4 năm trước cách đây
setup.py d2cda50cf6 Add missing packages 4 năm trước cách đây
tox.ini 5bdd799a79 Remove python 2.7 from tox test 4 năm trước cách đây

README.md

Rival-Regions-Wrapper

This library will functions as an API wrapper for interaction with Rival Regions.

Install

The following steps can be used to install the package with pip:

  • clone the repository: git clone git@github.com:jjoo914/rival_regions_wrapper.git
  • use pip to install the package: pip install rival_regions_wrapper

The package should be available globaly.

Pipenv

When you want to add the package to a Pipfile, use the folowing command:

pipenv install -e git+https://github.com/jjoo914/rival_regions_wrapper#egg=rival_regions_wrapper

Testing

After installing you should be able to test the python package with pytest. These are located in rival_regions_wrapper/tests/. Requests are cached for quick testing using VCR.py located at rival_regions_wrapper/tests/cassettes/.

Middleware

The API wrapper uses middleware to decide where how to send the request. Middlewares can also be used to write direct requests to Rival Regions.

Current middleware

LocalAuthentication

Use username, password, and login method to log in local instance of the authenticator.

RemoteAuthentication

Connect through a remote API using URL and authentication key.

Examples

Create local authentication middleman after that log in with environ variables and request region page from Rival Regions

import os
from rival_regions_wrapper import LocalAuthentication

middleware = LocalAuthentication(
  os.environ["USERNAME"],
  os.environ["PASSWORD"],
  os.environ["LOGIN_METHOD"]
)

region = middleware.get('listed/upgrades/{}'.format(region_id))

Contact