The FactorDB client library with Python
Project description
factordb-python
The FactorDB is the database to store known factorizations for any number. This tool can use on your command line. And also you can use this tool with python 2 & 3 scripts.
Installation
The easiest way to install factordb-pycli is to use pip:
$ pip install factordb-pycli
or, if you are not installing in a virtualenv
:
$ sudo pip install factordb-pycli
If you have the factordb-pycli installed and want to upgrade to the latest version you can run:
$ pip install --upgrade factordb-pycli
Getting Started
CLI
If you want to know the result of factorization of 16, you should type like this:
$ factordb 16
Then, you can get the answer from factordb.com.
$ factordb 16
2 2 2 2
If you want to know more detail of result, you can get an answer of JSON format.
$ factordb --json 16
{"id": "http://factordb.com/?id=2", "status": "FF", "factors": [2, 2, 2, 2]}
Library usage
If you want to use this script with Python, you should type import
statement on your code like this:
from factordb.factordb import FactorDB
Then, you can get the answer with Python lists.
In [1]: from factordb.factordb import FactorDB
In [2]: f = FactorDB(16)
In [3]: f.get_factor_list()
Out[3]: []
In [4]: f.connect()
Out[4]: <Response [200]>
In [5]: f.get_factor_list()
Out[5]: [2, 2, 2, 2]
In [6]: f.get_factor_from_api()
Out[6]: [['2', 4]]
In [7]: f.get_status()
Out[7]: 'FF'
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file factordb-pycli-1.3.0.tar.gz
.
File metadata
- Download URL: factordb-pycli-1.3.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43cf2a672fc49c389f9dd9a7656890973aaa65f9bd2d87165ca4e7a996f7da6b |
|
MD5 | 2ae265a877e5e5ae65498a8013de5fbb |
|
BLAKE2b-256 | 0bab26e2fcfd00a601f76244c07af3e0428938050e9b93d96833845414db334d |