Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python request coinmarketcap

#This example uses Python 2.7 and the python-request library.

from requests import Request, Session
from requests.exceptions import ConnectionError, Timeout, TooManyRedirects
import json

url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest'
parameters = {
  'start':'1',
  'limit':'5000',
  'convert':'USD'
}
headers = {
  'Accepts': 'application/json',
  'X-CMC_PRO_API_KEY': 'Your API KEY',
}

session = Session()
session.headers.update(headers)

try:
  response = session.get(url, params=parameters)
  data = json.loads(response.text)
  print(data)
except (ConnectionError, Timeout, TooManyRedirects) as e:
  print(e)
Comment

PREVIOUS NEXT
Code Example
Python :: python how to find circumference of a circle 
Python :: datetime.time to seconds 
Python :: python remove lines of string 
Python :: how to print horizontally in python 
Python :: Creating a Pandas Data Frame Series 
Python :: Python of add two numbers 
Python :: dict get list of values 
Python :: cli args python 
Python :: python file to list 
Python :: manage.py startapp not working in django 
Python :: urllib download file to folder 
Python :: combine two columns pandas 
Python :: read .mat file in python 
Python :: insert column in a dataframe 
Python :: end in print python 
Python :: fullscreen cmd with python 
Python :: numpy mean 
Python :: python shuffle 
Python :: import discord 
Python :: longest common subsequence python 
Python :: extract DATE from pandas 
Python :: parentheses in python 
Python :: csv len python 
Python :: python move and rename files 
Python :: append write python 
Python :: code to printing a binary search tree in python 
Python :: streamlit install 
Python :: Convert column as array to column as string before saving to csv 
Python :: how to make a python terminal 
Python :: python convert string to int 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =