Giter Site home page Giter Site logo

httsleep's People

Contributors

kopf avatar oliverlockwood avatar

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

Watchers

 avatar  avatar  avatar  avatar  avatar

httsleep's Issues

Support passing in a `Session` object

Users may already have a requests.Session object and wish to reuse that rather than having httsleep create a blank one. This would save users from re-entering standard headers, settings etc. that they've already configured elsewhere.

Ideal usage afterwards:

    httsleep(url, until=until, alarms=alarms, session=my_session)

~~~Workaround~~~ Not usable

    poller = HttSleeper(url, until=until, alarms=alarms)
    poller.session = my_session
    poller.run()

Not usable because here the request is prepared without the context of the Session:

response = self.session.send(self.request.prepare()

The workaround would be usable if this line was instead:

response = self.session.send(self.session.prepare_request(request))

Improve documentation

Improve documentation such that:

  • we begin by defining a simple API and use it for all examples
  • the explanation of the conditions is less technical

Support `verify=False` usage as per requests library

It's not currently possible to use httsleep and ignore certificate errors, as you would with requests.get(..., verify=False).

This looks fairly simple to add so I'll try to follow this with a PR and hopefully we can improve things.

How to write condition that polls until field with given value is missing

In my case I create a job and want to poll until that job has completed. There is only one endpoint and it gives me the list of jobs that are in progress. If my job is not on the list - it's completed. Example response body:

[
   {"id": 1}, {"id": 2}, {"id": 3}
]

I want to poll until returned json does not contain my id. Any idea how can I write that condition?

Dict comprehensions don't work in Python 2.6

I know Python 2.6 is quite an old version :)
But dict comprehensions doesn't appear until Python 2.7, so below from main.py Line 81 would fail:

until.append({k: v for k, v in condition.items() if v})

Maybe a simple plain alternative list append is enough.

Add CLI

Add "httsleep from the command line"

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.