Skip to content

Commit d419733

Browse files
committed
changed some typos to 'raise' statements
fixed line 211 to read `if language not in const.language` changed parameter `to_param` to `to`
1 parent aa72b83 commit d419733

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

newsapi/newsapi_client.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -188,27 +188,27 @@ def get_everything(self, q=None, sources=None, domains=None, from_param=None, to
188188
else:
189189
raise ValueError('from_param should be in the format of YYYY-MM-DD')
190190
else:
191-
raist TypeError('from_param should be a string')
191+
raise TypeError('from_param should be a string')
192192

193193
# ... To This Date
194-
if to_param is not None:
195-
if type(to_param) == str:
196-
if (len(to_param)) >= 10:
197-
for i in range(len(to_param)):
198-
if (i == 4 and to_param[i] != '-') or (i == 7 and to_param[i] != '-'):
199-
raise ValueError('to_param should be in the format of YYYY-MM-DD')
194+
if to is not None:
195+
if type(to) == str:
196+
if (len(to)) >= 10:
197+
for i in range(len(to)):
198+
if (i == 4 and to[i] != '-') or (i == 7 and to[i] != '-'):
199+
raise ValueError('to should be in the format of YYYY-MM-DD')
200200
else:
201-
payload['to'] = to_param
201+
payload['to'] = to
202202
else:
203-
raise ValueError('to_param should be in the format of YYYY-MM-DD')
203+
raise ValueError('to param should be in the format of YYYY-MM-DD')
204204
else:
205-
raist TypeError('to_param should be a string')
205+
raise TypeError('to param should be a string')
206206

207207

208208
# Language
209209
if language is not None:
210210
if type(language) == str:
211-
if language is not in const.languages:
211+
if language not in const.languages:
212212
raise ValueError('invalid language')
213213
else:
214214
payload['language'] = language

0 commit comments

Comments
 (0)