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
---------------------------------------------------------------------------
StackAPIError Traceback (most recent call last)
Cell In[6], line 3
1# Providing `name` argument raises `StackAPIError`.2SITE= StackAPI(name="stackoverflow")
----> 3 SITE.fetch(endpoint="users/{id}/network-activity", id=8698988)
File ~\.env\Lib\site-packages\stackapi\stackapi.py:211, in StackAPI.fetch(self, endpoint, page, key, filter, **kwargs)
209 code = response["error_name"]
210 message = response["error_message"]
--> 211 raise StackAPIError(self._previous_call, error, code, message)
212exceptKeyError:
213pass# This means there is no errorStackAPIError: ('https://api.stackexchange.com/2.3/users/8698988/network-activity/?pagesize=100&page=1&filter=default&site=stackoverflow', 400, 'bad_parameter', 'This method does not accept a `site` parameter')
After reading the Usage of /users/{id}/network-activity page, the error made more sense—I shouldn't supply a site parameter to the URL. I took this to mean not setting the name argument in StackAPI, but this raises a ValueError.
# No site provided raises ValueError.SITE=StackAPI()
SITE.fetch(endpoint="users/{id}/network-activity", id=my_acct_id)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[7], line 6
3 my_acct_id =86989885# No site provided raises ValueError.
----> 6 SITE = StackAPI()
7SITE.fetch(endpoint="users/{id}/network-activity", id=my_acct_id)
File ~\.env\Lib\site-packages\stackapi\stackapi.py:60, in StackAPI.__init__(self, name, version, base_url, **kwargs)
32"""33 The object used to interact with the Stack Exchange API34
(...)
57 a user, to grant more permissions (such as write access)
58"""59ifnot name:
---> 60 raise ValueError("No Site Name provided")
62self.proxy = kwargs.get("proxy", None)
63self.max_pages = kwargs.get("max_pages", 5)
ValueError: No Site Name provided
Proposal
I believe this may be an unintended bug, and if so I'd be willing to submit a PR.
Version Info
Python
3.11.7 (tags/v3.11.7:fa7a6f2, Dec 4 2023, 19:24:49) [MSC v.1937 64 bit (AMD64)]
StackAPI
Name: StackAPI
Version: 0.3.0
Summary: Library for interacting with the Stack Exchange API
Home-page: https://github.com/AWegnerGitHub/StackAPI
Author: Andrew Wegner
Author-email: [email protected]
License: MIT
Location: ~\.env\Lib\site-packages
Requires: requests, six
Required-by:
The text was updated successfully, but these errors were encountered:
MREs
While trying to access the "/users/{id}/network-activity" endpoint I ran into a
StackAPIError
.After reading the Usage of /users/{id}/network-activity page, the error made more sense—I shouldn't supply a
site
parameter to the URL. I took this to mean not setting thename
argument inStackAPI
, but this raises aValueError
.Proposal
I believe this may be an unintended bug, and if so I'd be willing to submit a PR.
Version Info
Python
StackAPI
The text was updated successfully, but these errors were encountered: