vendredi 25 juin 2021

Requests library not working? Nothing appears in console

import requests
from bs4 import BeautifulSoup as BS
import tkinter as tk


class Scraping:

    @classmethod
    def get_to_site(cls, stock_name):
        sitename = 'https://www.nasdaq.com/market-activity/stocks/' + stock_name
        site = requests.get(f'{sitename}')
        print(site.status_code)
        

    def get_price():
        pass


class GUI:
    pass

Scraping.get_to_site('tsla')

So I'm doing an app that should take stock prices from a site and show them graphically. I had barely started when a problem occured. I tried to print the status code of my requests site to check if it finds the right site. When I run this, nothing appears to the console. Console looks like this:

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS C:\Users\Aatu\Documents\python\pythonleikit> & C:/Python39ni/python.exe c:/Users/Aatu/Documents/python/pythonleikit/stock_price_scraper.py

I've waited for a long time to have something appearing in the console but nothing happened. Why?




Aucun commentaire:

Enregistrer un commentaire