Como criar um webservice Restful com Python

1,566 views
Skip to first unread message

Rodrigo Martins

unread,
Aug 26, 2014, 9:55:26 PM8/26/14
to python...@googlegroups.com
Como criar um webservice Restful com Python

Alexandre Souza

unread,
Aug 27, 2014, 8:10:50 AM8/27/14
to python...@googlegroups.com


Em 26 de agosto de 2014 22:55, Rodrigo Martins <rodrigoma...@gmail.com> escreveu:
Como criar um webservice Restful com Python

--
--
------------------------------------
Grupo Python-Brasil
http://www.python.org.br/wiki/AntesDePerguntar
 
<*> Para visitar o site do grupo na web, acesse:
http://groups.google.com/group/python-brasil
 
<*> Para sair deste grupo, envie um e-mail para:
python-brasi...@googlegroups.com

---
Você recebeu essa mensagem porque está inscrito no grupo quot;Python Brasil" dos Grupos do Google.
Para cancelar inscrição nesse grupo e parar de receber e-mails dele, envie um e-mail para python-brasi...@googlegroups.com.
Para mais opções, acesse https://groups.google.com/d/optout.

Thiago Avelino

unread,
Aug 27, 2014, 8:12:56 AM8/27/14
to python...@googlegroups.com
Segue um blog post falando sobre como escrever uma API usando bottle:



Cheers,
Thiago Avelino

Fabio C. Barrionuevo da Luz

unread,
Aug 27, 2014, 8:14:45 AM8/27/14
to python...@googlegroups.com

Você também pode usar o django + django-restframework

__
Fábio C. Barrionuevo da Luz Acadêmico de Sistemas de Informação na Faculdade Católica do Tocantins - FACTO Palmas - Tocantins - Brasil - América do Sul

http://pythonclub.com.br/

Blog colaborativo sobre Python e tecnologias Relacionadas, mantido totalmente no https://github.com/pythonclub/pythonclub.github.io .

Todos são livres para publicar. É só fazer fork, escrever sua postagem e mandar o pull-request.
Leia mais sobre como publicar em README.md e contributing.md.
Regra básica de postagem: "Você" acha interessante? É útil para "você"? Pode ser utilizado com Python ou é útil para quem usa Python? Está esperando o que? Publica logo, que estou louco para ler...

bleno nascimento

unread,
Aug 27, 2014, 9:01:38 AM8/27/14
to python...@googlegroups.com
Atenciosamente,

Bleno N. Silva -- 
LightBase - Consultoria em Software Público Ltda.
Desenvolvedor Web
Tel: +55(61) 9235-4482

Tel: +55(61) 3347-1949

Alexandre Souza

unread,
Aug 27, 2014, 9:28:21 AM8/27/14
to python...@googlegroups.com
Pessoal,

Eu achei bem legal as opções compartilhadas aqui e tomei a liberdade de reuni-las em um gist (um blog post seria interessante também, mas o gist foi mais rápido):

Se alguém quiser melhorar/adicionar algo, fique a vontade. Eu acho útil para iniciantes (o/) ou caso essa pergunta apareça novamente.

[ ]'s

Fábio Cerqueira

unread,
Aug 27, 2014, 11:22:32 AM8/27/14
to python...@googlegroups.com

Nunca usei, mas achei interessante quando postaram aqui, fica mais uma opção para você avaliar hehe.
Fábio Cerqueira

Rodrigo Delduca

unread,
Aug 27, 2014, 12:08:15 PM8/27/14
to python...@googlegroups.com
Já usei o Eve e o Flask-Restful mencionados aqui, é realmente são
muito bons, recomendo!



--
http://www.nullonerror.org/
-- flipping bits whilst updating pixels

"The world is full of fascinating problems waiting to be solved" --
Eric S.Raymond
-... .-.. --- --- -.. --- ..-. .-.. .. --- -. ... .-. ..- ... .... ..
-. --. - .... .-. ..- -- -.-- ...- . .. -. ...
"Scientists study the world as it is; engineers create the world that
has never been" -- Theodore von Kármán
.--. ..- -- .--. .. -. --. - .... . -.-. --- .-.. -.. -. . ... ... ---
..-. -- -.-- .... . .- .-. -
"Security is an illusion. Paranoia is our profession" -- Strategic Air command
.... . .-. . .. -.-. --- -- . .- - - .... . ... .--. . . -.. --- .- --
..- .-. -.. . .-. . .-. ... --- ..- -. -..
"They say hackers die twice, once when they pass, and then again when
the last of their code is rewritten by some asshole using JavaScript"
-- Anonymous
-... .-.. --- --- -.. --- ..-. .-.. .. --- -. ... .-. ..- ... .... ..
-. --. - .... .-. ..- -- -.-- ...- . .. -. ...
"He who hasn't hacked assembly language as a youth has no heart. He
who does as an adult has no brain" -- John Moore

