Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- # Set the request parameters
- url = 'https://cryptohub.online/api/market/ticker/PLSR/'
- # Fetch url
- print("Fetching url..")
- # Do the HTTP get request
- response = requests.get(url, verify=True) #Verify is check SSL certificate
- # Error handling
- # Check for HTTP codes other than 200
- if response.status_code != 200:
- print('Status:', response.status_code, 'Problem with the request. Exiting.')
- exit()
- # Decode the JSON response into a dictionary and use the data
- data = response.json()
- visitors = data["id"]
- print('nVisitors today:'), visitors
- # code ends
- -=- Tried that, then tried this: -=-
- import urllib
- import requests
- import json
- api = 'https://cryptohub.online/api/market/ticker/PLSR/'
- url = api
- json_data = requests.get(url).json()
- jsonList = json.load(json_data)
- print (json_data[id])
- -=- Tried this as well: -=-
- import json
- import requests
- url = 'https://cryptohub.online/api/market/ticker/PLSR/'
- response = requests.get(url, verify=True)
- data = response.json()
- json_data = data['quoteVolume']
- python_obj = json.loads(json_data)
- print (python_obj["id"])
- -=- If any code is incomplete, its probably because I messed with it to try and make it work. -=-
Advertisement
Add Comment
Please, Sign In to add comment