Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Javascript function arguments extraction with PyV8
import PyV8
class Globals(PyV8.JSClass):
def __init__(self):
super(Globals, self).__init__()
self.coords = []
def PutMarkers(self, selector, coords):
coords = PyV8.convert(coords)
for coord in coords['data']:
'lat': float(coord['lat']),
'lng': float(coord['lng']),
'id': int(coord['id'])
def ready(self, function):
def __call__(self, *args, **kwargs):
return self
def __getattr__(self, *args):
return self
script_content = """
new AwesomeLibrary.PutMarkers('#map', {
data: [{id: '1', lat: '47.160971', lng: '16.4878386'}]
context_globals = Globals()
with PyV8.JSContext(context_globals) as ctx:

This comment has been minimized.

Copy link
Owner Author

slapec commented Feb 8, 2015

This is a Python 3 project. See the related blog post (hungarian):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.