Skip to content

Commit 2251c41

Browse files
committed
First Commit
0 parents  commit 2251c41

7 files changed

Lines changed: 491 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Upload to PIP
2+
# Controls when the action will run.
3+
on:
4+
# Triggers the workflow when a release is created
5+
release:
6+
types: [created]
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
11+
jobs:
12+
# This workflow contains a single job called "upload"
13+
upload:
14+
# The type of runner that the job will run on
15+
runs-on: ubuntu-latest
16+
17+
# Steps represent a sequence of tasks that will be executed as part of the job
18+
steps:
19+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
20+
- uses: actions/checkout@v2
21+
22+
# Sets up python
23+
- uses: actions/setup-python@v2
24+
with:
25+
python-version: 3.8
26+
27+
# Install dependencies
28+
- name: "Installs dependencies"
29+
run: |
30+
python3 -m pip install --upgrade pip
31+
python3 -m pip install setuptools wheel twine
32+
# Build and upload to PyPI
33+
- name: "Builds and uploads to PyPI"
34+
run: |
35+
python3 setup.py sdist bdist_wheel
36+
python3 -m twine upload dist/*
37+
env:
38+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
39+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}

MANIFEST.IN

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
global-include *.txt *.py

README.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Nicehash python library and command line rest api
2+
3+
Dependacy
4+
* requests
5+
6+
To install dependencies run following line your favorite shell console
7+
8+
pip install requests
9+
10+
11+
## Required data and where to get it
12+
Following data is needed:
13+
* api base url:
14+
* https://api2.nicehash.com - Production environment
15+
* https://api-test.nicehash.com - Test environment
16+
17+
The documentation how to get organisation id, api key and api key secret is here:
18+
https://github.com/nicehash/rest-clients-demo
19+
20+
## Library usage
21+
Nicehash library is contained in file `nicehash.py`. Api is divided in two part: public and private.
22+
23+
Code snipplet for public api
24+
25+
import nicehash
26+
27+
host = 'https://api2.nicehash.com'
28+
29+
public_api = nicehash.public_api(host)
30+
31+
buy_info = public_api.buy_info()
32+
print(buy_info)
33+
34+
35+
Code snipplet for private api
36+
37+
import nicehash
38+
39+
host = 'https://api2.nicehash.com'
40+
organisation_id = 'Enter your organisation id'
41+
key = 'Enter your api key'
42+
secret = 'Enter your secret for api key'
43+
44+
private_api = nicehash.private_api(host, organisation_id, key, secret)
45+
46+
my_accounts = private_api.get_accounts()
47+
print(my_accounts)
48+
49+
50+
Usage of other api calls are shown in `test_bot.py`
51+
52+
53+
## Command line usage
54+
`nicehash.py` can be used as commad line tools
55+
56+
To get help run:
57+
58+
python nicehash.py -h
59+
60+
Result:
61+
62+
Usage: nicehash.py [options]
63+
64+
Options:
65+
-h, --help show this help message and exit
66+
-b BASE, --base_url=BASE
67+
Api base url
68+
-o ORG, --organization_id=ORG
69+
Organization id
70+
-k KEY, --key=KEY Api key
71+
-s SECRET, --secret=SECRET
72+
Secret for api key
73+
-m METHOD, --method=METHOD
74+
Method for request
75+
-p PATH, --path=PATH Path for request
76+
-q PARAMS, --params=PARAMS
77+
Parameters for request
78+
-d BODY, --body=BODY Body for request
79+
80+
81+
Example usage:
82+
83+
python nicehash.py -b https://api2.nicehash.com -o ca5622bd-bc32-451b-90a4-e9ae1088bade -k 85512ceb-4f37-426e-9fb4-929af9134ed1 -s 11260065-37f9-4875-bbdd-52a59ce7775de2c0596c-5c87-4739-bb60-b3f547612aed -m GET -p /main/api/v2/accounting/accounts/
84+
85+
86+
87+

nicehash/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)