Giter Site home page Giter Site logo

iron_core_python's Introduction

iron_core_python

iron_core_python is a collection of common functions for working with the RESTful APIs that we build at Iron.io from Python.

It Is

  • Service-agnostic
  • Pip- and easy_install-installable
  • Well documented

It Is Not

  • An API wrapper. Those are specific to each service, and you can generally find them by checking the documentation for the service.
  • A place for service-specific code. This is only meant to handle the basic, common interaction.

Installation

You can use pip or easy_install to install the release version. If you'd like to work with a development or beta version, retrieve the files from Github and run python setup.py install from the root directory.

License

This software is released under the BSD 2-Clause License. You can find the full text of this license under LICENSE.txt in the module's root directory.

iron_core_python's People

Contributors

akx avatar alex-litvak avatar bmidgley avatar cederberg avatar danielecook avatar edsrzf avatar featalion avatar iced avatar maxcountryman avatar pyeremenko avatar quirky-username avatar rkononov avatar sunloverz avatar thedrow avatar treeder avatar ulandj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

iron_core_python's Issues

error messages get swallowed

r = self._doRequest(url, method, body, headers)
retry_http_codes = [503, 504]
if r.status_code in retry_http_codes and retry:
tries = 5
delay = .5
backoff = 2
while r.status_code in retry_http_codes and tries > 0:
tries -= 1
time.sleep(delay)
delay *= backoff
r = self._doRequest(url, method, body, headers)
r.raise_for_status()

The actual error message is in response.text and can't be accessed after the raise_for_status anymore. It's hard to know on application level what went wrong if the error is just "400 bad request". It would be good if the actual error message would be part of the exception message.

After hacking the library I found out that I actually got the error message {"msg":"Message must be no more than 64k"} from ironmq. I was spending have the day searching why my request is not working.

DNS Failover

alternative host names: IronMQ: mq-aws-us-east-1.irondns.info
IronCache: cache-aws-us-east-1.irondns.info
IronWorker: worker-aws-us-east-1.irondns.info
HUD: hud.irondns.info

'IronClient' object has no attribute 'path_prefix'

Hello,

We use the iron mq python client installed via pip, and it's been failing recently with:

  File "/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages/iron_mq.py", line 252, in __init__
    version=IronMQ.VERSION, product="iron_mq", **kwargs)
  File "/home/travis/virtualenv/python2.7.8/lib/python2.7/site-packages/iron_core.py", line 175, in __init__
    self.base_url = "%s://%s%s/%s/" % (self.protocol, self.host, self.path_prefix, self.api_version)
AttributeError: 'IronClient' object has no attribute 'path_prefix'

I noticed that path_prefix was added recently to iron_core and it seems like it might not be set in this if statement on line 175:

if self.protocol == "https" and self.port == 443:
    self.base_url = "%s://%s%s/%s/" % (self.protocol, self.host, self.path_prefix, self.api_version)

Should be available on PyPI

When I python setup.py develop a package that has IronMQ in its dependencies, it fails because it can't find iron-core on PyPI.

Searching for iron-core
Reading http://pypi.python.org/simple/iron_core/
Reading http://pypi.python.org/simple/iron-core/
Couldn't find index page for 'iron_core' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading http://pypi.python.org/simple/
No local packages or download links found for iron-core
Best match: None
Traceback (most recent call last):
  File "setup.py", line 20, in <module>
    install_requires=requires,
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "build/bdist.linux-i686/egg/setuptools/command/develop.py", line 27, in run
  File "build/bdist.linux-i686/egg/setuptools/command/develop.py", line 102, in install_for_development
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 519, in process_distribution
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 563, in resolve
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 799, in best_match
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 811, in obtain
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 434, in easy_install
  File "build/bdist.linux-i686/egg/setuptools/package_index.py", line 475, in fetch_distribution
AttributeError: 'NoneType' object has no attribute 'clone'

Also, the link in README.md points to http://pypi.python.org/pypi/iron_core_python. I think it should be http://pypi.python.org/pypi/iron_core, because the dependency in iron-mq is iron_core, not iron_core_python.

App Engine: ImportError: No module named pwd

Error when running on App Engine Python 1.7

File "/base/data/home/apps/s~-tools-hrd/2.360644688465653543/iron_mq.py", line 22, in init
version=IronMQ.VERSION, product="iron_mq", **kwargs)
File "/base/data/home/apps/s~-tools-hrd/2.360644688465653543/iron_core.py", line 63, in init
os.path.expanduser("~/.iron.json"), product)
File "/base/python27_runtime/python27_dist/lib/python2.7/posixpath.py", line 259, in expanduser
import pwd
ImportError: No module named pwd

pwd module is not available on App Engine VM.

It works just fine on the local App Engine dev env. I guess it is a App Engine problem, but maybe you can solve this so other developers do not have to bother.

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.