When using the Twython SDK to make a scoped timeline request I am receiving the following error:
‘{“errors”:[{“code”:“NOT_FOUND”,“message”:“User was not found”}],“request”:{“params”:{}}}’
According to the response codes mentioned in the docs, none of this matches up. A status of 403 should return a error message related to access or permissions (“user not found” is supposed to be a 404). Also the “code” value is supposed to a number, not text.
This seems like a bug, but maybe it isn’t. The user_id is not explicitly provided in the params. The Ads API docs say that the default value is the “full promotable user”. There’s only one promotable user for this account and their promotable_user_type is “FULL”. Is there something wrong with this user that’s preventing this data from being pulled?
I know there’s a warning in the call about the v3 version of the API being deprecated. However, other requests using v3 are working fine and using v4 returns the same error response.
Response:
{’_content’: ‘{“errors”:[{“code”:“NOT_FOUND”,“message”:“User was not found”}],“request”:{“params”:{}}}’,
‘_content_consumed’: True,
‘connection’: <requests.adapters.HTTPAdapter at 0x7fc3eae4a190>,
‘cookies’: <RequestsCookieJar[]>,
‘elapsed’: datetime.timedelta(0, 0, 73262),
‘encoding’: ‘utf-8’,
‘headers’: {‘x-rate-limit-remaining’: ‘1997’, ‘x-api-version’: ‘3.0’, ‘content-length’: ‘118’, ‘x-xss-protection’: ‘1; mode=block; report=https://twitter.com/i/xss_report’, ‘x-content-type-options’: ‘nosniff’, ‘content-disposition’: ‘attachment; filename=json.json’, ‘content-encoding’: ‘gzip’, ‘x-transaction’: ‘00598e7e00ea9997’, ‘x-current-api-version’: ‘4.0’, ‘strict-transport-security’: ‘max-age=631138519’, ‘x-access-level’: ‘read’, ‘server’: ‘tsa_b’, ‘x-connection-hash’: ‘5ddb60cc43c2cb5c06234a2e62f148e1’, ‘x-runtime’: ‘0.018101’, ‘x-rate-limit-reset’: ‘1537203450’, ‘x-api-warn’: "Warning: You’re using a deprecated version of this API. Upgrade your API: https://developer.twitter.com/en/docs/ads/general/overview/versions.", ‘date’: ‘Mon, 17 Sep 2018 16:56:07 GMT’, ‘x-rate-limit-limit’: ‘2000’, ‘x-frame-options’: ‘SAMEORIGIN’, ‘x-response-time’: ‘32’, ‘content-type’: ‘application/json;charset=utf-8’},
‘history’: [],
‘raw’: <requests.packages.urllib3.response.HTTPResponse at 0x7fc3ea51f950>,
‘reason’: ‘Forbidden’,
‘request’: <PreparedRequest [GET]>,
‘status_code’: 403,
‘url’: u’https://ads-api.twitter.com/3/accounts//scoped_timeline?count=1000&with_deleted=true&trim_user=1&scoped_to=followers’}
Request:
{’_body_position’: None,
‘_cookies’: <RequestsCookieJar[Cookie(version=0, name=‘guest_id’, value=, port=None, port_specified=False, domain=’.twitter.com’, domain_specified=True, domain_initial_dot=True, path=’/’, path_specified=True, secure=False, expires=1600277603, discard=False, comment=None, comment_url=None, rest={}, rfc2109=False), Cookie(version=0, name=‘personalization_id’, value=, port=None, port_specified=False, domain=’.twitter.com’, domain_specified=True, domain_initial_dot=True, path=’/’, path_specified=True, secure=False, expires=1600277603, discard=False, comment=None, comment_url=None, rest={}, rfc2109=False)]>,
‘body’: None,
‘headers’: {‘Accept-Encoding’: ‘gzip, deflate’, ‘Accept’: ‘/’, ‘User-Agent’: ‘Twython v3.7.0’, ‘Connection’: ‘keep-alive’, ‘Cookie’: 'guest_id=<guest_id>; personalization_id=, ‘Authorization’: 'OAuth oauth_nonce=“1112629026652273881537205606”, oauth_timestamp=“1537205606”, oauth_version=“1.0”, oauth_signature_method=“HMAC-SHA1”, oauth_consumer_key=, oauth_token=, oauth_signature=},
‘hooks’: {‘response’: []},
‘method’: ‘GET’,
‘url’: ‘https://ads-api.twitter.com/4/accounts/<account_id>/scoped_timeline?count=1000&with_deleted=true&trim_user=1&scoped_to=followers’}