%global _empty_manifest_terminate_build 0 Name: python-scratch2py Version: 0.7.1 Release: 1 Summary: Python to Scratch API connector License: MIT URL: https://github.com/The-Cloud-Dev/scratch2py Source0: https://mirrors.nju.edu.cn/pypi/web/packages/57/5b/c4d62e2829dba8b29cfc109424e5c37ff00170d945b8ce4d9b62cadbafe4/scratch2py-0.7.1.tar.gz BuildArch: noarch %description # Scratch2py Scratch2py or S2py is a easy to use, versatile tool to communicate with the Scratch API Based of [scratchclient](https://github.com/CubeyTheCube/scratchclient) by [Raihan142857](https://scratch.mit.edu/users/Raihan142857/) ## Installation Run this in your terminal ```bash pip install scratch2py pip install --force-reinstall websocket-client # may be required ``` ## Usage Import scratch2py in like this: ```python from scratch2py import Scratch2Py s2py = Scratch2Py('username', 'password') # Imports s2py and initializes a new s2py object. Enter your Scratch MIT credentials to create a connection with the API. ``` ## user class ```python user = s2py.user('username') user.exists() # Checks if a user exists. Returns true or false user.getMessagesCount() # Gets the number of messages someone has. user.getMessages() # Gets your messages and returns the JSON. user.getStatus() # Gets the 'about me' section of a users. user.getBio() # Gets the 'What I'm Working On' section of a users profile. user.getProjects() # Gets the projects that a user has. ``` ## userSession class ```python user = s2py.userSession('username') # Creates a userSession class. user.followUser() # Follows the user mentioned in the userSession constructor. user.unfollowUser('thatotheruser') # Unfollows the user mentioned in the userSession constructor. user.toggleCommenting() # Toggles commenting on your profile (On/Off) user.postComment('text','parent_id (OPTIONAL', 'commentee_id (OPTIONAL)')) # Posts a comment on the users profile ``` ## studioSession class ```python studio = s2py.studioSession('sid') studio.inviteCurator('person') # Invites a curator to a studio studio.addStudioProject('pid') # Adds a project to a studio studio.postComment('Text', 'parentid', 'commentee_id') studio.getComments() # Gets the comments from a studio studio.follow() # Follows a studio studio.unfollow() # Unfollows a studio ``` ## project class ```python project = s2py.project('id') project.getStats() # Gets the stats of a project. Returns statistics as JSON project.getComments() # Gets the comments of a project project.getInfo() # Gets the info of a project project.fetchAssets(type='img/snd') # Fetches assets of a project. Type is img by default, can be img or snd. snd will fetch sound files from the project. ``` ## projectSession class ```python project = s2py.projectSession('id') # Starts a project session to the specific project project.share() # Shares a project project.unshare() # Unshares a project project.favorite() # Favorites a project project.unfavorite() # Unfavorites a project project.love() # Loves a project project.unlove() # Unloves a project project.remix() # Remixes a project ``` ## scratchConnect Class Using the module for cloud on scratch. ```python cloudproject = s2py.scratchConnect('Project_Id') # Creates a new connection to a Scratch project. cloudproject.setCloudVar('CloudVar', 'Value') # Sets a value to a cloud variable. Don't add the cloud symbol. cloudproject.readCloudVar('variable name', 'Limit(optional)') # Gets the value of a cloud variable. Limit is when the program should stop looking for the value. Limit is 1000 by default. ``` ## turbowarpConnect class ```python turbowarp = s2py.turbowarpConnect('project_id') # Creates a new connection to a Turbowarp project. turbowarp.setCloudVar('CloudVar', 'Value') # Sets a value to a cloud variable. Don't add the cloud symbol. turbowarp.readTurbowarpVar('variable name') # Gets the value of a cloud variable. ``` ## cloudDatabase class ```python db = s2py.cloudDatabase('Project id') # Creates a new database that will detect messages on a certain project id db.startLoop() # Starts a new loop for the database. ``` Refer [here](https://scratch.mit.edu/projects/574609423/) for more info ## Encode/decode functions ```python s2py.encode('value') # Encodes a value. Scratch version available on my Scratch profile s2py.decode('value') # Decodes a value. To be used to communicate to and from a Scratch project. ``` ## The End That's it! Contact my on my [Scratch profile](https://scratch.mit.edu/users/TheCloudDev/#comments) %package -n python3-scratch2py Summary: Python to Scratch API connector Provides: python-scratch2py BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-scratch2py # Scratch2py Scratch2py or S2py is a easy to use, versatile tool to communicate with the Scratch API Based of [scratchclient](https://github.com/CubeyTheCube/scratchclient) by [Raihan142857](https://scratch.mit.edu/users/Raihan142857/) ## Installation Run this in your terminal ```bash pip install scratch2py pip install --force-reinstall websocket-client # may be required ``` ## Usage Import scratch2py in like this: ```python from scratch2py import Scratch2Py s2py = Scratch2Py('username', 'password') # Imports s2py and initializes a new s2py object. Enter your Scratch MIT credentials to create a connection with the API. ``` ## user class ```python user = s2py.user('username') user.exists() # Checks if a user exists. Returns true or false user.getMessagesCount() # Gets the number of messages someone has. user.getMessages() # Gets your messages and returns the JSON. user.getStatus() # Gets the 'about me' section of a users. user.getBio() # Gets the 'What I'm Working On' section of a users profile. user.getProjects() # Gets the projects that a user has. ``` ## userSession class ```python user = s2py.userSession('username') # Creates a userSession class. user.followUser() # Follows the user mentioned in the userSession constructor. user.unfollowUser('thatotheruser') # Unfollows the user mentioned in the userSession constructor. user.toggleCommenting() # Toggles commenting on your profile (On/Off) user.postComment('text','parent_id (OPTIONAL', 'commentee_id (OPTIONAL)')) # Posts a comment on the users profile ``` ## studioSession class ```python studio = s2py.studioSession('sid') studio.inviteCurator('person') # Invites a curator to a studio studio.addStudioProject('pid') # Adds a project to a studio studio.postComment('Text', 'parentid', 'commentee_id') studio.getComments() # Gets the comments from a studio studio.follow() # Follows a studio studio.unfollow() # Unfollows a studio ``` ## project class ```python project = s2py.project('id') project.getStats() # Gets the stats of a project. Returns statistics as JSON project.getComments() # Gets the comments of a project project.getInfo() # Gets the info of a project project.fetchAssets(type='img/snd') # Fetches assets of a project. Type is img by default, can be img or snd. snd will fetch sound files from the project. ``` ## projectSession class ```python project = s2py.projectSession('id') # Starts a project session to the specific project project.share() # Shares a project project.unshare() # Unshares a project project.favorite() # Favorites a project project.unfavorite() # Unfavorites a project project.love() # Loves a project project.unlove() # Unloves a project project.remix() # Remixes a project ``` ## scratchConnect Class Using the module for cloud on scratch. ```python cloudproject = s2py.scratchConnect('Project_Id') # Creates a new connection to a Scratch project. cloudproject.setCloudVar('CloudVar', 'Value') # Sets a value to a cloud variable. Don't add the cloud symbol. cloudproject.readCloudVar('variable name', 'Limit(optional)') # Gets the value of a cloud variable. Limit is when the program should stop looking for the value. Limit is 1000 by default. ``` ## turbowarpConnect class ```python turbowarp = s2py.turbowarpConnect('project_id') # Creates a new connection to a Turbowarp project. turbowarp.setCloudVar('CloudVar', 'Value') # Sets a value to a cloud variable. Don't add the cloud symbol. turbowarp.readTurbowarpVar('variable name') # Gets the value of a cloud variable. ``` ## cloudDatabase class ```python db = s2py.cloudDatabase('Project id') # Creates a new database that will detect messages on a certain project id db.startLoop() # Starts a new loop for the database. ``` Refer [here](https://scratch.mit.edu/projects/574609423/) for more info ## Encode/decode functions ```python s2py.encode('value') # Encodes a value. Scratch version available on my Scratch profile s2py.decode('value') # Decodes a value. To be used to communicate to and from a Scratch project. ``` ## The End That's it! Contact my on my [Scratch profile](https://scratch.mit.edu/users/TheCloudDev/#comments) %package help Summary: Development documents and examples for scratch2py Provides: python3-scratch2py-doc %description help # Scratch2py Scratch2py or S2py is a easy to use, versatile tool to communicate with the Scratch API Based of [scratchclient](https://github.com/CubeyTheCube/scratchclient) by [Raihan142857](https://scratch.mit.edu/users/Raihan142857/) ## Installation Run this in your terminal ```bash pip install scratch2py pip install --force-reinstall websocket-client # may be required ``` ## Usage Import scratch2py in like this: ```python from scratch2py import Scratch2Py s2py = Scratch2Py('username', 'password') # Imports s2py and initializes a new s2py object. Enter your Scratch MIT credentials to create a connection with the API. ``` ## user class ```python user = s2py.user('username') user.exists() # Checks if a user exists. Returns true or false user.getMessagesCount() # Gets the number of messages someone has. user.getMessages() # Gets your messages and returns the JSON. user.getStatus() # Gets the 'about me' section of a users. user.getBio() # Gets the 'What I'm Working On' section of a users profile. user.getProjects() # Gets the projects that a user has. ``` ## userSession class ```python user = s2py.userSession('username') # Creates a userSession class. user.followUser() # Follows the user mentioned in the userSession constructor. user.unfollowUser('thatotheruser') # Unfollows the user mentioned in the userSession constructor. user.toggleCommenting() # Toggles commenting on your profile (On/Off) user.postComment('text','parent_id (OPTIONAL', 'commentee_id (OPTIONAL)')) # Posts a comment on the users profile ``` ## studioSession class ```python studio = s2py.studioSession('sid') studio.inviteCurator('person') # Invites a curator to a studio studio.addStudioProject('pid') # Adds a project to a studio studio.postComment('Text', 'parentid', 'commentee_id') studio.getComments() # Gets the comments from a studio studio.follow() # Follows a studio studio.unfollow() # Unfollows a studio ``` ## project class ```python project = s2py.project('id') project.getStats() # Gets the stats of a project. Returns statistics as JSON project.getComments() # Gets the comments of a project project.getInfo() # Gets the info of a project project.fetchAssets(type='img/snd') # Fetches assets of a project. Type is img by default, can be img or snd. snd will fetch sound files from the project. ``` ## projectSession class ```python project = s2py.projectSession('id') # Starts a project session to the specific project project.share() # Shares a project project.unshare() # Unshares a project project.favorite() # Favorites a project project.unfavorite() # Unfavorites a project project.love() # Loves a project project.unlove() # Unloves a project project.remix() # Remixes a project ``` ## scratchConnect Class Using the module for cloud on scratch. ```python cloudproject = s2py.scratchConnect('Project_Id') # Creates a new connection to a Scratch project. cloudproject.setCloudVar('CloudVar', 'Value') # Sets a value to a cloud variable. Don't add the cloud symbol. cloudproject.readCloudVar('variable name', 'Limit(optional)') # Gets the value of a cloud variable. Limit is when the program should stop looking for the value. Limit is 1000 by default. ``` ## turbowarpConnect class ```python turbowarp = s2py.turbowarpConnect('project_id') # Creates a new connection to a Turbowarp project. turbowarp.setCloudVar('CloudVar', 'Value') # Sets a value to a cloud variable. Don't add the cloud symbol. turbowarp.readTurbowarpVar('variable name') # Gets the value of a cloud variable. ``` ## cloudDatabase class ```python db = s2py.cloudDatabase('Project id') # Creates a new database that will detect messages on a certain project id db.startLoop() # Starts a new loop for the database. ``` Refer [here](https://scratch.mit.edu/projects/574609423/) for more info ## Encode/decode functions ```python s2py.encode('value') # Encodes a value. Scratch version available on my Scratch profile s2py.decode('value') # Decodes a value. To be used to communicate to and from a Scratch project. ``` ## The End That's it! Contact my on my [Scratch profile](https://scratch.mit.edu/users/TheCloudDev/#comments) %prep %autosetup -n scratch2py-0.7.1 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-scratch2py -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Sun Apr 23 2023 Python_Bot - 0.7.1-1 - Package Spec generated