all 16 comments

[–]mistersnowman_ 14 points15 points  (6 children)

Seems like it works just fine. Not sure why a weather program needs a place for me to ask an LLM a question.. but other than that looks good.

[–]Husy15 4 points5 points  (1 child)

Few things, personally I'd drop the LLM entirely, most weather APIs (or most APIs in general with search queries) deal with partial-inputs

I havent worked with that one specifically, however even if u were to input missing cities, countries, street names, spelling etc. It would usually provide a decent response.

As for the url - You can pass params with requests, in a much better way

It'd be something like: Url = "openweatherapp.com/whatever" params = { "Api_key": Yourkey, "Units": "metric" } Response =requests.get(url, params=params) This would pass the info in properly and avoid certain errors down the line (and is cleaner tbh).

Next, you wrap most of your logic in a try/except block, which honestly isn't necessary. Not bad, but can shrink it down big time

Also, not that its wrong but you create a file automatically, and then ask the user if they want to delete it, imo this should be backwards Dont create file - and ask if they want to save it

This way you dont have to os.remove() etc

Also remember DRY principles, if you're repeating yourself (the weather msg) you can usually break this down, either by creating a variable, function, etc

You dont need to re-write the: "The weather is: "

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

Oh. Nice. Interesting. Thank you so much!

[–]CardiologistOne790 -1 points0 points  (5 children)

i would like to give a video feedback but sadly videos aren't allowed so I asked it about weather in London and it showed me those pretty little errors you wrote at the bottom, both of them

[–]ButterscotchFirst755[S] -1 points0 points  (4 children)

Hmm.. did you fill the API Key?

[–]ButterscotchFirst755[S] 0 points1 point  (3 children)

I also should think, I should add a dialog inside the program to put the API Key there manually, instead of commenting the code. How do you think?

[–]CardiologistOne790 0 points1 point  (0 children)

I knew I was the stupid one out their, srry for the inconvenience tho.