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
**Added**
- added `keywordSearchMode` parameter that can be used in `QueryArticles`, `QueryArticlesIter`, `QueryEvents`, `QueryEventsIter` and `QueryEvent` constructors.
- added `keywordSearchMode` parameter to the advanced query language
**Updated**
- types of parameters in the method calls
- updated several code example files
Copy file name to clipboardExpand all lines: CHANGELOG.md
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,18 @@
1
1
# Change Log
2
2
3
+
## [v9.1]() (2023-06-23)
4
+
5
+
**Added**
6
+
- added `keywordSearchMode` parameter that can be used in `QueryArticles`, `QueryArticlesIter`, `QueryEvents`, `QueryEventsIter` and `QueryEvent` constructors.
7
+
- added `keywordSearchMode` parameter to the advanced query language
"""encode datetime into UTC ISO format which can be sent to ER"""
134
134
ifisinstance(val, datetime.datetime):
135
135
# if we have a datetime in some tz, we convert it first to UTC
136
-
ifval.utcoffset() !=None:
136
+
ifval.utcoffset() isnotNone:
137
137
importpytz
138
138
val=val.astimezone(pytz.utc)
139
139
returnval.isoformat()
140
140
elifisinstance(val, six.string_types):
141
-
assertre.match("^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?$", val), "datetime value '%s' was not provided in the 'YYYY-MM-DDTHH:MM:SS.SSSS' format"% (val)
141
+
assertre.match(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?$", val), f"datetime value '{val}' was not provided in the 'YYYY-MM-DDTHH:MM:SS.SSSS' format"
142
142
returnval
143
143
raiseAssertionError("datetime was not in the recognizable data type. Use datetime or string in ISO format")
# if the user specified the QueryItems class but used the invalid operator type then raise an error
217
-
assertpropOperName!=Noneorvalue.getOper().replace("$", "") ==defaultOperName, "An invalid operator type '%s' was used for property '%s'"% (value.getOper().replace("$", ""), propName)
217
+
assertpropOperNameisnotNoneorvalue.getOper().replace("$", "") ==defaultOperName, "An invalid operator type '%s' was used for property '%s'"% (value.getOper().replace("$", ""), propName)
# if we need to specify the operator for the property
227
-
ifpropOperName!=None:
227
+
ifpropOperNameisnotNone:
228
228
self.queryParams[propOperName] =defaultOperName
229
229
iflen(value) >1:
230
-
logger.warning("Warning: The value of parameter '%s' was provided as a list and '%s' operator was used implicitly between the items. We suggest specifying the list using the QueryItems.AND() or QueryItems.OR() to ensure the appropriate operator is used."% (propName, defaultOperName))
230
+
logger.warning("Warning: The value of parameter '%s' was provided as a list and '%s' operator was used implicitly between the items. We suggest specifying the list using the QueryItems.AND() or QueryItems.OR() to ensure the appropriate operator is used.", propName, defaultOperName)
231
231
232
232
# there should be no other valid types
233
233
else:
234
-
assertFalse, "Parameter '%s' was of unsupported type. It should either be None, a string or an instance of QueryItems"% (propName)
234
+
assertFalse, f"Parameter '{propName}' was of unsupported type. It should either be None, a string or an instance of QueryItems"
Copy file name to clipboardExpand all lines: eventregistry/DailyShares.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@
13
13
# get top shared articles for today or any other day
14
14
classGetTopSharedArticles(QueryParamsBase):
15
15
def__init__(self,
16
-
date: str=None, # specify the date (either in YYYY-MM-DD or datetime.date format) for which to return top shared articles. If None then today is used
16
+
date: Union[str, datetime.date, datetime.datetime, None]=None, # specify the date (either in YYYY-MM-DD or datetime.date format) for which to return top shared articles. If None then today is used
17
17
count: int=20, # number of top shared articles to return
18
18
returnInfo: ReturnInfo=ReturnInfo()):
19
19
QueryParamsBase.__init__(self)
@@ -23,7 +23,7 @@ def __init__(self,
23
23
self._setVal("articlesSortBy", "socialScore")
24
24
self._update(returnInfo.getParams("articles"))
25
25
26
-
ifdate==None:
26
+
ifdateisNone:
27
27
date=datetime.date.today()
28
28
self._setDateVal("dateStart", date)
29
29
self._setDateVal("dateEnd", date)
@@ -36,8 +36,8 @@ def _getPath(self):
36
36
# get top shared events for today or any other day
37
37
classGetTopSharedEvents(QueryParamsBase):
38
38
def__init__(self,
39
-
date: str=None, # specify the date (either in YYYY-MM-DD or datetime.date format) for which to return top shared articles. If None then today is used
40
-
count: int=20, # number of top shared articles to return
39
+
date: Union[str, datetime.date, datetime.datetime, None]=None, # specify the date (either in YYYY-MM-DD or datetime.date format) for which to return top shared articles. If None then today is used
40
+
count: int=20, # number of top shared articles to return
0 commit comments