Closed 965realestate closed 1 year ago
Looks good to me. Are you using the same credentials with Postman and TwitterAPI?
I would add something to your code to confirm that your credentials are valid.
Yes, I'm using the same exact credentials with Postman and TwitterAPI.
What code do I need to add that check my credentials are valid?
You could try other enpoints, such as searching for tweets, that don't require write privileges. I'm really not sure what to tell you. It doesn't make sense that the same credentials would would work in one case and not in the other. Are those credentials associated with a Twitter developer project?
The error you are receiving is from Twitter, so it's impossible to for me to look into the cause. There must be some difference between your requests in Postman and in TwitterAPI. It might be helpful to try the same request using another library such as twarc.
I see one thing you are doing wrong. The 'tweets' request, by default uses HTTP GET. You need to use HTTP POST in order to upload a tweet. Try this...
r = api.request('tweets', {'text':'a test to test'}, method_override='POST')
I see one thing you are doing wrong. The 'tweets' request, by default uses HTTP GET. You need to use HTTP POST in order to upload a tweet. Try this...
r = api.request('tweets', {'text':'a test to test'}, method_override='POST')
method_override='POST'
Thank you! Problem fixed
@qkxie How are you creating your api
object?
On Wed, Aug 2, 2023 at 10:18 PM qkxie @.***> wrote:
I have the same error. even when I set method to post:
resp = api.request('tweets', {'text': 'testing api'}, method_override='POST')
It still return error message:
'{"title":"Forbidden","status":403,"detail":"Your client app is not configured with the appropriate oauth1 app permissions for this endpoint.","type":"https://api.twitter.com/2/problems/oauth1-permissions"}'
— Reply to this email directly, view it on GitHub https://github.com/geduldig/TwitterAPI/issues/226#issuecomment-1663198635, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWUOP6WPCPTSAYKERPHEALXTMC55ANCNFSM6AAAAAAXBERWKA . You are receiving this because you modified the open/close state.Message ID: @.***>
@geduldig
api = TwitterAPI(consumer_key, consumer_secret, access_key, access_secret, api_version='2')
Is there a problem with authentication requests or I'm doing something wrong?
I tried the Twitters API v2 postman with (OAuth 1.0) Consumer Key, Consumer Secret, Access Token, Token Secret after that creating a tweet with Twitters API v2 it worked perfectly.
code:
response: