Re: Writing a module to abstract a REST api

2015-09-19 Thread Sven R. Kunze
Hi Joseph, the basic wiring instances together is done via the assignment operator: "=". Like: queue._api = foo. Now, the "queue" knows about its API instance. Question now is, when do you do "="? On 18.09.2015 23:43, Joseph L. Casale wrote: This is where I am going, but how do you perform d

Re: Writing a module to abstract a REST api

2015-09-18 Thread Joseph L. Casale
Hi Sven, >> The problem now comes from the following: >> >> # foo now contains a handle to the remote api. >> foo = InstanceOfApiWrapper() > > Is it necessary to have an instance of that API? Just curiosity here. Not always but often as the pattern here might rely on a handle to a c types based a

Re: Writing a module to abstract a REST api

2015-09-18 Thread Sven R. Kunze
On 18.09.2015 17:28, Joseph L. Casale wrote: So a design pattern I use often is to create Python objects to represent objects returned from what ever api I am abstracting. For example I might create named tuples for static data I dont intend to change or for an object I can both query for and cre

Re: Writing a module to abstract a REST api

2015-09-18 Thread Joseph L. Casale
> Well, I would be interested in seeing such a module as well. > > Most modules and frameworks, I know, providing REST and interacting with > REST are more like traditional SOAP-like web services. You got your > functions which have a 1-to-1 correspondence with some resource URLs and > that's it.

Re: Writing a module to abstract a REST api

2015-09-17 Thread Sven R. Kunze
Well, I would be interested in seeing such a module as well. Most modules and frameworks, I know, providing REST and interacting with REST are more like traditional SOAP-like web services. You got your functions which have a 1-to-1 correspondence with some resource URLs and that's it. Actual

Re: Writing a module to abstract a REST api

2015-09-17 Thread Joseph L. Casale
> If I understand you: > http://www.python-requests.org/en/latest/ > > is an example of what you are looking for? > > It's great. > > Also check out > http://cramer.io/2014/05/20/mocking-requests-with-responses/ > > if you need to mock requests. Hi Laura, The twitter samples Jon sent were good

Re: Writing a module to abstract a REST api

2015-09-17 Thread Laura Creighton
In a message of Thu, 17 Sep 2015 14:44:00 -, "Joseph L. Casale" writes: >I need to write a module to abstract the RabbitMQ HTTP REST api. >Before I do this, I would like to see how other projects have done >similar in the hopes I make something consistent and generic etc. > >Does anyone regular

Re: Writing a module to abstract a REST api

2015-09-17 Thread Jon Ribbens
On 2015-09-17, Joseph L. Casale wrote: >> There is https://pypi.python.org/pypi/librabbitmq ? > > Hi Jon, > That is the AMQP client that utilizes the c extensions, I am writing a > module to interact with a plugin that exposes a REST API. > > So I am not really after anything AMQP specific, just a

Re: Writing a module to abstract a REST api

2015-09-17 Thread Joseph L. Casale
> There is https://pypi.python.org/pypi/librabbitmq ? Hi Jon, That is the AMQP client that utilizes the c extensions, I am writing a module to interact with a plugin that exposes a REST API. So I am not really after anything AMQP specific, just a pointer to a project that abstracts anything with

Re: Writing a module to abstract a REST api

2015-09-17 Thread Jon Ribbens
On 2015-09-17, Joseph L. Casale wrote: > I need to write a module to abstract the RabbitMQ HTTP REST api. > Before I do this, I would like to see how other projects have done > similar in the hopes I make something consistent and generic etc. > > Does anyone regularly work with a library that abst

Writing a module to abstract a REST api

2015-09-17 Thread Joseph L. Casale
I need to write a module to abstract the RabbitMQ HTTP REST api. Before I do this, I would like to see how other projects have done similar in the hopes I make something consistent and generic etc. Does anyone regularly work with a library that abstracts a REST API and can recommend it for review?