Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- import json
- def hastebin_paste(text):
- headers = {
- 'origin': 'https://hastebin.com',
- 'accept-encoding': 'gzip, deflate, br',
- 'x-requested-with': 'XMLHttpRequest',
- 'accept-language': 'en-US,en;q=0.8',
- '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',
- 'content-type': 'application/json; charset=UTF-8',
- 'accept': 'application/json, text/javascript, */*; q=0.01',
- 'referer': 'https://hastebin.com/',
- 'authority': 'hastebin.com',
- }
- data = text
- r = requests.post('https://hastebin.com/documents', headers=headers, data=data)
- return 'http://hastebin.com/'+json.loads(r.text)['key']
- print hastebin_paste("hi i like pie")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement