I have a very Python-ic script which compiles with Transcrypt, but the issue is that the one outside dependency I have is that I need to import google-cloud-bigquery
. This obviously throws an error during the transpiling process, but it seems that the API is available in JavaScript (which is my target compilation) via <script src="https://apis.google.com/js/client.js">
But Transcrypt transpiles my index.py file, and I can't just place this JS script within the Python file (that I know of), so how do I implement it?
I know that other modules, such as Numscrypt, are available through Transcrypt but how do you actually add the module within the Python file?
Load the JavaScript library in the HTML page your Transcrypt code hangs off from. Then you should be able to access the top level object of Google's JavaScript Client Library in your Transcrypt module.
I am not familiar with Google's JavaScript Client Library, but from glancing at the doco I guess that
gapi
is the main object client.js exposes.Schematically you could do something like this: First the HTML file index.html:
Then in the same directory have the Transcrypt module your_google_stuff.py:
Compile your_google_stuff.py with Transcrypt and view your results by serving index.html.