1

I am using Python and moving into rails. I have login python file:

resp = session.post('https://dummy.dummy.com/api/v1/sessions', data={
    "username": "email",
    "password": "######"
})

this will return API Token and from that we will get roles. How do I use this login in ruby on rails ?

Martin Tournoij
  • 26,737
  • 24
  • 105
  • 146
Anitha
  • 11
  • 2
  • Possible duplicate of [How make a HTTP request using Ruby on Rails?](http://stackoverflow.com/questions/4581075/how-make-a-http-request-using-ruby-on-rails) – Martin Tournoij Mar 22 '16 at 08:10
  • In my terminal i will run activate.sh which has "export API_TOKEN=`python ~/login.py`;" So basically login.py will return my api token. I need to implement this in ruby on rails. Since I am migrating from python to ROR. Also I am new to ROR – Anitha Mar 22 '16 at 10:53

1 Answers1

0

You can use the net/http for your purpose. Have a look at http://ruby-doc.org/stdlib-2.3.0/libdoc/net/http/rdoc/Net/HTTP.html#method-i-post

Vikram3891
  • 713
  • 1
  • 6
  • 15