-
Notifications
You must be signed in to change notification settings - Fork 0
Cloud API
PAGE WIP
You can request Cloud data from Scratch API only.
from ScraGet import ScraGet #import the package
data = ScraGet.get_cloud_data() #create a class
data.updateScratch("431041540",limit="10",offset="0") #update data
print(data.cloud_data) #print required infodata.cloud_data #yes. That's it. ScratchDB doesn't support/return Cloud data.
This is a feature where the package continuously scans the cloud for changes. If any, it runs your code that you specified it. (It's in form of a python decorator). it might be a bit complex to use but is a great tool!
from ScraGet import ScraGet
Cloud = ScraGet.cloud()
@Cloud.scan(ID="612229554",delay=1,NewThread=False) #params explained below
def hello(change): #change parameter is automatically passed.
print(change.var)
Cloud.stop = True #this stops the scanning. Don't put if u want to keep scanningID - (str) here, you need to enter the project ID of the project you want to scan. It's mandatory.
delay - (int) You need to set the delay between 2 scans. Note that it's better to set a high delay if this code is going to run for a long time. Better set it to 1 second or more. You will not lose data until 100 people change cloud variables. It's optional. Default=1
NewThread - (bool) Specify whether you want to create a new thread(it will allow you to run this parallel to your own code) or run in the main thread itself(any code below this will not run). It's optional. Default=True
Cloud.change_log #list of all changes. Max len = 100
#all the below is related to the 1st item of change_log
Cloud.recent #1st item of the change
Cloud.user #person who changed the cloud most recently
Cloud.type #the action of cloud change (set,delete, etc...)
Cloud.var #variable name
Cloud.value #the cloud value
Cloud.time #time when the change happened
Cloud.thread #given when NewThread = True. This contains the thread object
Cloud.stop #this is used to check whether the scanner is running or stoppedAny API you know not covered by this library? Any mistake in this wiki? Create an issue!
Have questions? Ask in the Q/A section!