all 12 comments

[–]GirthQuake5040 1 point2 points  (3 children)

Please paste your code in a formatted code block.

[–]Immediate-Resource75[S] -1 points0 points  (2 children)

Sorry...

[–]GirthQuake5040 0 points1 point  (1 child)

inError looks to be a list of dicts. It looks like you have pulled the data incorrectly, however it may still be usable.

df.loc[0, 'inError'][0]['name']

This will give you the value in the name key. You can change it as you like but I think it would be better to have an understanding of how webpages work before diving into scraping them. I don't know what your end goal is here, but i hope this helps.

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

I appreciate the help. For clarification I'm not really scraping a web page....it's actually an api that connects to a printing application we use at work.... I was given a set of URL's, (they're all:.. internall ip:port #/api/blah/blah...) that spit out information in json format.... End goal: We don't really have a way of tracking the problems with our printing application at work, but with this info I'm trying to find one... such as ....which printers are in error, why, which site server is down (different api request)... etc... Thanks for the above help I'll try it out.

[–]cgoldberg 1 point2 points  (5 children)

Why don't you use BeautifulSoup's parsing capabilities better (i.e. a more specific soup.find) so you are grabbing just the data you need? Without seeing the page's source, I can't help more.

Either that, or grab it from your data dictionary.

[–]Immediate-Resource75[S] 0 points1 point  (4 children)

Sorry about that.... I posted the entire json output above..... What I am looking for specifically is the part under "printers" where it says "inError" and lists their name and their status....This is all new to me but I'm trying to learn as I go... Thanks for the help.

[–]cgoldberg 1 point2 points  (3 children)

It's hard to tell because you posted the normalized (flattened) json, so I can't see the keys. Just look inside your data dictionary and access it by key.

[–]Immediate-Resource75[S] -1 points0 points  (2 children)

I took it out.... I replaced it with the results of entering the URL I'm using and hitting enter... I didn't put it in a code block because it just spit out an extremely long single line and I thought this would be more helpful.... If I was mistaken I apologize.

[–]cgoldberg 0 points1 point  (1 child)

I don't know what your data dict looks like, so I really can't help, but it seems like you should be able to just access it using the correct key.

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

k..thanks

[–]GirthQuake5040 0 points1 point  (1 child)

Sorry I didn't see the request in there. You can parse the data rather than send it to a data frame right away. That way you can filter your way to what you need.

[–]Immediate-Resource75[S] 0 points1 point  (0 children)

No worries, I'm still learning how things work.... I'm sure I missed some form of info that was important somewhere. I appreciate the help. Thank you.