Yorozuya3
Yorozuya3

Reputation: 3

pastebin api : invalid api_dev_key

I'm trying to paste from my python script using following snippet:

import requests
API_ENDPOINT = "http://pastebin.com/api/api_post.php"

data = {'api_dev_key':'my key',
        'api_option': 'paste',
        'api_paste_code': 'hola',
        'api_paste_expire_date':'10M'
}


r = requests.post(url = API_ENDPOINT, data = data)
print(r)
print(r.text)

Which worked well after a few days, but now it returns bad request, invalid api_dev_key. I can't find where is the problem and I tried with another account's key.

Upvotes: 0

Views: 2295

Answers (3)

Yorozuya3
Yorozuya3

Reputation: 3

Solved, pastebin was on maintenance, and only accepted https request

Upvotes: 0

TSurF
TSurF

Reputation: 52

Try changing the HTTP to HTTPS, i think that should do it!

Upvotes: 1

AzyCrw4282
AzyCrw4282

Reputation: 7744

Your code is fine and works perfectly on mine too with my own data. Ensure that your account is active and has no warning for any verification.

You can simply try changing the api_dev_key to an acceptable value in pastebin.com.conf and see if it fixes the issue.

Lastly, as mentioned here, try doing an HTTPS request, and see if that fixes it.

Upvotes: 0

Related Questions