I want to get data on request module

My intention is to get the count of no of followers on Instagram.

I see that we don’t have a request module to request and use re to get the count. but as we have urllib is it possible to get the number of followers using it.

Like this below

import requests
import re

user = “espn”
url = ‘https://www.instagram.com/’ + user
r = requests.get(url).text
followers = re.search(’“edge_followed_by”:{“count”:([0-9]+)}’,r).group(1)

return followers

1 Like

Hosted Grist runs all formulas in a sandbox that has no access to the internet, so that users can open documents without needing to worry about malicious code. But if you run Grist on your own computer (see grist-core) then you are free to do anything you like, including installing the requests module and calling it. I tried your snippet, and it fetched data from instagram, but the result didn’t seem to be in the expected format?

Another option is to look for a service that does what you need that you can integrate - see a list at Integrator Services - Grist Help Center. Or to write a script using our API. But in neither of those options is Grist helping you a lot.