SHOW:
|
|
- or go back to the newest paste.
| 1 | import requests # see https://2.python-requests.org/en/master/ | |
| 2 | ||
| 3 | key = 'your_dev_key_here' | |
| 4 | text = "a text" | |
| 5 | t_title = "a_paste_title" | |
| 6 | ||
| 7 | login_data = {
| |
| 8 | 'api_dev_key': key, | |
| 9 | 'api_user_name': 'your_acc_username', | |
| 10 | 'api_user_password': 'your_acc_password' | |
| 11 | } | |
| 12 | data = {
| |
| 13 | 'api_option': 'paste', | |
| 14 | 'api_dev_key':key, | |
| 15 | 'api_paste_code':text", | |
| 16 | 'api_paste_name':t_title, | |
| 17 | 'api_paste_expire_date': 'see_https://pastebin.com/api', | |
| 18 | 'api_user_key': None, | |
| 19 | 'api_paste_format': 'see_https://pastebin.com/api' | |
| 20 | } | |
| 21 | ||
| 22 | login = requests.post("https://pastebin.com/api/api_login.php", data=login_data)
| |
| 23 | print("Login status: ", login.status_code if login.status_code != 200 else "OK/200")
| |
| 24 | print("User token: ", login.text)
| |
| 25 | data['api_user_key'] = login.text | |
| 26 | ||
| 27 | r = requests.post("https://pastebin.com/api/api_post.php", data=data)
| |
| 28 | print("Paste send: ", r.status_code if r.status_code != 200 else "OK/200")
| |
| 29 | print("Paste URL: ", r.text)
| |
| 30 | ||
| 31 | ||
| 32 | ||
| 33 | ||
| 34 | #sent from python 3.7 |