I’m trying to build a rhino model based on a json data from an API request.
iron python does not have the requests library installed, so I get the error message: Message: ‘No module named requests’
Is there another way to acces external API’s or a way to install libraries into iron python?
I’m trying to request from my own server, a REST http API request that returns json data that I’ll use for building geometry.
I got this far:
added request library to the scripts folder
now another library is asked for: added urllib3 to the scripts folder too
I get an error message when loading my python script that imports the request library:
Message: ‘module’ object has no attribute ‘_getframe’
Traceback:
line 692, in exec_, “/Users/joostbarendregt/Library/Application Support/McNeel/Rhinoceros/scripts/urllib3/packages/six.py”
line 701, in , “/Users/joostbarendregt/Library/Application Support/McNeel/Rhinoceros/scripts/urllib3/packages/six.py”
line 2, in , “/Users/joostbarendregt/Library/Application Support/McNeel/Rhinoceros/scripts/urllib3/exceptions.py”
line 11, in , “/Users/joostbarendregt/Library/Application Support/McNeel/Rhinoceros/scripts/urllib3/connectionpool.py”
line 8, in , “/Users/joostbarendregt/Library/Application Support/McNeel/Rhinoceros/scripts/urllib3/init.py”
line 43, in , “/Users/joostbarendregt/Library/Application Support/McNeel/Rhinoceros/scripts/requests/init.py”
line 2, in , “/Users/joostbarendregt/GIT_BB/craftr_rhino/design.py”
def readrequest():
file = urllib.urlopen('http://feeds.citibikenyc.com/stations/stations.json')
recieved_data =file.read()
file.close
datastore = json.loads(recieved_data)
for item in datastore['stationBeanList']:
print 'The station at {} has {} available bikes.'.format(item.get('stAddress1'), item.get('availableBikes'))
I have a similar problem. I wanna send a Dictionary to my Server and receive the results. Unfortunately the requests module is not available …can you please help me with a Workaround Scott?
Hey guys,
We faced the same problems and it was not easy to get this done due to the limitations of Iron py. We finally solved it.
This piece of code is now open, feel free to use it.