This week I began my work on pySearch, a python script dedicated to searching through a variety of search engines, and added functionalities. I learned new things working on this project as I am familiar with python, but not with interacting with the web or search engines. This week I learned the importance of encoding characters in a URL, as well as using regular expression, and browser libraries in python. I learned these through the two issues I tackled this week, some easier than others.
I’ve Got Issues
In my last post I wrote about tackling my personal vendetta with python on windows, however after discussing my first issue with jrkong, it was clear there were additional things that would need to be included in the install for all platforms, and this would need to be completed after solving this issue. The additional installations needed are a detection of browsers on a system, as well as registering each browser appropriately. The pySearch project works with the webbrowser library, which requires a browser to be registered with the name of the browser (eg. ‘firefox’) and the path to the ‘firefox’ application, however due to different installation paths this differs on different systems as well as operating systems. In addition to this issue, I also worked on issue #8, which dealt with encoding unsafe characters in URLs. While this solution did not involve a lot of code, it did involve me learning about the purpose of encoding characters, and how it works with respect to the search engine.
I’ve Got Solutions Too!
The first issue I tackled this week involved getting ideas from the repository manager and project creator, after submitting my initial pull request. After receiving input on a very rough version of the additional browser parameter, it was clear there were a lot of changes to be made, and new features to implement. I began by researching how the webbrowser library works, and the registration of browsers specifically. Until an installation method is created, there is no way to perfect this system, so I have developed a format which should be kept consistent in future iterations. The solution works with any browser that is registered on the system, and will display the available browsers if an invalid one is entered. The solution I created was tested on both Mac OS and Windows, and allows for searching on the following browsers (currently): chrome, firefox, internet explorer, safari. Lastly I researched URL encoding for python and found a quick library called urllib with a utf8 encoding method.
I have a lot of ideas of future plans for the pySearch apps, and know what needs to be added in order to create a solid foundation. This process begins with clean installations for all systems, and registering browsers dynamically to allow for an automated process. I look forward to working on and discussing this project with others as it begins to grow.