Closed 965realestate closed 3 years ago
This endpoint uses a "path parameter" for the tweet id, so a colon is required.
r = api.request('direct_messages/events/destroy/:123456').json()
I added "path parameter".. what i'm doing wrong?
For Example:
api = TwitterAPI(111, 222, 333 , 444)
r = api.request('direct_messages/events/list').json()
{'events': [{'type': 'message_create', 'id': '1372274530706685974', 'created_timestamp': '1616010718405', 'message_create': {'target': {'recipient_id': '258546504'}, 'sender_id': '1097843103413817344', 'source_app_id': '3033300', 'message_data': {'text': 'Hi1', 'entities': {'hashtags': [], 'symbols': [], 'user_mentions': [], 'urls': []}}}}, {'type': 'message_create', 'id': '1372264010536648709', 'created_timestamp': '1616008210201', 'message_create': {'target': {'recipient_id': '258546504'}, 'sender_id': '1097843103413817344', 'source_app_id': '3033300', 'message_data': {'text': 'Hi2', 'entities': {'hashtags': [], 'symbols': [], 'user_mentions': [], 'urls': []}}}}], 'apps': {'3033300': {'id': '3033300', 'name': 'Twitter Web App', 'url': 'https://mobile.twitter.com'}}}
r = api.request('direct_messages/events/destroy/:1372274530706685974').json()
Error:
Exception: Endpoint "direct_messages/events/destroy/:PARAM" unsupported
Sorry, my mistake. I assumed direct_messages/events/destroy
took a path parameter because that is how you wrote the request originally. I just looked up the endpoint in Twitter's docs, and I see it takes a query parameter id
.
r = api.request('direct_messages/events/destroy', {'id':1372274530706685974}).json()
Hello,
constants.py
I'm trying to delete a direct message using 'direct_messages/events/destroy/123456'
but i'm getting 'Exception: Endpoint "direct_messages/events/destroy/123456" unsupported'
I want to know if i'm doing something wrong?
api = TwitterAPI(111, 222, 333 , 444) r = api.request('direct_messages/events/destroy/123456').json()