Skip to content

Getting error 403,Tried replacing token with a new one, used try except clause #54

@Shanu2092

Description

@Shanu2092

final_dataframe = pd.DataFrame(columns = mycolumns)

for stock in stocks['Ticker']:
api_url = f'https://sandbox.iexapis.com/stable/stock/{stock}/quote/?token=sk_b92781ff259841bead23d3012a9f8cf3'
data = requests.get(api_url)

if data.status_code == 200:
    data = data.json()
    final_dataframe = final_dataframe.append(
        pd.Series(
            [stock, data['latestPrice'], data['marketCap'], 'N/A'], 
            index = mycolumns
        ), 
        ignore_index = True
    )
else:
    print(f'An error occurred, status code: {data.status_code}')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions