Skip to content

rainleander/indroid-python-requests

Repository files navigation

indroid-python-requests

During an interview with Indroid, the technical interview was a homework. The original email was quite intimidating, "1. make a function that accepts a string and returns the Google-results using python and the results-module. 2. make a function that accepts a string and returns the google results using python and selenium. Selenium controls a browser and uses Firefox as default."

One of the first things I did was re-arrange the two part assignment into smaller pieces for better google-a-bility (yes, it's a word):

  1. Make a function
    • accepts a string
    • returns the Google-results
    • use Python and the requests-module
  2. make a function
    • accepts a string
    • returns the Google results
    • use Python and Selenium
      • which controls a browser (default: Firefox).

requests-simple.py

Scrape Google search results with the requests python module.

Dependencies

  • python 2.7

Installation

```shell pip install requests git clone https://github.com/rainsdance/indroid-python-requests cd indroid-python-requests ```

Use

```shell python requests-simple.py ```

Script prompts for a string (What would you like to search for?) and then an integer (How many results would you like to see?) and returns the unformatted google results.

selenium-complex.py

Scrape Google search results with Selenium based on https://github.com/DanMcInerney/search-google

Dependencies

  • python 2.7
  • Selenium

Installation

```shell pip install selenium git clone https://github.com/rainsdance/indroid-python-requests cd indroid-python-requests ```

Use

```shell python selenium-complex.py -s "foo bar test" ```

Will open the firefox browser, search for "foo bar test" on google.com and return one page of ten results with the title and url of each result.

About

Junior Application Developer at indroid

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages