Giter VIP home page Giter VIP logo

embedly-python's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

embedly-python's Issues

Embedly + rod.recipe.appengine

I was trying to integrate the Embedly egg into our App Engine project but kept getting an error. I setup a minimal project that reproduces what I'm seeing here.

I'm definitely no Python pro so I don't know if it's a problem with my poor buildout skills, rod.recipe.appengine or the embedly package. Any chance you could sanity check?

Here's the stack trace:

An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
Traceback (most recent call last):
  File "/home/ubuntu/jcook793-embedly-appengine/eggs/zc.buildout-1.5.2-py2.7.egg/zc/buildout/buildout.py", line 1805, in main
    getattr(buildout, command)(args)
  File "/home/ubuntu/jcook793-embedly-appengine/eggs/zc.buildout-1.5.2-py2.7.egg/zc/buildout/buildout.py", line 584, in install
    installed_files = self[part]._call(recipe.install)
  File "/home/ubuntu/jcook793-embedly-appengine/eggs/zc.buildout-1.5.2-py2.7.egg/zc/buildout/buildout.py", line 1297, in _call
    return f()
  File "/home/ubuntu/jcook793-embedly-appengine/eggs/rod.recipe.appengine-2.0.0-py2.7.egg/rod/recipe/appengine/__init__.py", line 327, in install
    self.copy_packages(ws, temp_dir)
  File "/home/ubuntu/jcook793-embedly-appengine/eggs/rod.recipe.appengine-2.0.0-py2.7.egg/rod/recipe/appengine/__init__.py", line 250, in copy_packages
    top = open(top_level, 'r')
IOError: [Errno 20] Not a directory: '/home/ubuntu/jcook793-embedly-appengine/eggs/Embedly-0.4.3-py2.7.egg/EGG-INFO/top_level.txt'

Error running example code.

I have been using the API for about a month now with good results, but today everything I run returns a 401. Is the API down?

from embedly import Embedly
import settings
client = Embedly('my-key')
obj = client.extract('http://www.propublica.org/article/how-nonprofit-hospitals-are-seizing-patients-wages')
print obj['type']
>>> 'error'

Install fails if you don't already have httplib2 installed

Install fails with the message below. Shouldn't it install the dependency?

Obtaining embedly from git+https://github.com/embedly/embedly-python.git@40be69dbfea07836f3e6e1a899ef7eab6c00cca4#egg=embedly-dev (from -r requirements.txt (line 2))
Updating ./venv/src/embedly clone (to 40be69d)
Could not find a tag or branch '40be69dbfea07836f3e6e1a899ef7eab6c00cca4', assuming commit.
Running setup.py egg_info for package embedly
Traceback (most recent call last):
File "", line 16, in
File "/home/ubuntu/muckrack/venv/src/embedly/setup.py", line 13, in
version = import('embedly').version
File "embedly/init.py", line 2, in
from .client import Embedly, version
File "embedly/client.py", line 9, in
import httplib2
ImportError: No module named httplib2
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "", line 16, in

File "/home/ubuntu/muckrack/venv/src/embedly/setup.py", line 13, in

version = __import__('embedly').__version__

File "embedly/init.py", line 2, in

from .client import Embedly, __version__

File "embedly/client.py", line 9, in

import httplib2

ImportError: No module named httplib2

Tests fail

I suppose something has changed on the service…

