csparpa / pyowm

A Python wrapper around the OpenWeatherMap web API
https://pyowm.readthedocs.io
MIT License
789 stars 171 forks source link

New matching method #348

Closed romanstetsyk closed 3 years ago

romanstetsyk commented 3 years ago

When you search for a city by name, three matchings are available: 'exact', 'nocase', and 'like'. They were not suitable for the app I'm working on, so I came up with a new matching that I called 'startswith'. It matches the city from the beginning of the name, and you don't have to type the entire name. Please see the screenshot to understand better what it looks like and how it is different from 'like'. Like other matchings, it works with "geopoints_for", "ids_for", "locations_for". I haven't written any unit tests, though. I wanted to contribute to this project, but it requires a lot of work with testing and documentation changes (at least at first glance). I'm not even sure if it's something anyone needs except me. So I wanted to ask your opinion on this. Would this feature be useful? Thanks.

image

csparpa commented 3 years ago

Hello, It definitely would!! would you submit a PR with a few tests an docs fixes? I can integrate it further if you don't have the time. but anyway, no hurry on this. thanks!

romanstetsyk commented 3 years ago

Yes, I'll write a few tests and submit a PR when I have more free time. Thanks for your reply!