Saravanan666/pypi-org huggingface dataset:
Package: scrapyu
scrapyuUserAgentMiddleware# settings.pyUSERAGENT_TYPE='firefox'DOWNLOADER_MIDDLEWARES={'scrapyu.UserAgentMiddleware':543,}MarkdownPipeline# settings.pyMARKDOWNS_STORE='news'ITEM_PIPELINES={'scrapyu.MarkdownPipeline':300,}# items.pyimportscrapyclassMarkdownItem(scrapy.Item):html=scrapy.Field()filename=scrapy.Field()FirefoxCookiesMiddleware# settings.pyGECKODRIVER_PATH='geckodriver'DOWNLOADER_MIDDLEWARES={'scrapyu.FirefoxCookiesMiddleware':543,}MongoDBPipeline# settings.pyMONGODB_URI='mongodb://localhost:27017'# or# MONGODB_HOST = 'localhost'# MONGODB_PORT = 27017MONGODB_DATABASE='scrapyu'MONGODB_COLLECTION='items'MONGODB_BUFFER_LENGTH=100MONGODB_UNIQUE_KEY='title name'# use only if no buffer# or# MONGODB_UNIQUE_KEY = ['title', 'name']# MONGODB_UNIQUE_KEY = ('title', 'name')ITEM_PIPELINES={'scrapyu.MongoDBPipeline':300,}RedisDupeFilter# settings.pyDUPEFILTER_CLASS='scrapyu.RedisDupeFilter'REDIS_DUPE_HOST='localhost'REDIS_DUPE_PORT=6379REDIS_DUPE_DATABASE=0REDIS_DUPE_PASSWORD='password'REDIS_DUPE_KEY='requests'REDIS_DUPE_IGNORE_URL=r'http://scrapytest.org/\d+'genspiderscrapyugenspider-lresults in :Available templates:
  single
  single_splashgenerate a single file spiderscrapyugenspiderpythonwww.python.org-tsinglegenerate a single file spider, integration splashscrapyugenspiderpythonwww.python.org-tsingle_splash