tiagoprn

unread,
Aug 27, 2014, 12:27:12 PM8/27/14
to python...@googlegroups.com

REST API com um "admin" de brinde:
http://sandman.io/

Você está recebendo esta mensagem porque se inscreveu no grupo "Python Brasil" dos Grupos do Google.

Para cancelar inscrição nesse grupo e parar de receber e-mails dele, envie um e-mail para python-brasi...@googlegroups.com.
Para obter mais opções, acesse https://groups.google.com/d/optout.

tiagoprn

unread,
Aug 27, 2014, 12:30:17 PM8/27/14
to python...@googlegroups.com

Renzo Nuccitelli

unread,
Aug 27, 2014, 2:47:34 PM8/27/14
to python...@googlegroups.com
Puxando a sardinha para o meu projeto, recomendo ver o Tekton:


No primeiro vídeo, de motivação, eu já mostro a geração de código automática que já aprenseta operações básicas (CRUD) com REST.

 Abs,​

--
  Renzo Nuccitelli

Rodrigo Delduca

unread,
Aug 27, 2014, 2:56:18 PM8/27/14
to python...@googlegroups.com
Renzo,

Não me leve a mal, mas eu odeio assistir vídeos. Qual o endereço do
repositório do seu projeto?

Att.


--
http://www.nullonerror.org/
-- flipping bits whilst updating pixels

"The world is full of fascinating problems waiting to be solved" --
Eric S.Raymond
-... .-.. --- --- -.. --- ..-. .-.. .. --- -. ... .-. ..- ... .... ..
-. --. - .... .-. ..- -- -.-- ...- . .. -. ...
"Scientists study the world as it is; engineers create the world that
has never been" -- Theodore von Kármán
.--. ..- -- .--. .. -. --. - .... . -.-. --- .-.. -.. -. . ... ... ---
..-. -- -.-- .... . .- .-. -
"Security is an illusion. Paranoia is our profession" -- Strategic Air command
.... . .-. . .. -.-. --- -- . .- - - .... . ... .--. . . -.. --- .- --
..- .-. -.. . .-. . .-. ... --- ..- -. -..
"They say hackers die twice, once when they pass, and then again when
the last of their code is rewritten by some asshole using JavaScript"
-- Anonymous
-... .-.. --- --- -.. --- ..-. .-.. .. --- -. ... .-. ..- ... .... ..
-. --. - .... .-. ..- -- -.-- ...- . .. -. ...
"He who hasn't hacked assembly language as a youth has no heart. He
who does as an adult has no brain" -- John Moore



bleno nascimento

unread,
Aug 27, 2014, 3:34:27 PM8/27/14
to python...@googlegroups.com
Alexandre,

           Ótima iniciativa.

Bruno Saboia

unread,
Aug 27, 2014, 3:53:26 PM8/27/14
to python...@googlegroups.com
Tem o eve, framework bem interessante

Rodrigo Delduca

unread,
Aug 27, 2014, 3:59:35 PM8/27/14
to python...@googlegroups.com
Bruno,
O eve já foi mencionado nesta thread.


--
http://www.nullonerror.org/
-- flipping bits whilst updating pixels

"The world is full of fascinating problems waiting to be solved" --
Eric S.Raymond
-... .-.. --- --- -.. --- ..-. .-.. .. --- -. ... .-. ..- ... .... ..
-. --. - .... .-. ..- -- -.-- ...- . .. -. ...
"Scientists study the world as it is; engineers create the world that
has never been" -- Theodore von Kármán
.--. ..- -- .--. .. -. --. - .... . -.-. --- .-.. -.. -. . ... ... ---
..-. -- -.-- .... . .- .-. -
"Security is an illusion. Paranoia is our profession" -- Strategic Air command
.... . .-. . .. -.-. --- -- . .- - - .... . ... .--. . . -.. --- .- --
..- .-. -.. . .-. . .-. ... --- ..- -. -..
"They say hackers die twice, once when they pass, and then again when
the last of their code is rewritten by some asshole using JavaScript"
-- Anonymous
-... .-.. --- --- -.. --- ..-. .-.. .. --- -. ... .-. ..- ... .... ..
-. --. - .... .-. ..- -- -.-- ...- . .. -. ...
"He who hasn't hacked assembly language as a youth has no heart. He
who does as an adult has no brain" -- John Moore



Bruno Saboia

