Programmatically access data about my Anvil apps

Yes.
Here is a snippet of the old code used to manage the login (after stripping out tons of stuff, hopefully not too much):

import requests
LOGIN_URL = 'https://anvil.works/login'
URL = 'https://anvil.works/ide/apps'
@anvil.server.background_task
def update_dependency_json(user_email, user_password):
  session = requests.Session()
  session.post(LOGIN_URL, data={'email': user_email, 'password': user_password})
  r = session.get(URL)
  user = anvil.users.get_user()

The job is done by a background task because the app UI allows to display and browse the dependencies using cached data, while the background task is running. If you don’t need updates about the most recent apps, you can start exploring without waiting for the background task to be finished. As soon as the background task has finished, the UI will use fresh data.

2 Likes