Advertisement
FroztGal

paste_api

Jan 10th, 2020
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. import requests
  2.  
  3.  
  4. def creating_api_user_key(key, name, password):
  5.     api_opt = {
  6.         'api_dev_key': key,
  7.         'api_user_name': name.encode('utf-8'),
  8.         'api_user_password': password.encode('utf-8')
  9.     }
  10.  
  11.     res = requests.post("https://pastebin.com/api/api_login.php", data=api_opt)
  12.     return res.text
  13.  
  14.  
  15. def post_to_pastebin(dev_key, text, name, user_key):
  16.     api_opt = {
  17.         'api_dev_key': dev_key,
  18.         'api_option': 'paste',
  19.         'api_paste_code': text.encode('utf-8'),
  20.         'api_paste_name': name.encode('utf-8'),
  21.         'api_paste_format': 'python',
  22.         'api_user_key': user_key,
  23.         'api_paste_private': '0',
  24.         'api_paste_expire_date': '1D'
  25.     }
  26.  
  27.     res = requests.post("https://pastebin.com/api/api_post.php", data=api_opt)
  28.     return res.text
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement