pythonstocktwits

How to post a message to Stocktwits through python script?


I have created an app, and have the token, the keys, and all that information from stocktwits.com. I want to know how i can integrate code into my python script where i am able to post a message to stocktwits via Python.

Thanks for your help.

Regards,

PM


Solution

  • Using Python's request module, you could make a request like this:

    import requests
    payload={"access_token":"YOURACCESSTOKEN", "body":"YOURMESSAGE"}
    requests.post("https://api.stocktwits.com/api/2/messages/create.json", data=payload)
    

    Be sure to look at Stocktwit's auth docs so you can make sure that you have the right API keys.