Share your "about:you;" submissions here!

← Back to all posts
About Foster_Bryant
Foster_Bryant (100)

It displays information about me and it shows real time data fo the stocks in my personal portfolio. lol I didn't know what to make.

EDIT: I was the first to post on challenge :O

Commentshotnewtop
gatorade322 (57)

Traceback (most recent call last):
File "main.py", line 29 in <module>
price = soup.find("div", {"class": "D(ib) Va(m) Maw(65%)--tab768 Ov(h)"}).find("span")
AttributeError: 'NoneType' object has no attribute 'find'

BAD ERROR! ):

WilliamB (7)

So simple but so good - I like it a lot

Foster_Bryant (100)

@WilliamB wow thanks. I made this in 5 minutes during the middle of class tho lol

kingretracted (27)

:clap:
When you grab the data from the website, how do you separate the text? If you could can you tell me how to separate with classes?

Foster_Bryant (100)

@kingretracted Yeah gimme a sec im gonna try to explain as best as I can in a few mins lol

Foster_Bryant (100)

@kingretracted to seperate it by class u do for example:
$ python

import requests
from bs4 import BeautifulSoup

soup.find("div", {"class":"usernames"})

The format for it is:

import requests
from bs4 import BeautifulSoup

soup.find("html tag name", {"type of css selector":"name of the css selector"})

and to get the text just do for example:

import requests
from bs4 import BeautifulSoup

print(soup.find("div", {"tbody":"esdhfesj sefjsejses"}).get_text())

Please add me to a repl.it or ask for further help if u need it cus it's kidna hard for me to explain things ;-;

kingretracted (27)

How do I add you? I'll try this out, looks amazing!

@Foster_Bryant

Foster_Bryant (100)

@kingretracted if you go to a repl you can clcik the purple invite button lol its to the left of the run button or atleast near it usually. :P also thx

neronesh (20)

It was nice.
Then last minute
BOOM!
Error
Why?

Foster_Bryant (100)

@neronesh It's old, it used to work but yahoo changed something in their website that made this program not work.

gatorade322 (57)

do think you could make it so it works again in a newer version? I want to see what happens. I know, I could just read the code but . . . SERIOUSLY?

techteamwalker (7)

When I tried to do it, it said that there was an error on line 29. Just want to let you know.

jackng12 (0)

so simple but good thing

HahaYes (889)

Was this the Stock Market game?

NarwhalFanatic (21)

Umm it's giving an error when I press enter???

nN34398Ff (84)

atribute error: 'NoneType' object has no attribute find

Foster_Bryant (100)

@nN34398Ff You probably ran the program after 4 PM or before 9:30 AM

JacobMacLeod (11)

Wow, you got Beautiful Soup working? I have been trying for ages! Do you know how to get information inside a table, like Crypto names and prices from Coin Gecko?

Foster_Bryant (100)

@JacobMacLeod When I get out of school maybe I can help you. Also wdym by a table? Do u mean like with pandas? But yeah I can help u with coingecko beautiful soup probably when i get out of school

JacobMacLeod (11)

@Foster_Bryant Ok, here is a screenshot:

As you can see in the middle-right, in the highlighted part, it shows the price of bitcoin ($8647.97) and the name of bitcoin(BTC). My question is, how do I get these values (and store them in a variable)? It looks like they are in an HTML span tag inside a class that is inside a table.

Foster_Bryant (100)

@JacobMacLeod

import requests
from bs4 import BeautifulSoup

bruh = soup.find("span", {"class":"no-wrap"}).get_text()

^ This might work but I haven't tested it since I'm in the middle of class. maybe try printing the code I wrote above and see it's output. Don't forget the header and url that u need for beautiful soup. if you're confused reply to this comment I can help u

Foster_Bryant (100)

@JacobMacLeod nvm I made a program that gets this price. ask questions if u need too https://repl.it/@Foster_Bryant/coingecko

generationXcode (131)

Is this a mutual fund? Because how can you invest in equity before you become an adult?
Thanks!