0

There is form can upload files and input some fields, I built it using RoR

But what if I want to mimic sending a form in command line.

I want to achieve with Pyhton or Ruby

How to do it ?

I think I need to overcome the crsf_token first (I can wget the page, and get the crsf_token )

But I don't know how to send binary file via Net::HTTP in Ruby or httplib2 in Python

Thanks

user3675188
  • 7,271
  • 11
  • 40
  • 76
  • Use the `requests` module. See [Multipart-encoded file uploads](http://www.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file), and use a [session](http://docs.python-requests.org/en/latest/user/advanced/#session-objects) for easy storing of cookies. Details of retrieving and passing back the CSRF token depend on the server side application. – Lukas Graf Jun 17 '14 at 06:05
  • possible duplicate of [Ruby: How to post a file via HTTP as multipart/form-data?](http://stackoverflow.com/questions/184178/ruby-how-to-post-a-file-via-http-as-multipart-form-data) – Brad Werth Jun 20 '14 at 16:08

0 Answers0