Projet

Général

Profil

Révision 6ff34af5

ID6ff34af50ebfa3ccc4a0cfa46f9a73cec363855b
Parent 8a72386a
Enfant 6a0a0c8d

Ajouté par Nils il y a plus de 7 ans

set U as default

Voir les différences:

plugins/currency/zcash/zcash_flypool_hashrate_
85 85
# manage codec and error handling lookup process
86 86
reader = codecs.getreader("utf-8")
87 87

  
88
hash_rate = "U"
89

  
88 90
try:
89 91
    mining_stats = json.load(reader(mining_stats_raw))
90 92
except ValueError:
91 93
    print("Failed to parse JSON responce.", file=sys.stderr)
92
    print("flypool_hs_{}_{}.value U".format(zcash_address, miner))
93 94
else:
94 95
    try:
95 96
        worker = mining_stats['data']
96 97
    except (KeyError, TypeError):
97 98
        print("JSON result error!", file=sys.stderr)
98
        print("flypool_hs_{}_{}.value U".format(zcash_address, miner))
99 99
    else:
100 100
        try:
101 101
            hash_rate = worker['currentHashrate']
102 102
        except (KeyError, TypeError):
103 103
            print("No current Hashrate!", file=sys.stderr)
104
            print("flypool_hs_{}_{}.value U".format(zcash_address, miner))
105
        else:
106
            print("flypool_hs_{}_{}.value {}".format(zcash_address, miner, hash_rate))
104

  
105
print("flypool_hs_{}_{}.value {}".format(zcash_address, miner, hash_rate))

Formats disponibles : Unified diff