diff --git a/README.md b/README.md index c64b615..ad4bca1 100644 --- a/README.md +++ b/README.md @@ -61,14 +61,14 @@ Google-Search-API folder. ```python import os os.chdir("C:\Path_where_repo_is") -from google import google +from googleapi import google ``` ## Google Web Search You can search google web in the following way: ```python -from google import google +from googleapi import google num_page = 3 search_results = google.search("This is my query", num_page) ``` @@ -96,7 +96,7 @@ GoogleResult: Attempts to search google calculator for the result of an expression. Returns a `CalculatorResult` if successful or `None` if it fails. ```python -from google import google +from googleapi import google google.calculate("157.3kg in grams") ``` @@ -122,7 +122,7 @@ Image search uses the selenium & the Firefox driver, therefor you MUST have [Fir Perform a google image search on "banana" and filter it: ```python -from google import google, images +from googleapi import google, images options = images.ImageOptions() options.image_type = images.ImageType.CLIPART options.larger_than = images.LargerThan.MP_4 @@ -235,7 +235,7 @@ Convert between one currency and another using google calculator. Results are re Convert 5 US Dollars to Euros using the official 3 letter currency acronym ([ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)): ```python -from google import google +from googleapi import google euros = google.convert_currency(5.0, "USD", "EUR") print "5.0 USD = {0} EUR".format(euros) ``` diff --git a/google/.DS_Store b/google/.DS_Store deleted file mode 100644 index 1905505..0000000 Binary files a/google/.DS_Store and /dev/null differ diff --git a/google/__init__.py b/googleapi/__init__.py similarity index 100% rename from google/__init__.py rename to googleapi/__init__.py diff --git a/google/google.py b/googleapi/google.py similarity index 100% rename from google/google.py rename to googleapi/google.py diff --git a/google/modules/__init__.py b/googleapi/modules/__init__.py similarity index 100% rename from google/modules/__init__.py rename to googleapi/modules/__init__.py diff --git a/google/modules/calculator.py b/googleapi/modules/calculator.py similarity index 100% rename from google/modules/calculator.py rename to googleapi/modules/calculator.py diff --git a/google/modules/currency.py b/googleapi/modules/currency.py similarity index 100% rename from google/modules/currency.py rename to googleapi/modules/currency.py diff --git a/google/modules/images.py b/googleapi/modules/images.py similarity index 100% rename from google/modules/images.py rename to googleapi/modules/images.py diff --git a/google/modules/shopping_search.py b/googleapi/modules/shopping_search.py similarity index 100% rename from google/modules/shopping_search.py rename to googleapi/modules/shopping_search.py diff --git a/google/modules/standard_search.py b/googleapi/modules/standard_search.py similarity index 98% rename from google/modules/standard_search.py rename to googleapi/modules/standard_search.py index 8f5fa06..7862940 100644 --- a/google/modules/standard_search.py +++ b/googleapi/modules/standard_search.py @@ -188,9 +188,9 @@ def _get_description(li): TODO: There are some text encoding problems to resolve.""" - sdiv = li.find("div", attrs={"class": "s"}) + sdiv = li.find("div", attrs={"class": "IsZvec"}) if sdiv: - stspan = sdiv.find("span", attrs={"class": "st"}) + stspan = sdiv.find("span", attrs={"class": "aCOpRe"}) if stspan is not None: # return stspan.text.encode("utf-8").strip() return stspan.text.strip() diff --git a/google/modules/utils.py b/googleapi/modules/utils.py similarity index 100% rename from google/modules/utils.py rename to googleapi/modules/utils.py diff --git a/google/tests/__init__.py b/googleapi/tests/__init__.py similarity index 100% rename from google/tests/__init__.py rename to googleapi/tests/__init__.py diff --git a/google/tests/html_files/test_calculator.html b/googleapi/tests/html_files/test_calculator.html similarity index 100% rename from google/tests/html_files/test_calculator.html rename to googleapi/tests/html_files/test_calculator.html diff --git a/google/tests/html_files/test_convert_currency.html b/googleapi/tests/html_files/test_convert_currency.html similarity index 100% rename from google/tests/html_files/test_convert_currency.html rename to googleapi/tests/html_files/test_convert_currency.html diff --git a/google/tests/html_files/test_exchange_rate.html b/googleapi/tests/html_files/test_exchange_rate.html similarity index 100% rename from google/tests/html_files/test_exchange_rate.html rename to googleapi/tests/html_files/test_exchange_rate.html diff --git a/google/tests/html_files/test_search_images.html b/googleapi/tests/html_files/test_search_images.html similarity index 100% rename from google/tests/html_files/test_search_images.html rename to googleapi/tests/html_files/test_search_images.html diff --git a/google/tests/html_files/test_shopping_search.html b/googleapi/tests/html_files/test_shopping_search.html similarity index 100% rename from google/tests/html_files/test_shopping_search.html rename to googleapi/tests/html_files/test_shopping_search.html diff --git a/google/tests/html_files/test_standard_search.html b/googleapi/tests/html_files/test_standard_search.html similarity index 100% rename from google/tests/html_files/test_standard_search.html rename to googleapi/tests/html_files/test_standard_search.html diff --git a/google/tests/test_google.py b/googleapi/tests/test_google.py similarity index 97% rename from google/tests/test_google.py rename to googleapi/tests/test_google.py index 5a55b5a..ef70f36 100644 --- a/google/tests/test_google.py +++ b/googleapi/tests/test_google.py @@ -1,8 +1,8 @@ from builtins import object import unittest import nose -from google import google -from google import currency, images +from googleapi import google +from googleapi import currency, images, shopping_search from mock import Mock import os import vcr @@ -105,7 +105,7 @@ def test_standard_search(self): def test_shopping_search(self): """Test method for google shopping.""" - shop = google.shopping("Disgaea 4") + shop = google.shopping_search("Disgaea 4") self.assertNotEqual(len(shop), 0) diff --git a/google/tests/test_utils.py b/googleapi/tests/test_utils.py similarity index 92% rename from google/tests/test_utils.py rename to googleapi/tests/test_utils.py index bc51172..c2a3eb1 100644 --- a/google/tests/test_utils.py +++ b/googleapi/tests/test_utils.py @@ -8,7 +8,7 @@ import unittest import nose -from google.modules.utils import _get_search_url +from googleapi.modules.utils import _get_search_url class UtilsTestCase(unittest.TestCase): diff --git a/google/tests/vcr_cassetes/test_convert_currency.yaml b/googleapi/tests/vcr_cassetes/test_convert_currency.yaml similarity index 100% rename from google/tests/vcr_cassetes/test_convert_currency.yaml rename to googleapi/tests/vcr_cassetes/test_convert_currency.yaml diff --git a/google/tests/vcr_cassetes/test_standard_search.yaml b/googleapi/tests/vcr_cassetes/test_standard_search.yaml similarity index 100% rename from google/tests/vcr_cassetes/test_standard_search.yaml rename to googleapi/tests/vcr_cassetes/test_standard_search.yaml diff --git a/setup.cfg b/setup.cfg index a072f69..89920da 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,4 +2,4 @@ verbosity=1 detailed-errors=1 with-coverage=1 -cover-package=google +cover-package=googleapi diff --git a/setup.py b/setup.py index 554365e..8cedf51 100644 --- a/setup.py +++ b/setup.py @@ -25,11 +25,11 @@ maintainer_email='agusbenassi@gmail.com', license='MIT', packages=[ - 'google', - 'google.modules', - 'google.tests' + 'googleapi', + 'googleapi.modules', + 'googleapi.tests' ], - package_dir={'google': 'google'}, + package_dir={'googleapi': 'googleapi'}, include_package_data=True, install_requires=requirements, keywords="google search images api",