GithubHelp home page GithubHelp logo

Comments (13)

bstoilov avatar bstoilov commented on May 30, 2024 2

So the version is:
Version: 0.3.0

That is indeed the latest one.
One thing I noticed

user_ids=my_user_id
my_user_id is array right?

from py3-pinterest.

bstoilov avatar bstoilov commented on May 30, 2024 1

Glad to hear that it is now working :)

from py3-pinterest.

uzairzia avatar uzairzia commented on May 30, 2024

I get same response when using an already existing conversation to send message.

Code

from py3pin.Pinterest import Pinterest

pinterest = Pinterest(email=my_email, password=my_password, username=my_username, cred_root=my_cred_root)

conversations = pinterest.get_conversations()
first_conversation = conversations[0]
first_conversation_id = first_conversation['id']

print (first_conversation_id)
response = pinterest.send_message('hi there',first_conversation_id)
print (response)

Response:

5066715636181289166
<Response [400]>

Any help shall be much appreciated. :) Thank you.

from py3-pinterest.

bstoilov avatar bstoilov commented on May 30, 2024

I will look in to it, can you print the content of the response, response.content, there might be some clues there

from py3-pinterest.

uzairzia avatar uzairzia commented on May 30, 2024

So it says invalid HTTP method for resource method.
This is not the entire output of response.content. Sine it's very long and probably not of any use, I have trimmed the trailing output. But please let me know in case it makes it easier for you.

Thank you :)

    "resource_response":{
        "error":{
            "status":"failure",
            "http_status":400,
            "code":12,
            "message":"INVALID_HTTP_METHOD_FOR_RESOURCE_METHOD"
        }
    },

from py3-pinterest.

uzairzia avatar uzairzia commented on May 30, 2024

Just some additional information.

In the file Pinterest.py,
there is (at Line 48):
CONVERSATION_RESOURCE = 'https://www.pinterest.com/resource/ConversationsResource/get/
when I visit this URL in my browser, I get:

{ "resource_response": { 
      "status" : "success",
      "code":0,
      ...

This above resource is used for get_conversations() and from the response in browser we can see that it works perfectly fine.


Also in the same file at Line 49, there is:
CONVERSATION_RESOURCE_CREATE = 'https://www.pinterest.com/resource/ConversationsResource/create/'
when I visit this URL in my browser, I get:

{  "resource_response" : { 
        "error": {
            "status" : "failure", 
            "http_status" : 400, 
            "code" : 12,
            "message" : "INVALID_HTTP_METHOD_FOR_RESOURCE_METHOD"
         }
    },
    ...

This above resource is used for initiate_conversation() and from the response in browser we can see that the resource does not work.

I get this same error when visiting the URL for resource SEND_MESSAGE = 'https://www.pinterest.com/resource/ConversationMessagesResource/create/' (at Line 51 in Pinterest.py).

from py3-pinterest.

bstoilov avatar bstoilov commented on May 30, 2024

Thank you for being so proactive. 'https://www.pinterest.com/resource/ConversationMessagesResource/create/' is a POST requests and your browser makes GET requests in the url, so it is normal to get INVALID_HTTP_METHOD_FOR_RESOURCE_METHOD.

As for the issue I was not able to reproduce it.
Can you check the following things:

  • You are able to send message to the user using the pinterest UI
  • The user hasn't blocked you or anything like that
  • You are using the latest code/build

from py3-pinterest.

bstoilov avatar bstoilov commented on May 30, 2024

https://github.com/bstoilov/py3-pinterest/blob/master/messages_example.py

The last line works just fine for me:
send_message(username='username', message='hi2')

it will initiate the conversation if there are no previous messages with this user

from py3-pinterest.

uzairzia avatar uzairzia commented on May 30, 2024

Thank you for the post/get information :)

Regarding the things that you mentioned:

  • I am able to send messages to the user through the UI.
  • The user hasn't blocked me.
  • I am stuck here. Something wrong with my pip. So fixing that in the meanwhile. Is there any way on your mind to check for the version without using pip?

I used the file messages_example.py and the same error occurs if I print the response in the function. I tried this with two different users of Pinterest, just to be sure. Still not working :(

I am fixing my pip and after fixing, will find the version of py3-pinterest and will let you know.

from py3-pinterest.

bstoilov avatar bstoilov commented on May 30, 2024

You could try directly checking out the code.
You can even checkout this PR branch
to see if I have some how managed to fix the issue without realizing, but I highly doubt this.

from py3-pinterest.

uzairzia avatar uzairzia commented on May 30, 2024

So the version is:
Version: 0.3.0

from py3-pinterest.

uzairzia avatar uzairzia commented on May 30, 2024

You could try directly checking out the code.

Yup done that too but still no luck till now. I am gonna have to dig deeper.

You can even checkout this PR branch

I'll do that too and will let you know when I succeed.

Thank you for your time and help :)
Cheers.

from py3-pinterest.

uzairzia avatar uzairzia commented on May 30, 2024

my_user_id is array right?

Goodness me. I cannot believe this. I made the my_user_id an array and appended the ID to it. It finally works.

I spent almost one entire day on this and look where the issue was.

Thank you Mr. Stoilov for the help. I am grateful to you. :)

Cheers and please continue with this marvellous project.

Just for future users:
When initiating conversation, user_ids in the argument passed to function initiate_conversation(self, user_ids=None, message='hi') should be an array/list.

from py3-pinterest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.