Quickstart¶
This page gives a brief introduction to the library. It assumes you have the library installed, if you don’t check out the Installing portion.
A Minimal Example¶
Let’s make a script that will download and save a product.
It looks something like this:
import imvu
import asyncio
async def main():
client = imvu.Client(username='Test', password='124512')
product = await client.get_product(12345678)
await product.download()
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()
Name this file whatever you want, product_download.py for example. Make sure not to name it imvu.py because
that will conflict with the library.
While there isn’t too much going on here, here is a breakdown step by step.
- The first line imports the library, if this raises a ModuleNotFoundError or ImportError then head on over to Installing section to properly install.
- The second line imports asyncio, this library is needed for asynchronous execution.
- We create an asynchronous function called main().
- Next, we create an instance of a
Client. This client is our connection to IMVU. - Then we get a product by awaiting
Client.get_product()and assigning it to the variable product - After we await the
Product.download()method and pass in the location where we want to save the data to.
Now that we’ve made a script, we have to run the script. Luckily, this is simple since this is just a Python script, we can run it directly.
On Windows:
$ py -3 product_download.py
On other systems:
$ python3 product_download.py
Now you can try playing around with your basic script.