morrolan / pastebinapi Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
Looks like the error checking below expects "http://pastebin.com" but is getting "https://pastebin.com" back in the response, thus triggering the error.
# do some basic error checking here so we can gracefully handle any
# errors we are likely to encounter
if response.startswith(self._bad_request):
raise PastebinError(response)
elif not response.startswith(self._prefix_url):
raise PastebinError(response)
return response
Attempting to use generate_user_key
gives the following error:
AttributeError: module 'urllib' has no attribute 'urlopen'
python3 raise AttributeError.
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/usr/local/lib/python3.5/dist-packages/flask_restful/__init__.py", line 270, in error_router
return original_handler(e)
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 32, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.5/dist-packages/flask_restful/__init__.py", line 270, in error_router
return original_handler(e)
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.5/dist-packages/flask/_compat.py", line 32, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.5/dist-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.5/dist-packages/flask_restful/__init__.py", line 462, in wrapper
resp = resource(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/flask/views.py", line 84, in view
return self.dispatch_request(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/flask_restful/__init__.py", line 572, in dispatch_request
resp = meth(*args, **kwargs)
File "/media/sf_workspace/python/flask/codebot_kakao/app.py", line 66, in post
url = save_to_pastebin(code, format="python")
File "/media/sf_workspace/python/flask/codebot_kakao/app.py", line 28, in save_to_pastebin
paste_private = 'unlisted')
File "/usr/local/lib/python3.5/dist-packages/pastebin.py", line 679, in paste
request_string = urllib.urlopen(self._api_url, urllib.urlencode(argv))
AttributeError: module 'urllib' has no attribute 'urlopen'
It should be replace to urllib.request.urlopen
There's an error in the delete_paste
function where request_string
is referenced in line 342 of pastebin.py. This name does not exist, and I assume the line above should read request_string = urllib.urlopen(self._api_url, urllib.urlencode(argv))
. Thus the delete function does not work.
I have this problem installing the package using pip
and easy_install
.
Here the logs:
(venv:pruebas) ➜ pip install Pastebin
Downloading/unpacking Pastebin
Downloading Pastebin-1.1.1.tar.gz (55kB): 55kB downloaded
Running setup.py egg_info for package Pastebin
file Pastebin.py (for module Pastebin) not found
Requirement already satisfied (use --upgrade to upgrade): setuptools in /home/ivan/.virtualenvs/pruebas/lib/python2.7/site-packages (from Pastebin)
Installing collected packages: Pastebin
Running setup.py install for Pastebin
file Pastebin.py (for module Pastebin) not found
file Pastebin.py (for module Pastebin) not found
warning: install_lib: 'build/lib.linux-i686-2.7' does not exist -- no Python modules to install
file Pastebin.py (for module Pastebin) not found
file Pastebin.py (for module Pastebin) not found
Successfully installed Pastebin
Cleaning up...
(venv:pruebas) ➜ easy_install Pastebin
Searching for Pastebin
Reading https://pypi.python.org/simple/Pastebin/
Best match: Pastebin 1.1.1
Downloading https://pypi.python.org/packages/source/P/Pastebin/Pastebin-1.1.1.tar.gz#md5=d9374efc32f442e9fb4589d4f5a9b74b
Processing Pastebin-1.1.1.tar.gz
Writing /tmp/easy_install-KfbedV/Pastebin-1.1.1/setup.cfg
Running Pastebin-1.1.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-KfbedV/Pastebin-1.1.1/egg-dist-tmp-I9DzMO
file Pastebin.py (for module Pastebin) not found
file Pastebin.py (for module Pastebin) not found
file Pastebin.py (for module Pastebin) not found
warning: install_lib: 'build/lib.linux-i686-2.7' does not exist -- no Python modules to install
zip_safe flag not set; analyzing archive contents...
Adding Pastebin 1.1.1 to easy-install.pth file
Installed /home/ivan/.virtualenvs/pruebas/lib/python2.7/site-packages/Pastebin-1.1.1-py2.7.egg
Processing dependencies for Pastebin
Finished processing dependencies for Pastebin
Notes:
Pastebin
and pastebin
, no luck.python setup.py install
from this repo.In the code generate_key uses an instance of the class, while in the readme the method is called via the class
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.