[Chicago] REST API to Python Class?

Aaron Elmquist elmq0022 at umn.edu
Tue May 2 10:22:19 EDT 2017


I think it would be easy to load what I'm assuming is JSON into a python
dictionary and use it from there.

If you need an object with additional methods you could instantiate it from
the dictionary.  Something like:

class MyClass(object):
    def __init__(self, parameters):
        self.a = a
        ....

or you could get real fancy with setattr ... (maybe not a good idea though)

then you could load it with:

my_obj = MyClass(**dict_from_json_data)


Honestly, I think I would just work with the dictionary directly if I
could.


On Tue, May 2, 2017 at 9:01 AM, Lukasz Szybalski <szybalski at gmail.com>
wrote:

> Hello,
> Does anybody know if there is a tool that would auto-read rest API and
> create a python like object that you can interact in python? (like:
> pysimplesoap and its WSDL() but for REST)
>
> *myobject = Rest*(https://dev.twitter.com/rest/public)
>
> or
> http://developer.edmunds.com/api-documentation/vehicle/
> or
> ....
>
>
> then myobject.get.searchTweet('chicago python')..?
> or what ever the syntax is.
> This would issue a rest api call and return object back.
>
> I think a lot of projects are building python api that are more and more
> json exposed. I'm looking for a tool that would allow me to access these
> using python, instead of rest:
>
> "GET /1.1/search/tweets.json?q=chicago%20python":
>
> +Access anything that was build with:
> http://swagger.io/
> openapi
>
>
> Thanks
> Lucas
>
>
> --
> LucasManual.com
>
>
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> https://mail.python.org/mailman/listinfo/chicago
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20170502/b93c9fcd/attachment.html>


More information about the Chicago mailing list