Skip to content

Commit

Permalink
Merge pull request xtekky#144 from Joonsey/main
Browse files Browse the repository at this point in the history
fixes xtekky#143 missing cf_clearance raises error
  • Loading branch information
xtekky authored Apr 26, 2023
2 parents 7e858de + 592bbaa commit 0265144
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions phind/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class Search:
def create(prompt: str, actualSearch: bool = True, language: str = 'en') -> dict: # None = no search
if user_agent == '':
raise ValueError('user_agent must be set, refer to documentation')
if cf_clearance == '' :
raise ValueError('cf_clearance must be set, refer to documentation')

if not actualSearch:
return {
Expand Down Expand Up @@ -106,8 +108,11 @@ def create(
codeContext: str = '',
language: str = 'en') -> PhindResponse:

if user_agent == '':
if user_agent == '' :
raise ValueError('user_agent must be set, refer to documentation')

if cf_clearance == '' :
raise ValueError('cf_clearance must be set, refer to documentation')

if results is None:
results = Search.create(prompt, actualSearch = True)
Expand Down Expand Up @@ -235,6 +240,8 @@ def create(

if user_agent == '':
raise ValueError('user_agent must be set, refer to documentation')
if cf_clearance == '' :
raise ValueError('cf_clearance must be set, refer to documentation')

if results is None:
results = Search.create(prompt, actualSearch = True)
Expand Down Expand Up @@ -281,4 +288,4 @@ def create(

@staticmethod
def handle_stream_response(response):
StreamingCompletion.message_queue.put(response)
StreamingCompletion.message_queue.put(response)

0 comments on commit 0265144

Please sign in to comment.