Skip to content

Commit a880c95

Browse files
committed
added gcs config file
1 parent b339e2c commit a880c95

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
gcsRes.json
2+
__pycache__/config_cse.cpython-38.pyc
3+
__pycache__/google_custom_search.cpython-38.pyc

config_cse.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def varconf():
2+
GCS_KEY = '123456789012345678901234567890123456789' # Google Custom Search API key
3+
GCS_CX = '123456789012345678901234567890123' # search engine
4+
return GCS_KEY, GCS_CX

google_custom_search.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import os
22
import urllib.request
33
import json
4+
import config_cse
5+
GCS_KEY, GCS_CX = config_cse.varconf()
46

57
path = os.path.dirname(__file__)+'/'
6-
#req = 'my%20little%20pony' # Search request
7-
GCS_KEY = 'xxx' # Google Custom Search API key
8-
GCS_CX = 'zzz' # search engine
9-
gcsMaxResults = 30 # should be < 100 and (%10 == 0)
8+
gcsMaxResults = 30 # should be < 100 and (%10 == 0)
109
filename = 'gcsRes.json'
1110

1211
def create_url(gcs_req, start=1):

test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import sys
33
import json
44
sys.path.append(os.path.dirname(__file__)+'/..')
5-
from ws_snd import google_custom_search as gcs
5+
import google_custom_search as gcs
66

77
links = []
88
path = os.path.dirname(__file__)+'/'

0 commit comments

Comments
 (0)