Giter Club home page Giter Club logo

pastebinapi's Issues

raise PastebinError(response) "http://pastebin.com" vs "https://pastebin.com"

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

Replace urllib.urlopen to urllib.request.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

urllib doesn't support Python 3

Attempting to use generate_user_key gives the following error:
AttributeError: module 'urllib' has no attribute 'urlopen'

Problems installing from pypi, Pastebin.py not found.

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:

  • I tried installing with Pastebin and pastebin, no luck.
  • I was able to install the app using python setup.py install from this repo.

Cannot delete pastes

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.