9
9
10
10
11
11
class ScienceDirectSearch (Search ):
12
- """
13
- Interaction with the ScienceDirect Search API using the `PUT` method.
14
- See the official `documentation <https://dev.elsevier.com/tecdoc_sdsearch_migration.html>`__
15
- for more details.
16
- """
17
12
@property
18
13
def results (self ) -> Optional [list ]:
19
14
"""
@@ -76,42 +71,38 @@ def __init__(self,
76
71
** kwds : str
77
72
) -> None :
78
73
"""
79
- Parameters
80
- ----------
81
- query : str
82
- The query to be sent to the API, e.g. '"Neural Networks" AND "Shapley"'
83
-
84
- refresh : bool or int, optional
85
- Whether to refresh the cached file. If an int is passed, the cache
86
- will refresh if older than that many days.
87
-
88
- view : str, optional
89
- The API view to use. Default is "STANDARD".
90
-
91
- verbose : bool, optional
92
- Whether to print a download progress bar.
93
-
94
- download : bool, optional
95
- Whether to download results (if they haven't been cached).
96
-
97
- integrity_fields : list of str or tuple of str, optional
98
- Fields whose completeness should be checked. If any field is missing,
99
- the `integrity_action` will be triggered.
100
-
101
- integrity_action : {'raise', 'warn'}, optional
102
- What to do if required fields are missing:
103
-
104
- - 'raise' : Raise an AttributeError
105
- - 'warn' : Emit a UserWarning
106
-
107
- subscriber : bool, optional
108
- If True, cursor navigation is enabled, allowing more than 5,000 results.
109
-
110
- **kwds: str
111
- Additional keyword arguments to be passed to the API. These can be any available
112
- search fields, such as `authors`, `pub-date` and `title`. For a full list of
113
- available fields, see the `ScienceDirect Search API Migration Documentation
114
- <https://dev.elsevier.com/tecdoc_sdsearch_migration.html>`__.
74
+ Interaction with the ScienceDirect Search API using the `PUT` method.
75
+ See the official `documentation <https://dev.elsevier.com/tecdoc_sdsearch_migration.html>`__
76
+ for more details.
77
+
78
+ :param query: Free text query string as the `qs`field in the `documentation
79
+ <https://dev.elsevier.com/tecdoc_sdsearch_migration.html>`__.
80
+ :param refresh: Whether to refresh the cached file if it exists or not.
81
+ If int is passed, cached file will be refreshed if the
82
+ number of days since last modification exceeds that value.
83
+ :param view: Which view to use for the query, see `the documentation <https://dev.elsevier.com/sd_search_views.html>`__.
84
+ Allowed values: `STANDARD`.
85
+ :param verbose: Whether to print a download progress bar.
86
+ :param download: Whether to download results (if they have not been
87
+ cached).
88
+ :param integrity_fields: A list or tuple with the names of fields whose completeness should
89
+ be checked. `ScienceDirectSearch` will perform the
90
+ action specified in `integrity_action` if
91
+ elements in these fields are missing. This
92
+ helps to avoid idiosynchratically missing
93
+ elements that should always be present
94
+ (e.g., doi or authors).
95
+ :param integrity_action: What to do in case integrity of provided fields
96
+ cannot be verified. Possible actions:
97
+ - `"raise"`: Raise an `AttributeError`
98
+ - `"warn"`: Raise a `UserWarning`
99
+ :param subscriber: Whether you access ScienceDirect with a subscription or not.
100
+ For subscribers, ScienceDirect's cursor navigation will be
101
+ used. Sets the number of entries in each query
102
+ iteration to the maximum number allowed by the
103
+ corresponding view.
104
+ :param kwds: Keywords passed on as query parameters. Must contain
105
+ fields and values mentioned in the `API specification <https://dev.elsevier.com/tecdoc_sdsearch_migration.html>`__.
115
106
116
107
Raises
117
108
------
@@ -121,6 +112,12 @@ def __init__(self,
121
112
ValueError
122
113
If any of the parameters `integrity_action`, `refresh` or `view`
123
114
is not one of the allowed values.
115
+
116
+ Notes
117
+ -----
118
+ The directory for cached results is `{path}/{view}/{fname}`,
119
+ where `path` is specified in your configuration file and `fname` is
120
+ the md5-hashed version of the flattened `query`.
124
121
125
122
"""
126
123
# Check if the query and keyword arguments are empty
0 commit comments