How to generate tokens

pm.generate_session(“request_token”)

pm.set_access_token(“your_access_token”)
pm.set_public_access_token(“your_public_access_token”)
pm.set_read_access_token(“your_read_access_token”)

Hi @ama,

Step 1 : Complete the login process and in the end you will receive a requestToken in URL. Get the login Url from the below attached api docs.
Step 2 : Call the generate_session(your_request_token) and pass the requestToken in parameter. It will generate all the tokens.

Sample code for reference : pyPMClient/order.py at master · paytmmoney/pyPMClient · GitHub

For more details please refer to our API Docs

Thanks for your response, but when I do that I get this error below, since I have provided http://localhost as my redirect URL

This site can’t be reached

localhost refused to connect.

Try:

ERR_CONNECTION_REFUSED

Actually I realized that although I got this error by the request_code was generated.

  1. How long is this request code valid for?
  2. For next step, I passed the token with the generate _session, but how will I get the other tokens after this call, like the access_token, Public_access_token and read_access_token
    pm.generate_session(“your_request_token”)

This call above does not return anything

pm.set_access_token(“your_access_token”)
pm.set_public_access_token(“your_public_access_token”)
pm.set_read_access_token(“your_read_access_token”)

@ama

  1. It is valid for 30 minutes.
  2. You have to create an object with the apiKey and apiSecret used to generate request_token and then you call the class methods. Sharing a code screenshot for reference

Hi,

Can we get the live market data without users to login ? I am trying to use the API in a app, but i donot want user to login to see the market data