mikts / pbwrap Goto Github PK
View Code? Open in Web Editor NEWPastebin API wrapper for Python
Home Page: http://pbwrap.readthedocs.io/en/latest/
License: MIT License
Pastebin API wrapper for Python
Home Page: http://pbwrap.readthedocs.io/en/latest/
License: MIT License
Code:
from pbwrap import Pastebin
pastebin = Pastebin("my api key (retracted)")
pastebin.authenticate("(retracted)", "(retracted)")
p = pastebin.create_paste(api_paste_code="my paste text")
return p
Error:
Bad API request, invalid api_user_key
Hello
There is no utf-8 encoding done before the POST request, so it creates malformed characters when creating a paste from a file.
If loaded directly from a given string it is possible to encode it beforehand and not having the issue.
What do I put as the username
and password
for pb.authenticate()
?
suggest option to verify ssl certs
HTTPSConnectionPool(host='pastebin.com', port=443): Max retries exceeded with url: /api/api_login.php (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)')))
`This module always worked perfectly for me in the past but I just tried to use it again and the error above is generated. Perhaps it is due to changes made to python since the module was written? I am using Python 3.9.5.
pb = Pastebin(api_dev_key)
user_id =pb.authenticate(username, password)
paste_url = pb.create_paste('this is a test', api_paste_private=1, api_paste_name='test')
print(paste_url)
with open('test.txt', 'w') as f:
f.write('This is line #1\n')
f.write('This is line #2\n')
paste_url = pb.create_paste_from_file('test.txt', api_paste_private=1, api_paste_name='test')
print(paste_url)
print('Done')`
The api url for getting raw paste data is https://pastebin.com/api/api_raw.php, not https://pastebin.com/api/api_post.php.
The error is on line 234 of pbwrap.py.
Cheers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.