back
Back

Could you provide example code to integrate the API?

avatar
Admin
Site Admin
02 June 2022, 10:30

You can use general logic. Get request and JSON parsing:


import requests

url = 'https://stocknewsapi.com/api/v1'

params = dict(
    tickers='TSLA,AMZN,FB',
    items=50,
    token='YOUR_TOKEN',
)

resp = requests.get(url=url, params=params)
data = resp.json() # Data from API

or less code


import requests

url = 'https://stocknewsapi.com/api/v1?tickers=TSLA,AMZN,FB&items=50&token=YOUR_TOKEN'

resp = requests.get(url=url)
data = resp.json() # Data from API

To see the endpoints we provide check our documentation page.