Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

CrawlerCodePythonTools - Documentation

Tools for python by CrawlerCode.

Installation

pip install CrawlerCodePythonTools

Config

from pythontools.core import config

cfg = config.Config(path="", default_config={"config_data_1": "value_123"})
cfgData = cfg.getConfig()

# get config value
print(cfgData["config_data_1"])

# chang value and save config
cfgData["config_data_1"] = "value_456"
cfg.saveConfig()

Logger

from pythontools.core import logger

# path to logs directory (optional)
logger.initLogDirectory("logs")

# set time format (optional)
logger.setTimeFormat(date=True, time=True)

# print color test
logger.log("§1Blue §9Light-Blue §3Cyan §bLight-Cyan §4Red §cLight-Red §6Yellow §eLight-Yellow §2Green §aLight-Green §5Magenta §dLight-Magenta §fWhite §7Light-Gray §8Gray §0Black")

Server and Client (sockets)

Server

from pythontools.sockets import server
from threading import Thread

SERVER = server.Server(password="PASSWORD")

def ON_CLIENT_CONNECT(client):
    # send a message to client on connect by clientSocket
    SERVER.sendTo(client["clientSocket"], {"METHOD": "HELLO"})

def ON_CLIENT_DISCONNECT(client):
    pass

def ON_RECEIVE(client, data):
    METHOD = data["METHOD"]

SERVER.ON_CLIENT_CONNECT(ON_CLIENT_CONNECT)
SERVER.ON_CLIENT_DISCONNECT(ON_CLIENT_DISCONNECT)
SERVER.ON_RECEIVE(ON_RECEIVE)

Thread(target=SERVER.start, args=["HOST-IP", 15749]).start()

# send a message to client by clientID
SERVER.sendToClient("MY_CLIENT_ID", {"METHOD": "TEST", "mydata": "123"})

Client

from pythontools.sockets import client
from threading import Thread

CLIENT = client.Client(password="PASSWORD", clientID="MY_CLIENT_ID", clientType="CLIENT")

def ON_CONNECT():
    pass

def ON_RECEIVE(data):
    METHOD = data["METHOD"]
    # recipe the test message
    if METHOD == "TEST":
        print("test:", data["mydata"])

CLIENT.ON_CONNECT(ON_CONNECT)
CLIENT.ON_RECEIVE(ON_RECEIVE)

Thread(target=CLIENT.connect, args=["HOST-IP", 15749]).start()

WebBot

Download chromedriver or geckodriver
from pythontools.webbot import webbot

# Google Chrome
browser = webbot.WebBot().Chrome(chromedriver="chromedriver.exe")
# Firefox
browser = webbot.WebBot().Firefox(geckodriver="geckodriver.exe")
browser.get("https://www.google.com/")

browser.input('//*[@id="tsf"]/div[2]/div[1]/div[1]/div/div[2]/input', "what is python?")
browser.click('//*[@id="tsf"]/div[2]/div[1]/div[2]/div[2]/div[2]/center/input[1]')

time.sleep(10)

browser.close()

Metadata

Release files for CrawlerCodePythonTools-Gui 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for CrawlerCodePythonTools-Gui 1.4.0
File Size Uploaded Provenance Actions
CrawlerCodePythonTools-Gui-1.4.0.tar.gz 6.7 kB Without provenance Details for CrawlerCodePythonTools-Gui-1.4.0.tar.gz

Release files / CrawlerCodePythonTools-Gui-1.4.0.tar.gz

Download URL CrawlerCodePythonTools-Gui-1.4.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a609703a7508cebba55df1f1b89bceb6572a6ee7c3470d6e628a58505b4572b3
BLAKE2b-256 checksum
How to use checksums
6f4249357bccbf756e01e004118ee0877fb8d571cd3d4b9089973711a661105a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.7rc1

Security for CrawlerCodePythonTools-Gui 1.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page