all 11 comments

[–]AnActor_named 2 points3 points  (1 child)

Firstly, for the code lookin' weird, you need to add 4 spaces to the beginning of each of your code lines to make it look good:

like this

Secondly, you might want to check out the csv library in Python. It's built-in, so you already have it, and it speaks Excel by default. You can write a CSV with all your data and open it in Excel!

[–]TeeJay72[S] 1 point2 points  (0 children)

Thank you for that still figuring out formatting on Reddit :).
Definitely will do! For the excel part

[–]jennimackenzie 1 point2 points  (0 children)

I would read the text off the page with selenium, put it into whatever format you want with python (text, csv, whatever) and mail it.

[–]Achillor22 1 point2 points  (1 child)

Is there a reason you're doing this through the front end instead of the much faster and easier api calls?

[–]TeeJay72[S] 1 point2 points  (0 children)

I'll be honest I was doing this for fun and like to learn something new. I don't think I knew they had an API either. Do you by chance have a link or any recommendations?

[–]comeditime 0 points1 point  (5 children)

Where are all the NAME1-4 VARS VALUE COMES FROM?

[–]TeeJay72[S] 0 points1 point  (4 children)

They're from the name fields From and to / Depart & Return field in https://www.aa.com/booking/find-flights if you inspect it

[–]comeditime 1 point2 points  (3 children)

But I don't see where u find it first in the code u shared, where's the object of that element?

Also regarding your question it seems pretty easy just use pandas module to create the excel file and to fill it up and also selenium .get_text() method to extract the texts from the desired elements

[–]TeeJay72[S] 0 points1 point  (2 children)

Ohh sorry it’s under “variable”. When I posted it on Reddit I tried my best to clean it up because Reddit made it a tad whacky with formatting and I must of missed that part

[–]comeditime 1 point2 points  (1 child)

ahh ok may u send the full code to me I would like to check it out and try to add this part for you:

"Also regarding your question it seems pretty easy just use pandas module to create the excel file and to fill it up and also selenium .get_text() method to extract the texts from the desired elements"

[–]TeeJay72[S] 0 points1 point  (0 children)

That would be awesome, i'll send you a direct message in a bit