unread,
Aug 27, 2014, 4:49:14 PM8/27/14
to python...@googlegroups.com
Desculpa, não tinha visto. Eu uso o eve, acho ele traquilo.

Renzo Nuccitelli

unread,
Aug 27, 2014, 11:52:00 PM8/27/14
to python...@googlegroups.com
Em 27 de agosto de 2014 15:55, Rodrigo Delduca <rodrigo...@gmail.com> escreveu:
Não me leve a mal, mas eu odeio assistir vídeos. Qual o endereço do
repositório do seu projeto?

Contudo, a documentação por enquanto está nos vídeos e no livro.

 Abs,​
 



--
  Renzo Nuccitelli

Matheus Cardoso

unread,
Aug 28, 2014, 5:54:14 AM8/28/14
to python...@googlegroups.com
Tem também o web2py. Basta usar decorators e pronto. Acho difícil achar algo mais simples. ;)

Mário Idival

unread,
Aug 28, 2014, 8:34:01 AM8/28/14
to python...@googlegroups.com


Em quinta-feira, 28 de agosto de 2014 06h54min14s UTC-3, Matheus Cardoso escreveu:
Tem também o web2py. Basta usar decorators e pronto. Acho difícil achar algo mais simples. ;)

Matheus Cardoso

unread,
Aug 29, 2014, 3:47:18 PM8/29/14
to python...@googlegroups.com
Mario Dival, sem flameware, hein? :) 
Mas já que você postou do pyramid, vou eu postar um do web2py. Olha só:

Num controller, você coloca sua função e :

@service.run
def concat(a,b):
    return a+b
E "magically" já é possível acessar "concat" assim:

É possível anotar funções  no controller para serem acessadas via SOAP, RPC e muito mais:

@service.xml
@service.json
@service.rss
@service.csv
@service.xmlrpc
@service.jsonrpc
@service.jsonrpc2
@service.amfrpc3('domain')
@service.soap('FunctionName',returns={'result':type},args={'param1':type,})
Mais informações é só acessar a seção "Services" do livro do web2py: http://web2py.com/books/default/chapter/29/10/services

On Tuesday, August 26, 2014 10:55:26 PM UTC-3, Rodrigo Martins wrote:

Rodrigo Delduca

unread,
Aug 29, 2014, 3:55:40 PM8/29/14
to python...@googlegroups.com
web2py suporta python 3? /troll


--
http://www.nullonerror.org/
-- flipping bits whilst updating pixels

"The world is full of fascinating problems waiting to be solved" --
Eric S.Raymond
-... .-.. --- --- -.. --- ..-. .-.. .. --- -. ... .-. ..- ... .... ..
-. --. - .... .-. ..- -- -.-- ...- . .. -. ...
"Scientists study the world as it is; engineers create the world that
has never been" -- Theodore von Kármán
.--. ..- -- .--. .. -. --. - .... . -.-. --- .-.. -.. -. . ... ... ---
..-. -- -.-- .... . .- .-. -
"Security is an illusion. Paranoia is our profession" -- Strategic Air command
.... . .-. . .. -.-. --- -- . .- - - .... . ... .--. . . -.. --- .- --
..- .-. -.. . .-. . .-. ... --- ..- -. -..
"They say hackers die twice, once when they pass, and then again when
the last of their code is rewritten by some asshole using JavaScript"
-- Anonymous
-... .-.. --- --- -.. --- ..-. .-.. .. --- -. ... .-. ..- ... .... ..
-. --. - .... .-. ..- -- -.-- ...- . .. -. ...
"He who hasn't hacked assembly language as a youth has no heart. He
who does as an adult has no brain" -- John Moore



Matheus Cardoso

unread,
Aug 30, 2014, 8:30:00 PM8/30/14
to python...@googlegroups.com
Rodrigo, aí é flameware, hein? ahuahuauhahuahu.
Mas não suporta, pois quebraria uma das principais premissas do framework que é a retrocompatibilidade. Segundo o Massimo, não há sequer planos (e nem intenção) de se portar para o Python 3, por causa, principalmente, disso. Quem sabe um web3py. :P


On Tuesday, August 26, 2014 10:55:26 PM UTC-3, Rodrigo Martins wrote:

Dyego Cantu

unread,
Sep 5, 2014, 8:07:08 PM9/5/14
to python...@googlegroups.com
Olá pessoal,

Aproveitando o tópico, aqui vai minha primeira dúvida na lista :-P

Tambem estamos começando um projeto com API RESTful.
Como já usamos o Django pensei no DRF (Django REST Framework).
Alguma crítica a respeito do DRF?

Abraço.
Dyego
Reply all
Reply to author
Forward
0 new messages