Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Error:
- 2022.11.26 13:08:38 An error has occured: EAccessViolation Access violation
- 2022.11.26 13:08:38 Shutting down
- Python Code:
- #######################################################################
- # Crypto Currency Dashboard v0.1a #
- # (C) 2021 Richard L. Gattie II #
- # Written for the Radio Freqs & Geeks BBS #
- # Release under Creative Commons License Attribution-ShareAlike 4.0 #
- # https://creativecommons.org/licenses/by-sa/4.0/legalcode #
- # #
- # This code is free to use and redistibute as well as modify, adapt, #
- # and build upon your work even for commercial purposes, as long as #
- # they credit you and license their new creations under the identical #
- # terms. This license is often compared to "copyleft" free and open #
- # source software licenses. All new works based on #
- # yours will carry the same license, so any derivatives will also #
- # allow commercial use. #
- # #
- # Please see the README file for install instructions. #
- # #
- #######################################################################
- #Import da' stuff!
- from mystic_bbs import *
- from requests import Request, Session
- from requests.exceptions import ConnectionError, Timeout, TooManyRedirects
- import mystic_bbs as bbs
- import json
- import sys
- # Where to get the info from
- url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest'
- cc_id = bbs.param_str(1)
- # Grabs data for the Crypto using your API Key
- parameters = {
- 'id':cc_id
- }
- headers = {
- 'Accepts': 'application/json',
- 'X-CMC_PRO_API_KEY': 'XXXXXXXXXXXXXXXXXXXXXXXXXXX',
- }
- session = Session()
- session.headers.update(headers)
- # Try, Try Again.. or ERROR!!!
- try:
- response = session.get(url, params=parameters)
- data = json.loads(response.text)
- # Assign them
- for cc_coin in data['data']:
- cc_coin = str(cc_coin)
- cc_symbol = data['data'][cc_coin]['symbol']
- cc_cost = data['data'][cc_coin]['quote']['USD']['price']
- cc_24vol = data['data'][cc_coin]['quote']['USD']['volume_24h']
- cc_percent1 = data['data'][cc_coin]['quote']['USD']['percent_change_1h']
- cc_percent24 = data['data'][cc_coin]['quote']['USD']['percent_change_24h']
- cc_percent7d = data['data'][cc_coin]['quote']['USD']['percent_change_7d']
- cc_percent30d = data['data'][cc_coin]['quote']['USD']['percent_change_30d']
- cc_lastupdate = data['data'][cc_coin]['quote']['USD']['last_updated']
- # Make Them Strings
- cc_cost = str(cc_cost)
- cc_24vol = str(cc_24vol)
- cc_percent1 = str(cc_percent1)
- cc_percent24 = str(cc_percent24)
- cc_percent7d = str(cc_percent7d)
- cc_percent30d = str(cc_percent30d)
- # Show the goods...
- showfile(cc_symbol+".ANS",0,0,1,0)
- write("|[X51|[Y04|16|09$"+cc_cost)
- write("|[X55|[Y06"+cc_24vol)
- write("|[X55|[Y08"+cc_percent1)
- write("|[X60|[Y10"+cc_percent24)
- write("|[X59|[Y12"+cc_percent7d)
- write("|[X60|[Y14"+cc_percent30d)
- write("|[X00|[Y23|00|PN")
- except (ConnectionError, Timeout, TooManyRedirects) as e:
- print(e)
- else:
- pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement