Pocket API Request Token Failed?

201 views Asked by At

I am trying to get pocket request token with python requests library and getting 400 error. I also tried with postman REST Client and same result. Any thoughts on what I did wrong?

This is the python snippet

def PocketAuth():
    params ={
        'consumer_key':'34863-11080497suck197443sdfsd342',
        'redirect_uri':'pocketapp1234:authorizationFinished'
    }
    pocketOAuth = requests.get("https://getpocket.com/v3/oauth/request", params=params)
    print(pocketOAuth.url,pocketOAuth.json)
1

There are 1 answers

0
Atrh On

This is how I solved it after looking for an error. content-header should be declared as json.

headers = {"content-type": "application/json"}
params ={
    'consumer_key':'34863-11080497bbeded19744312c9',
    'redirect_uri':'pocketapp1234:authorizationFinished'
}
pocketOAuth = requests.get("https://getpocket.com/v3/oauth/request", data=json.dumps(params), headers=headers)
code =pocketOAuth.text