py27 runtests: commands[0] | python embedly/tests.py
...FF..FF..........
======================================================================
FAIL: test_get_services_retrieves_data_and_builds_regex (__main__.EmbedlyTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "embedly/tests.py", line 233, in test_get_services_retrieves_data_and_builds_regex
    self.assertTrue(client.regex.match('http://yfrog.com/h22eu4j'))
AssertionError: None is not true

======================================================================
FAIL: test_multi_errors (__main__.EmbedlyTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "embedly/tests.py", line 164, in test_multi_errors
    self.assertEqual(objs[1]['type'], 'error')
AssertionError: u'link' != u'error'
- link
+ error


======================================================================
FAIL: test_provider (__main__.EmbedlyTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "embedly/tests.py", line 117, in test_provider
    self.assertEqual(obj['provider_url'], 'http://www.scribd.com/')
AssertionError: u'https://www.scribd.com/' != u'http://www.scribd.com/'
- https://www.scribd.com/
?     -
+ http://www.scribd.com/


======================================================================
FAIL: test_providers (__main__.EmbedlyTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "embedly/tests.py", line 134, in test_providers
    self.assertEqual(objs[0]['provider_url'], 'http://www.scribd.com/')
AssertionError: u'https://www.scribd.com/' != u'http://www.scribd.com/'
- https://www.scribd.com/
?     -
+ http://www.scribd.com/


----------------------------------------------------------------------
Ran 19 tests in 4.021s

FAILED (failures=4)

use https?

I noticed that the URLs are 'http' and not 'https'.

I created this pull request:

#28

And added 'https' to the URLs I saw.

Alex

Replacement library: embedly2

Unfortunately this library appears to have been abandoned. I just released embedly2 0.6.0 (https://pypi.org/project/embedly2/), a fork of this library that drops Python 2 support and fixes #31. Feel free to use it and report bugs if you need to use embedly with a recent toolchain.

If the original maintainers return to this project, I'm happy to archive my fork in favor of this package. Also, if anyone would like to contribute to improving embedly2, please let me know.

Embedly client fails on certain URLs with KeyError

This happens with the latest version of the client 0.5.0

from embedly import Embedly
from django.conf import settings
client = Embedly(settings.EMBEDLY_EXTRACT_KEY)
url = u'http://aldianews.com/articles/politics/cost-story-—-interactive-storymap-about-conflict-journalism/36116'
thumbnail_max_width=320
words=100
embedly_obj = client.extract(url, maxwidth=thumbnail_max_width, words=words)

The resulting error is:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/lsemel/www/virtualenvs/muckrack/src/embedly/embedly/client.py", line 169, in extract
    return self._get(1, 'extract', url_or_urls, **kwargs)
  File "/Users/lsemel/www/virtualenvs/muckrack/src/embedly/embedly/client.py", line 121, in _get
    query += '&url=%s' % quote(url_or_urls)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 1282, in quote
    return ''.join(map(quoter, s))
KeyError: u'\u2014'

Objectify method is dead

Looks like the objectify method is no longer supported, might be worth pulling out of the api wrapper.

is_supported should follow rediects

I just tried to embed a couple of bit.ly links on your site, and they worked fine, resolving the redirects and returning an embed code for the resulting url. I was confused when is_supported didn't work that way, and instead returned that the link was not supported. So this is my feature request, make is_supported support redirects.

0.4.5 release on pypi would be awesome

The good work of @joncotton and @dokipen is hard to use until pypi gets updated. In the mean while folks can add
-e git+git://github.com/embedly/embedly-python.git#egg=embedly
to their requirements files or run it as a argument to pip install to install the current master.

From the examples it is expected that obj['error'] is always set

Hi, thanks for this great library. I just wanted to report a behavior that, in my opinion, is not very obvious: in the examples it is shown that to check for errors it's enough to check whether obj['error'] is True. But when the request is successful the key 'error' is not set at all which might lead to a KeyError.

Is there a reason why obj['error'] is not set to False if the request is successful instead of not being set at all? I would expect this behavior for error_code not for just error.

Thank you.

Problems installing library with setuptools > 58.0.0

I was installing your package recently and it came to my attention that installation fails.

A simple test to replicate:

Adams-MBP:programming claim$ mkdir testing_embedly_installation
Adams-MBP:programming claim$ cd testing_embedly_installation/
Adams-MBP:testing_embedly_installation claim$ python3 -m venv venv
Adams-MBP:testing_embedly_installation claim$ source venv/bin/activate
(venv) Adams-MBP:testing_embedly_installation claim$ pip install -U setuptools
Collecting setuptools
  Using cached https://files.pythonhosted.org/packages/11/b9/adac241e2c4aca7ae4ddd86d3c18227667665b6e7eac550695bfc50c7e3d/setuptools-60.6.0-py3-none-any.whl
Installing collected packages: setuptools
  Found existing installation: setuptools 41.2.0
    Uninstalling setuptools-41.2.0:
      Successfully uninstalled setuptools-41.2.0
Successfully installed setuptools-60.6.0
(venv) Adams-MBP:testing_embedly_installation claim$ python
Python 3.8.3 (v3.8.3:6f8c8320e9, May 13 2020, 16:29:34)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import setuptools
>>> setuptools.__version__
'60.6.0'
>>> ^D
(venv) Adams-MBP:testing_embedly_installation claim$ pip install embedly
Collecting embedly
  Using cached https://files.pythonhosted.org/packages/d7/94/2e387186617fe450fd21da3fd08c4ea1c68914c21622e939a892755620bc/Embedly-0.5.0.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /Users/claim/programming/testing_embedly_installation/venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/z9/p68f7pds4nz6lg602cxzhm040000gn/T/pip-install-5c2mwtoc/embedly/setup.py'"'"'; __file__='"'"'/private/var/folders/z9/p68f7pds4nz6lg602cxzhm040000gn/T/pip-install-5c2mwtoc/embedly/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
         cwd: /private/var/folders/z9/p68f7pds4nz6lg602cxzhm040000gn/T/pip-install-5c2mwtoc/embedly/
    Complete output (2 lines):
    Warning: 'classifiers' should be a list, got type 'tuple'
    error in Embedly setup command: use_2to3 is invalid.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

there are 2 issues that need to be addressed here:

  1. classifiers are a tuple (should be a list)
  2. use_2to3 is no longer available in setuptools (since version 58.0.0 - more on that here: https://setuptools.pypa.io/en/latest/history.html#v58-0-0)

For now, I have created a fork that (I think?) addresses the problems as I'm not sure if this lib is still supported (but as my changes remove support for python2 completely, it would be a bit naughty to create a PR to this branch from it :D).

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.