How to emulate a browser preferably usinng Python or a Linux tool - http

I have the URL / Request Header / POST contents . Is it possible for me to sent the query to the server and get the output HTML and Javascript ?
This is a AJAX stuff , but still I think we can emulate using HTTP .
Is there a convenient method for this using Python ? Or is there a GUI tool ,
that would just lee enter the all the REQUEST HEADER options and also the POST contents and get the desired output ?

On perl you have LWP::UserAgent module. Python have sth similar urllib2 (it should be in core libraries). You may also need "Beautiful Soup" for html/xml parsing.

You can use "wget" which should be available for most distros.
Read up on --post-file and --header.
http://linux.die.net/man/1/wget

In Python you also have Google's httplib2 which has a higher level interface than urllib2.
For further detail see Python urllib vs httplib?

Related

Python 3.X Robot Framework: Library To Use to push SOAP Request To Services/Listener

I am trying to learn about any library which is good to use with Python 3.X where Script can send the SOAP/XML request to Listener/Services and Capture the response.
HttpLibrary.HTTP cant work with python 3. similar case with JASONLibrary. Any suggestions?
I used "suds" library to send SOAP requests and it worked fine.
Please give it a try. The instructions are in the below link
Python3-Suds
Also check the Robot Suds library
Robot-Suds

Interacting with OptaPlanner through CLI instead of GUI

I am looking for a way to interact with OptaPlanner directly from the command line interface (CLI) without having to use the graphical user interface (GUI).
More specifically, I am looking to pass an XML file to the Employee Rostering function, and to get the solved XML back. Ultimately, I am looking to interact with OctaPlanner from my PHP application.
Any documentation for this?
Here is some what of an example of what I which to achieve:
http://www.c0940097.ferozo.com/applying-optaplanner-to-everyday-problems/
The UI is only for the examples. Take a look at CloudBalancingHelloWorld.java which solves without a UI.
Or, if you're looking for a more enterprise approach, use OptaPlanner Execution Server (also ASL), which exposes everything as REST api's.

h5ai use on a CDN?

Is it possible to use the h5ai "pretty" index UI on a CDN? I'm using Dreamhosts' DreamObjects and have it installed correctly (I've used it before on standard hosting sites). Am only getting an XML parse of the data back.
See it here: https://randassets.objects.cdn.dream.io/
Any thoughts? Thanks!
I guess what you would like to see is a pretty-looking list of files and directories on a web page, like a file browser to explore the content of your DreamObjects bucket. If that's the case, hi5ai would not work because from what I understand, hi5ai doesn't natively speak neither the S3 API nor the OpenStack Swift ones. hi5ai relies on a web server and a php interpreter, which are not provided by DreamObjects.
Maybe if you expand on your use case I can suggest you other tools you could use to browse your collection of files, something like ownCloud (and more specifically how to configure DreamObjects with ownCloud) or others.

Auto-generate ReST web services documentation/WADL

We are creating ReST Web Services using ASP.NET and OpenRasta.
Is there any tool that can could help us:
create WADL file
or/and create human readable API documentation similar which decribed resources/HTTP
methods supported for each resource, etc ?
Looks like REST Describe & Compile should do the trick.
On the WADL developer site Marc Hadley
maintains a command line tool named
WADL2Java. The ambitious goal of REST
Describe & Compile is to provide sort
of WADL2Anything. So what REST
Describe & Compile does is that it:
Generates new WADL files in a completely interactive way.
Lets you upload and edit existing WADL files.
Allows you to compile WADL files to source code in various programming
languages.
For OpenRasta, it'd be possible to use a UriDecorator to have help-like URIs defined for your resources (such as /myResource$help). You can then rewrite the URI before parsing to something yo can document easily, parse teh uri, find the resource type, and rewrite to /help/{resourcetype}
From there you register a resource for your help system:
ResourceSpace.Has.ResourcesOfType()
.AtUri("/help/{resourceType}")
.HandledBy()
.RenderedByXxx()
Then you can create your handler to return the documentation about a resource. You could for example use the IOperationCreator service to know which http methodds are available and with what input arguments, use the ICodecRepository to see what media types may be accepted as input, and potentially what a media type serialization would look like by calling the codec and generating an html friendly view of it.
That's definitly an area we're going to work on for the next version.

Flex SDK 3.5 - Check file mimetype

Is there a way to get a file's mimetype in Flex SDK 3.5 without using its extension?
I need to validate if an uploaded file is of a certain kind. This is for images, or documents (PDF, ODT, etc.)
All the solutions I've found are by checking its extension. What if I rename a .odt file as a .jpg? Then I can upload it as an image...
I should add, we are using an AIR desktop client and a Java EE server. File checking is solved on the Java side, but the idea is not to go to the server, validate the file so if it's not valid, there's no network traffic at all.
Not really. Files do not have an inherent MIME type. The MIME type of arbitrary content data is described in the header of the internet protocol used to transport the data (such as HTTP, SMTP, RTP, etc.).
The only other solution I could think of off the top of my head is using a trial-and-error process where you have a guess at the file type you're dealing with, and you test that guess by actually opening the file (in your code) and testing for success. But that's ugly.
Steav, your solution just looks at the response header, which might not be set correctly.
Easiest way would be using php, if possible:
$fileinfo['content-type'];

Resources