I am trying to write a Python script to POST a multipart form to a site that requires authentication through CAS.
There are two approaches that both solve part of the problem:
-
The Python requests library works well for submitting multipart forms.
-
There is caslib, with a login function. It returns an OpenerDirector that can presumably be used for further requests.
Unfortunately, I can’t figure out how to get a complete solution out what I have so far.
There are just some ideas from a couple hours of research; I am open to just about any solution that works.
Thanks for the help.
You could use
posterto prepare multipart/form-data. Try to pass poster’s opener to the caslib and use caslib’s opener to make requests (not tested):