Package: scrapy-user-agents
Random User-Agent middleware picks upUser-Agentstrings based onPython User AgentsandMDN.InstallationThe simplest way is to install it viapip:pip install scrapy-user-agentsConfigurationTurn off the built-inUserAgentMiddlewareand addRandomUserAgentMiddleware.In Scrapy >=1.0:DOWNLOADER_MIDDLEWARES={'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware':None,'scrapy_user_agents.middlewares.RandomUserAgentMiddleware':400,}In Scrapy <1.0:DOWNLOADER_MIDDLEWARES={'scrapy.contrib.downloadermiddleware.useragent.UserAgentMiddleware':None,'scrapy_user_agents.middlewares.RandomUserAgentMiddleware':400,}User-Agent FileA default User-Agent file is included in this repository, it contains about 2200 user agent strings collected from <https://developers.whatismybrowser.com/> using <https://github.com/hyan15/crawler-demo/tree/master/crawling-basic/common_user_agents>. You can supply your own User-Agent file by setRANDOM_UA_FILE.Configuring User-Agent typeThere’s a configuration parameterRANDOM_UA_TYPEin format<device_type>.<browser_type>, default isdesktop.chrome. For device_type part, onlydesktop,mobile,tabletare supported. For browser_type part, onlychrome,firefox,safari,ie,safariare supported. If you don’t want to fix to only one browser type, you can userandomto choose from all browser types.You can setRANDOM_UA_SAME_OS_FAMILYto True to just use user agents that belong to the same os family, such as windows, mac os, linux, or android, ios, etc. Default value is True.Usage withscrapy-proxiesTo use with middlewares of random proxy such asscrapy-proxies, you need:setRANDOM_UA_PER_PROXYto True to allow switch per proxyset priority ofRandomUserAgentMiddlewareto be greater thanscrapy-proxies, so that proxy is set before handle UAConfiguring Fake-UserAgent fallbackThere’s a configuration parameterFAKEUSERAGENT_FALLBACKdefaulting toNone. You can set it to a string value, for exampleMozillaorYour favorite browser, this configuration can completely disable any
annoying exception.
Package: scrapy-util
Scrapy util基于scrapy 的一些扩展pypi:https://pypi.org/project/scrapy-utilgithub:https://github.com/mouday/scrapy-utilpip install scrapy-util启用数据收集功能此功能配合spider-admin-pro使用# 设置收集运行日志的路径,会以post方式提交json数据STATS_COLLECTION_URL="http://127.0.0.1:5001/api/statsCollection/addItem"# 启用数据收集扩展EXTENSIONS={# ===========================================# 可选：如果收集到的时间是utc时间，可以使用本地时间扩展收集'scrapy.extensions.corestats.CoreStats':None,'scrapy_util.extensions.LocaltimeCoreStats':0,# ===========================================# 可选，打印程序运行时长'scrapy_util.extensions.ShowDurationExtension':100,# 启用数据收集扩展'scrapy_util.extensions.StatsCollectorExtension':100}使用脚本Spider仅做脚本执行，Request 不请求网络# -*- coding: utf-8 -*-fromscrapyimportcmdlinefromscrapy_util.spidersimportScriptSpiderclassBaiduScriptSpider(ScriptSpider):name='baidu_script'defexecute(self):print("hi")if__name__=='__main__':cmdline.execute('scrapy crawl baidu_script'.split())列表爬虫ListNextRequestSpider基于 ListSpider 实现，如需自定义缓存，可以重写其中的方法# -*- coding: utf-8 -*-fromscrapyimportcmdlinefromscrapy_util.spidersimportListNextRequestSpiderclassBaiduListSpider(ListNextRequestSpider):name='list_spider'page_key="list_spider"# 必须实现的方法defget_url(self,page):return'http://127.0.0.1:5000/list?page='+str(page)defparse(self,response):print(response.text)# 调用下一页，该方法会在start_requests 方法自动调用一次# 如果不继续翻页，可以不调用yieldself.next_request(response)if__name__=='__main__':cmdline.execute('scrapy crawl list_spider'.split())MongoDB中间件使用示例settings.py# 1、设置MongoDB 的数据库地址MONGO_URI="mongodb://localhost:27017/"# 2、启用中间件MongoPipelineITEM_PIPELINES={'scrapy_util.pipelines.MongoPipeline':100,}# -*- coding: utf-8 -*-importscrapyfromscrapyimportcmdlinefromscrapy_util.itemsimportMongoItemclassBaiduMongoSpider(scrapy.Spider):name='baidu_mongo'start_urls=['http://baidu.com/']# 1、设置数据库的表名custom_settings={'MONGO_DATABASE':'data','MONGO_TABLE':'table'}defparse(self,response):title=response.css('title::text').extract_first()item={'data':{'title':title}}# 2、返回 MongoItemreturnMongoItem(item)if__name__=='__main__':cmdline.execute('scrapy crawl baidu_mongo'.split())如果需要做微调，可以继承MongoPipeline重写函数
Package: scrapy-warc
Table of ContentsInstallationLicenseInstallationscrapy_warc is distributed onPyPIas a universal
wheel and is available on Linux/macOS and Windows and supports
Python 2.7/3.5+ and PyPy.$pipinstallscrapy_warcLicensescrapy_warc is distributed under the terms of bothMIT LicenseApache License, Version 2.0at your option.
Package: scrapy-warcio
Scrapy WarcioA Web ArchiveWARCI/O module for ScrapyInstall$pipinstallscrapy-warcioUsageCreate a project and spider:https://docs.scrapy.org/en/latest/intro/tutorial.html$ scrapy startproject <project>
$ cd <project>
$ scrapy genspider <spider> example.comCopy and editscrapy_warciodistributedsettings.ymlwith your
configuration settings:---warc_spec:https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.0/max_warc_size:10000000000# 10GBcollection:~# collection namedescription:~# collection descriptionoperator:~# operator email addressrobots:~# robots policy (obey or ignore)user_agent:~# your user-agentwarc_prefix:~# WARC filename prefixwarc_dest:~# WARC files destination...ExportSCRAPY_WARCIO_SETTINGS=/path/to/settings.ymlAddWarcioDownloaderMiddleware(distributed asmiddlewares.py)
to your<project>/<project>/middlewares.py:importscrapy_warcioclassWarcioDownloaderMiddleware:def__init__(self):self.warcio=scrapy_warcio.ScrapyWarcIo()defprocess_request(self,request,spider):request.meta['WARC-Date']=scrapy_warcio.warc_date()returnNonedefprocess_response(self,request,response,spider):self.warcio.write(response,request)returnresponseEnableWarcioDownloaderMiddlewarein<project>/<project>/settings.py:DOWNLOADER_MIDDLEWARES = {
    '<project>.middlewares.WarcioDownloaderMiddleware': 543,
}Validate your warcs withinternetarchive/warctools:$warcvalidWARC.warc.gzUpload your WARC(s) to your favorite web archive!Help$pydocscrapy_warcioor>>>help(scrapy_warcio)TODOMaking this a Scrapy extension may make it more useful:https://docs.scrapy.org/en/latest/topics/extensions.html@internetarchive
Package: scrapy-wayback-middleware
Scrapy Wayback MiddlewareMiddleware for submitting all scraped response URLs to theInternet Archive Wayback Machinefor archival.Installationpipinstallscrapy-wayback-middlewareSetupAddscrapy_wayback_middleware.WaybackMiddlewareto your project'sSPIDER_MIDDLEWARESsettings. By default, the middleware will makeGETrequests toweb.archive.org/save/{URL}, but if theWAYBACK_MIDDLEWARE_POSTsetting isTruethen it will make POST requests topragma.archivelab.orginstead.ConfigurationTo configure custom behavior for certain methods, subclassWaybackMiddlewareand override theget_item_urlsmethod to pull additional links to archive from individual items orhandle_waybackto change how responses from the Wayback Machine are handled. TheWAYBACK_MIDDLEWARE_POSTcan be set toTrueto adjust request behavior.Duplicate FilteringIn order to avoid sending duplicate requests withWAYBACK_MIDDLEWARE_POSTset toFalse, you'll need to either includeweb.archive.orgin your spider'sallowed_domainsproperty (if specified) or disablescrapy.spidermiddlewares.offsite.OffsiteMiddlewarein your settings.Rate LimitsWhile neither endpoint returns headers indicating specific rate limits, theGETendpoint atweb.archive.org/savehas a rate limit of 25 requests/minute, resetting each minute. The middleware is configured to wait for 60 seconds whenever it sees a 429 error code to handle this.
Package: scrapy-webshare
scrapy_webshare===============.. image:: https://img.shields.io/pypi/v/scrapy_webshare.svg:target: https://pypi.python.org/pypi/scrapy_webshare:alt: Latest PyPI version.. image:: https://travis-ci.org/borntyping/cookiecutter-pypackage-minimal.png:target: https://travis-ci.org/borntyping/cookiecutter-pypackage-minimal:alt: Latest Travis CI build statusRequirements============* Python 2.7 or Python 3.4+* ScrapyUsage-----Installation------------You can install scrapy-webshare using pip::pip install scrapy-webshareRequirements^^^^^^^^^^^^Compatibility-------------Licence-------Authors-------`scrapy_webshare` was written by `Soufiane Benzaoui <benzaoui.soufiane@gmail.com>`_.
Package: scrapyx-bright-data
scrapyx-bright-dataBright Datamiddleware forScrapyRequiredpython version >= 2.7InstallCheckout the source and runpython setup.py installOrpip install scrapyx-bright-datasettings.py# Activate the middleware
BRIGHTDATA_ENABLED = True

