Ура УРА УРА !!! вперед делать приложухи
[quote=“DimaFern;640”][/quote]
Any chance of adding the rig local ip to the status response?
Actually I’ve just found it in GetRigs so no worries.
I’m trying the API using the Requests python package without success. API always returning “method no given”.
{
"error": {
"code": -32601,
"message": "method not given"
},
"id": null,
"jsonrpc": "2.0"
}
It would be nice to add some Python code example, as I’m not able to use the api with python.
Here come’s the snippet i’m using with python. I’m sure that i’m doing something wrong, but dunno whats wrong…
The HMAC generating OK, i’m passing OK the params trought the request.post function, but API still saying no method issued. So weird.
def minerStatsHiveOS():
api_key = 'api_key'
secret_key = 'secret_key'
import requests, json, datetime, hmac, hashlib, urllib, pycurl
url = 'https://api.hiveos.farm/worker/eypiay.php'
method = 'getRigs'
payload = {'public_key': api_key, 'method': method}
hmac_value = hmac.new(key=secret_key, msg=urllib.urlencode(payload), digestmod=hashlib.sha256).hexdigest()
print hmac_value
headers = {'HMAC': hmac_value}
resp = requests.post(url=url, params=payload, headers=headers)
data = json.loads(resp.text)
return make_response(jsonify(data), 200)
Ok. Now I see there are new python examples (they weren’t first day the post came up). So it’s working okay with CURL but no with Requests… Weird…
@dawy you are sending a POST request, you probably need to send a GET. Change requests.post
to requests.get
and see if it works
Hi! Great work.
Need to return Red Temp value, I suggest it must be in getCurrentStats method.
I need it to check temp and fans (I make a telegram bot)
В python скрипте на 193 строке нужно заменить return ocs на return stats
fixed. thanks.
red temp is added into new field user.red_temp
I’m sending a POST request to https://api.hiveos.farm/worker/eypiay.php?method=getCurrentStats&public_key=<public_key> with Postman.app
And I keep getting:
{
"error": {
"code": -32601,
"message": "method not given"
},
"id": null,
"jsonrpc": "2.0"
}
HMAC generation is OK.
I get it now, I need a pre-request script to generate the HMAC sha256 signature. Anyone have an example in JS?
very nice! thanks for this enhancement!
Отлично! спасибо, пробуем…
function for calculate hmac value on android
static String HmacValue(String key, String data) throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException, DecoderException {
String returnString = "";
try {
SecretKeySpec secret_key = new SecretKeySpec(key.getBytes(UTF_8), "HmacSHA256");
Mac sha256_HMAC = Mac.getInstance("HmacSHA256");
sha256_HMAC.init(secret_key);
returnString = new String(Hex.encodeHex(sha256_HMAC.doFinal(data.getBytes("UTF-8"))));
Log.w(LOG_TAG,"retSrng "+returnString);
}catch (Exception e){
Log.e(LOG_TAG,"err in hmac encoding");
e.printStackTrace();
}
return returnString;
}
@DimaFern, may be possible to implement create QR-Code with secret and public key in personal account?
Хотел бы сделать клиентское приложение на nativeScript, но для этого нужно вам настроить сервер на Cross-Origin Resource Sharing (CORS), иначе из localhost’a отправляется сначала запрос OPTIONS, сервер отвечает отказом (не настроен получать такой метод) и собственно POST не отправляется.
И сколько я не мучался отправлять разные запросы с разными параметрами и даже танцевал голый с бубном, ошибка одна и та же -32601
Поделитесь запросом на JS (axios)
fixed. thanks.
red temp is added into new field user.red_temp[/quote]
Спасибо, свойство red_temp вижу,
но оно всегда приходит как “{” http://forum.hiveos.farm/uploads/editor/5k/fngwi11ufxdr.png
Также хочу попросить возвращать значение баланса лицевого счета, в виде свойства balance в секции user
I make my own code for nodejs / express , not complete but its work
var express = require('express');
var router = express.Router();
var request = require('request');
var CryptoJS = require("crypto-js");
/* GET home page. */
router.get('/api/:public_key/:secret_key/:method', function (req, res, next) {
var key = req.params.secret_key;
var data = 'public_key='+req.params.public_key+'&method='+req.params.method;
var hash = CryptoJS.HmacSHA256(data, key);
const myhmackey = hash.toString();
var options = {
url: 'https://api.hiveos.farm/worker/eypiay.php',
headers: {
'HMAC': myhmackey,
'content-type': 'application/jso'
},
form: {
public_key: req.params.public_key,
method: req.params.method
}
};
function callback(error, response, body) {
//process.stdout.write(getHash(data))
console.log(body)
if (!error && response.statusCode == 200) {
var info = JSON.parse(body);
var re = info;
res.json({
success: true,
data: re.result,
})
}
}
request.post(options, callback);
});
module.exports = router;
вопрос такой. Как отключить 2-ую аутентификацию если потерял телефон и номер
how do i turn on the api access so that i can add my rig running hiveOS to awesome miner ?
hello i installed hiveos app in my samsung phone and it ask me public key (it s ok) and secret apikey , where can i find it or create it?
tks