Search

Wednesday, September 2, 2020

About Scratch :: Advanced Topics :: How do you get a value from the scratch servers using HTML?

ninjaMAR : Maybe this or this?
You could use which I made so give credit to @ninjamar
import urllib.request
def unreadMessages(user):
    with urllib.request.urlopen(f"https://api.scratch.mit.edu/users/{user}/messages/count/
") as data:
        html = data.read()
    return html
def userPage(user):
    with urllib.request.urlopen(f"https://api.scratch.mit.edu/users/{user}/") as data:
        html = data.read()
    return html
    
def projectCount():
    with urllib.request.urlopen("https://api.scratch.mit.edu/projects/count/all") as data:
        html = data.read()
    return html
def siteStatus():
    with urllib.request.urlopen("https://api.scratch.mit.edu/health") as data:
        html = data.read()
    return html
def userActivity(user,maxData):
    with urllib.request.urlopen(f"https://scratch.mit.edu/messages/ajax/user-activity/?user={user}&max={maxData}") as data:
        html = data.read()
        #html.replace(html,html,"\n")
    return html
def userProjects(user):
    with urllib.request.urlopen(f"https://api.scratch.mit.edu/{user}/projects as data:
        html = data.read
    return html


from Latest posts on Advanced Topics https://ift.tt/31UCRq6

No comments:

Post a Comment