# The Bright Data URL
BRIGHTDATA_URL = 'http://127.0.0.1:24000'

DOWNLOADER_MIDDLEWARES = {
    'scrapyx_bright_data.BrightDataProxyMiddleware': 610,
}
Package: scrapy-xls
XLS Scrapy SpiderScrapy spider for parsing XLS files. It receives a XLS file in a response; iterates through each of its rows, and callsparse_rowwith a dict containing each field's data and the sheet name. Inspired in the builtin CSV feed scrapy spider.This is built on top of openpyxl and pandas libs, you can set some options regarding the XLS file, such as the sheet names and number of rows to be skiped.
If sheets are not provided, it'll returns all sheets available.Installationpip install scrapy_xlsHow to usefrom scrapy_xls import XLSSpider


def SuperMarketCatalogSpider(XLSSpider):

    start_urls = [
        'https://www.supermarket.com/files/catalog-oct-22.xlsx',
        'https://www.supermarket.com/files/catalog-set-22.xlsx',
    ]

    skip_rows = 3 # Assuming that the sheet headers starts at the 4th row
    sheets = ['FRUITS', 'BEVERAGES']

    def parse_row(self, response, sheet, row):
        item = {}
        item['department'] = sheet
        item['product'] = row['NAME']
        item['price'] = row['PRICE']
        item['brand'] = row['BRAND']
        yield itemContributingFeel free to contribute with the project.Git repository.
