You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1
Original file line number
Diff line number
Diff line change
@@ -63,6 +63,7 @@ This is a repository of all the tutorials of [The Python Code](https://www.thepy
63
63
-[How to Get the Size of Directories in Python](https://www.thepythoncode.com/article/get-directory-size-in-bytes-using-python). ([code](general/calculate-directory-size))
64
64
-[How to Download Torrent Files in Python](https://www.thepythoncode.com/article/download-torrent-files-in-python). ([code](general/torrent-downloader))
65
65
-[How to Play and Record Audio in Python](https://www.thepythoncode.com/article/play-and-record-audio-sound-in-python). ([code](general/recording-and-playing-audio))
66
+
-[How to Use Google Custom Search Engine API in Python](https://www.thepythoncode.com/article/use-google-custom-search-engine-api-in-python). ([code](general/using-custom-search-engine-api))
# [How to Use Google Custom Search Engine API in Python](https://www.thepythoncode.com/article/use-google-custom-search-engine-api-in-python)
2
+
To run this:
3
+
-`pip3 install -r requirements.txt`
4
+
- You need to setup a CSE account, check [the tutorial](https://www.thepythoncode.com/article/use-google-custom-search-engine-api-in-python) on how you can set up one.
5
+
- Change `API_KEY` and `SEARCH_ENGINE_ID` to yours, and then:
6
+
```
7
+
python search_engine.py "python"
8
+
```
9
+
This will use the query "python" to search for results, here is a cropped output:
10
+
```
11
+
========== Result #1 ==========
12
+
Title: Welcome to Python.org
13
+
Description: The official home of the Python Programming Language.
14
+
URL: https://www.python.org/
15
+
16
+
========== Result #2 ==========
17
+
Title: The Python Tutorial — Python 3.8.2 documentation
18
+
Description: It has efficient high-level data structures and a simple but effective approach to
19
+
object-oriented programming. Python's elegant syntax and dynamic typing,
20
+
together ...
21
+
URL: https://docs.python.org/3/tutorial/
22
+
23
+
========== Result #3 ==========
24
+
Title: Download Python | Python.org
25
+
Description: Looking for Python with a different OS? Python for Windows, Linux/UNIX, Mac OS
26
+
X, Other. Want to help test development versions of Python? Prereleases ...
0 commit comments