Grasshopper

algorithmic modeling for Rhino

Is thre any solution to send a GET comand with customised query through grasshopper (recieving something as a text, for example?)

Views: 1336

Replies to This Discussion

does i need any vb.net libs for that? 

Hi Philipp,

can you elaborate on what you're looking to get?

Do you want to use the Rhino command line to ask the user for a string? Do you want to display a window where users can enter a string? ...?

--

David Rutten

david@mcneel.com

Poprad, Slovakia

No no - I meant the standart HTTP GET command for ordinary API responses - as here https://developer.foursquare.com/docs/venues/search

I like how it realised in quadrigram (http://docs.quadrigram.com/) but It will be much handler to realise something like this in grasshopper for me

executeHTTPGet

issues a GET request and returns the content of the response. This is useful to call APIs

Example
executeHTTPGet

  

Inlets list    (* mandatory Inlets)
String
        file url
  Object
        issues a relaod when receiving any kind of data
        Default value: null

 

Outlet
String

You could put this into a c# component with an input named 'url' that is of type string:

System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(url);

System.Net.HttpWebResponse res = (System.Net.HttpWebResponse)req.GetResponse();

 // Get the stream associated with the response.
Stream receiveStream = res.GetResponseStream();
StreamReader readStream = new StreamReader (receiveStream,   System.Text.Encoding.UTF8);

A = readStream.ReadToEnd();

res.Close();
readStream.Close();

Maybe there is a cleaner way, but this works for me...

thanks Luis - and I should make the url as a joint of real url and a query sintax, right?

yes, it should be the whole thing all together...

Thank you Luis.

Is there some other way to achieve this result? 

Just to wrap the theme, here is a slightly modified code  by Luis Fraguada

and an example of how to use it, connecting to "Geo to politics" API from this Great great toolkit

http://www.datasciencetoolkit.org/

component

example

wonder if it will be usefull to produce a bunch of components sending to this tookit

I was hoping to test out this definition, but it looks like the links are broken. Could you re-post?

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service