Package: scrapy-xlsx
scrapy-xlsxis aScrapyexporter that supports the XLSX format. It
produces files that can be read with Microsoft Excel or LibreOffice Calc.UsageInstall the library usingpip:$ pip install scrapy-xlsxConfigure the exporter in your Scrapy projectsettings.pyfile:FEED_EXPORTERS = {
    'xlsx': 'scrapy_xlsx.XlsxItemExporter',
}Run your spider and export the data to XLSX (this command will overwrite the
output file if it already exists):$ scrapy crawl myspider -o output.xlsxLicenseLicensed under the MIT License.
Package: scrapyx-luminati
scrapyx-luminatiLuminatimiddleware forScrapyRequiredpython version >= 2.7InstallCheckout the source and runpython setup.py installOrpip install scrapyx-luminatisettings.py# Activate the middleware
LUMINATI_ENABLED = True

# The Luminati URL
LUMINATI_URL = 'http://127.0.0.1:24000'

DOWNLOADER_MIDDLEWARES = {
    'scrapyx_luminati.LumninatiProxyMiddleware': 610,
}
Package: scrapyx-scraperapi-proxy
scrapyx-scraperapi-proxyScraper API middleware for Scrapy (http://scrapy.org/)Processes Scrapy requests a man in the middle proxy service usinghttps://www.scraperapi.comRequiredpython version >= 3.6InstallCheckout the source and runpython setup.py installOrpip install scrapyx-scraperapi-proxysettings.py# Activate the middleware
SCRAPERAPI_ENABLED = True

# The API key 
SCRAPERAPI_KEY='your API key'

# JS Redering 
SCRAPERAPI_RENDER = False

# Premium account
SCRAPERAPI_PREMIUM = False

# Geographic Location
SCRAPERAPI_COUNTRY_CODE = '' # 'US', 'UK', ...

DOWNLOADER_MIDDLEWARES = {
    'scrapyx_scraperapi.ScraperApiProxyMiddleware': 610,
}
Package: scrapyx-scraperapi-v2
scrapyx-scraperapi-proxyScraper API middleware for Scrapy (http://scrapy.org/)Processes Scrapy requests a man in the middle proxy service usinghttps://www.scraperapi.comRequiredpython version >= 2.7InstallCheckout the source and runpython setup.py installOrpip install scrapyx-scraperapi-v2settings.py# Activate the middleware
SCRAPERAPI_ENABLED = True

# The API key 
SCRAPERAPI_KEY='your API key'

# JS Redering 
SCRAPERAPI_RENDER = False

# Premium account
SCRAPERAPI_PREMIUM = False

# Geographic Location
# 'US', 'UK', ...
SCRAPERAPI_COUNTRY_CODE = ''

DOWNLOADER_MIDDLEWARES = {
    'scrapyx_scraperapi_v2.ScraperApiV2ProxyMiddleware': 610,
}
Package: scrapyx-smartproxy
scrapyx-smartproxySmartProxy middleware for Scrapy (http://scrapy.org/)Requiredpython version >= 2.7InstallCheckout the source and runpython setup.py installOrpip install scrapyx-smartproxysettings.py# Activate the middleware
SMARTPROXY_ENABLED = True

# The SmartProxy URL
SMARTPROXY_URL = 'http://user:pass@gate.smartproxy.com:10000'

DOWNLOADER_MIDDLEWARES = {
    'scrapyx_smartproxy.SmartProxyMiddleware': 610,
}
Package: scrapyx-stormproxies
scrapyx-stormproxiesStormproxies middleware for Scrapy (http://scrapy.org/)Requiredpython version >= 2.7InstallCheckout the source and runpython setup.py installOrpip install scrapyx-stormproxiessettings.py# Activate the middleware
STORMPROXIES_ENABLED = True

# The Stormproxies URL
STORMPROXIES_URL = 'http://x.x.x.x:13080'

DOWNLOADER_MIDDLEWARES = {
    'scrapyx_stormproxies.StormProxyMiddleware': 610,
}
Package: scrapy-zenscrape
Scrapy Zenscrape MiddlewareAcknowledgementsThanks toarimbrandScrapingBee, this is adaptation of their work.Installationpip install scrapy-zenscrapeConfigurationAdd yourZENSCRAPE_API_KEYand theZenscrapeMiddlewareto your project settings.py. Don't forget to setCONCURRENT_REQUESTSaccording to yourZenscrape plan.ZENSCRAPE_API_KEY='REPLACE-WITH-YOUR-API-KEY'DOWNLOADER_MIDDLEWARES={'scrapy_zenscrape.ZenscrapeMiddleware':700,}CONCURRENT_REQUESTS=1UsageInherit your spiders fromZenscrapeSpiderand yield aZenscrapeRequest.Below you can see an example from the spider inhttpbin.py.fromscrapyimportSpiderfromscrapy_zenscrapeimportZenscrapeSpider,ZenscrapeRequestclassHttpbinSpider(Spider):name='httpbin'start_urls=['https://httpbin.org',]defstart_requests(self):forurlinself.start_urls:yieldZenscrapeRequest(url,params={# 'render': False,# 'block_ads': True,# 'block_resources': False,# 'premium': True,# 'location': 'fr',# 'wait_for': 5,# 'wait_for_css': '#swagger-ui',},headers={# 'Accept-Language': 'En-US',},cookies={# 'name_1': 'value_1',})defparse(self,response):...You can passZenscrape parametersin the params argument of a ZenscrapeRequest. Headers and cookies are passed like a normal Scrapy Request. ZenscrapeRequests formats all parameters, headers and cookies to the format expected by the API.ExamplesAdd your API key tosettings.py.To run the examples you need to clone this repository. In your terminal, go toexamples/httpbin/httpbinand run the example spider with:scrapycrawlhttpbin
Package: scrapy-zyte-smartproxy
scrapy-zyte-smartproxy provides easy use ofZyte Smart Proxy Manager(formerly Crawlera) with Scrapy.RequirementsPython 2.7 or Python 3.4+Scrapy 1.4+InstallationYou can install scrapy-zyte-smartproxy using pip:pip install scrapy-zyte-smartproxyDocumentationDocumentation is available online athttps://scrapy-zyte-smartproxy.readthedocs.io/and in thedocsdirectory.
Package: scrat
ScratPersistent Caching of Expensive Function ResultsGet StartedInstall withpip install scratInitialize stashscrat initStart saving time:importscratimporttime@scrat.stash()defexpensive_function(param_1):time.sleep(3)returnparam_1expensive_function(1)# <- function calledexpensive_function(1)# <- function not called the result is recovered from stashexpensive_function(2)# <- function called again beacuse the parameters changedFeaturesSeamlessly stores the results of expensive functions to disk for future reuse.Automatically re-evaluates the function if the parameters or function code have changed, ensuring up-to-date results.Saves any result using the pickle.Improved storage of pandas DataFrames, Series, and Numpy arrays.Customizable support for alternative serializers.Flexible parameter hashing mechanism to efficiently handle any parameter type.Command-line interface (CLI) for convenient control and management of the caching functionality.Similar Projectslru_cacheGreat and fast memoize provided by the standard libraryfunctools, unfurtunately results are stored in memory so they can't be reused in different runs.cachetoolsProvides alternatives tolru_cachebut it also works in-memory.JoblibJoblib is a stablished library that provides great functionality for parallelization and caching. The Memory module provides an excelent alternative to Scrat, but it does have some limitations:Hard to avoid using pickleLack of options to control the cache size and policiesLack of tools to inspect and cleanup the cacheThese are the problems that scrat aims to improve, however, I'd recommend using Joblib in production since it's much more mature than Scrat at the moment.ConceptsScratis a famous pre-historic squirrel with some bad luckStashis composed of a folder where results are saved and a database to index themANutis one of the entries in the databaseTheSquirrelis in charge of fetching and stashing theNutsSerializerdumps results to files and load them back to memoryHashercreates unique hashes for a parameter valueHashManagercoordinates hashes of all arguments and functon codeDevelopment SetupClone this repoInstallpyenv.Install the python version used for development runningpyenv installin the root of this repository.Installpoetry. Version1.5.1is recommended.Run this command to make sure poetry uses the right python versionpoetry env use $(which python)Install project and dependencies withpoetry installRun tests withpoetry run pytestor activate the virtualenv withpoetry shelland then runpytest
Package: scratch
This package enables communication between Python and Scratch 1.3+ (not 2.x)
using the remote sensors feature of Scratch.Remember to enable remote sensors in Scratch!  To do this:Go to SensingRight-click on a ‘sensor value’Select ‘enable remote sensor connections’Example usage:import scratch
s = scratch.Scratch()

# to make a broadcast to scratch
s.broadcast("from python")

# to receive an update from scratch
message = s.receive()
# blocks until an update is received
# message returned as  {'broadcast': [], 'sensor-update': {'scratchvar': '64'}}
#                  or  {'broadcast': ['from scratch'], 'sensor-update': {}}
# where scratchvar is the name of a variable in scratch
# and 'from scratch' is the name of a scratch broadcast

# send sensor updates to scratch
data = {}
data['pyvar'] = 123
for data['pycounter'] in range(60):
    s.sensorupdate(data)0.0.1aInitial version1.0.0First release - module unchanged from 0.0.1a
Package: scratch-3-file-analyser
scratch_3_file_analyser用于分析Scratch3文件。灵感来源于https://aerfaying.com/Projects/512945同时借鉴了它analyze函数需要传入一个参数，是json文件，但要转换成字符串。可以将sb3文件转换成analyze参数输入的字符串的函数式unzip。详见该命令：importscratch_3_file_analyser;print(scratch_3_file_analyser.analyze(scratch_3_file_analyser.unzip('./DEMO.sb3')))你可以试着运行DEMO.py
Package: scratchai-nightly
scratchaiBuildsDocumentationTable of Contents:ClassificationModelPaperImplementationConfigurationsLenethttp://yann.lecun.com/exdb/publis/pdf/lecun-01a.pdfImplementationAlexnethttps://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdfImplementationVGGhttps://arxiv.org/pdf/1409.1556.pdfImplementationVGG11, VGG11_BN, VGG13, VGG13_BN, VGG16_BN, VGG19, VGG19_BN, VGG_Dilated (For all the normal configurations)Resnethttps://arxiv.org/abs/1512.03385ImplementationResnet18, Resnet34, Resnet50, Resnet101, Resnet150, Resnet_dilated (For all the previous resnets)GoogLeNethttps://www.cs.unc.edu/~wliu/papers/GoogLeNet.pdfImplementationResnexthttps://arxiv.org/abs/1611.05431NASegmentationModelPaperImplementationUNethttps://arxiv.org/abs/1505.04597Implementation[Not checked]ENethttps://arxiv.org/abs/1606.02147Implementation[Not checked]Generative Adversarial NetworksModelPaperImplementationDCGANhttps://arxiv.org/abs/1511.06434NACycleGANhttps://arxiv.org/abs/1703.10593Implementation[Not checked]Style TransferModelPaperImplementationImage Transformation Network Justin et al.Perceptual Losses PaperSupplementary MaterialImplementationAttacksAttacksPaperImplementationNoiseNAImplementationSemantichttps://arxiv.org/abs/1703.06857ImplementationSaliency Map Methodhttps://arxiv.org/pdf/1511.07528.pdfOngoingFast Gradient Methodhttps://arxiv.org/abs/1412.6572ImplementationProjected Gradient Descenthttps://arxiv.org/pdf/1607.02533.pdfhttps://arxiv.org/pdf/1706.06083.pdfImplementationDeepFoolhttps://arxiv.org/abs/1511.04599pdfImplementationTutorialsTutorials on how to get the most out of scratchai can be found here:https://github.com/iArunava/scratchai/tree/master/tutorialsThese are ongoing list of tutorials and scratchai is looking for more and more contributions. If you are willing to contribute
please take a look at theCONTRIBUTING.md/ open a issue.LicenseThe code under this repository is distributed under MIT License. Feel free to use it in your own work with proper citations to this repository.
Package: scratchapi
ScratchAPIScratch API InterfaceScratchAPI is a scratch API interface written in Python.To get started, install it with pip install scratchapiLogging inTo use the api, you must log in to your scratch account:import scratchapi
scratch = scratchapi.ScratchUserSession(‘Username’, ‘password’)Now, you can verify your session to see if you logged in correctly:scratch.tools.verify_session()There are a lot of things you can you when you’re logged in!Take ownership of a new project:scratch.lib.utils.request(path=’/internalapi/project/new/set/?v=v442&title=Project’, server=scratch.PROJECTS_SERVER, method=’POST’, payload={})Follow Someone:scratch.users.follow(‘Bob’)Set a cloud variable:s.cloud.set_var(‘Variable’, 12345, 4453648)Credits
The cloud data interface information was acquired from various topics on the Scratch Forums.TheLogFather helped out with various wrappers and conveniences for cloud data.