Advertisement
Venusaur

Hastebin Uploader

Nov 5th, 2017
179
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. import json
  3.  
  4. def hastebin_paste(text):
  5.     headers = {
  6.         'origin': 'https://hastebin.com',
  7.         'accept-encoding': 'gzip, deflate, br',
  8.         'x-requested-with': 'XMLHttpRequest',
  9.         'accept-language': 'en-US,en;q=0.8',
  10.         'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36',
  11.         'content-type': 'application/json; charset=UTF-8',
  12.         'accept': 'application/json, text/javascript, */*; q=0.01',
  13.         'referer': 'https://hastebin.com/',
  14.         'authority': 'hastebin.com',
  15.     }
  16.     data = text
  17.     r = requests.post('https://hastebin.com/documents', headers=headers, data=data)
  18.     return 'http://hastebin.com/'+json.loads(r.text)['key']
  19.  
  20. print hastebin_paste("hi i like pie")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement