BotWeb
BotWeb é uma ferramenta poderosa para automação de operações web, combinando as bibliotecas Selenium e Requests. Este projeto foi projetado para simplificar tarefas como scraping de dados, interações em sites e testes automatizados.
Funcionalidades
- Automatização com Selenium: Controle completo de navegadores para interagir com elementos de páginas web.
- Requisições HTTP com Requests: Realize requisições GET, POST e outras operações HTTP.
- Integração entre Selenium e Requests: Flexibilidade para usar o melhor das duas bibliotecas em suas operações web.
Requisitos
- Python 3.10 ou superior.
- Navegador compatível com o Selenium (ex.: Chrome, Firefox, Edge).
Instalação
Passo 1: Instalar o Pacote
Para instalar o pacote, execute:
pip install botweb
Exemplo de Uso
from botweb import BotWeb
class MyBot(BotWeb):
def __init__(self, *args, **kwargs):
super().__init__(
# The prefix name to be concatenated with the credentials_keys
# eg. WEB_SYSTEM_USERNAME, WEB_SYSTEM_PASSWORD
# these variables will be setted as environment variables
# with the values asked from the terminal.
# To prevent of every run ask the credentials from the terminal
# restart the IDE after provide the credentials values
prefix_env="WEB_SYSTEM",
credentials_keys=["USERNAME", "PASSWORD"]
)
def login(self):
"""My login logic here! (Abstract method needs to be implemented)"""
# self._enter_username(self.credentials['USERNAME'])
# self._enter_password(self.credentials['PASSWORD'])
# self._submit()
# This method sets the cookies into the self.session: requests.Session
# It enable making requests inside the system
# see the post_example() method bellow
self.get_cookies()
def post_example(self):
# The headers inspected from the network request
headers = {
"accept": "application/json, text/plain, */*",
"accept-language": "pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7",
"authorization": "",
"content-type": "application/json;charset=UTF-8",
}
# If the system store the token in the local storage it would work,
# else override it with your own logic to get the token authorization
headers.update({
"authorization": self.get_token_authorization_from_storage()
})
# The payload inspected from the network request
body = 'a=something&b=anotherthing'
response = self.session.post(
"https://example.com.br",
headers=headers,
data=body,
)
if response.status_code == 200:
print(response.json())
if __name__ == '__main__':
with MyBot() as mybot:
mybot.init_browser(headless=False, browser="firefox")
mybot.open(
"https://github.com/login"
)
mybot.login()
# mybot.post_example()
input("Digite algo para continuar...")
Contribuições
Contribuições são bem-vindas! Para contribuir:
- Fork este repositório.
- Crie um branch para sua funcionalidade ou correção:
git checkout -b minha-funcionalidade
- Envie suas alterações:
git commit -m "Adiciona nova funcionalidade"
- Submeta um pull request.
Licença
Este projeto está licenciado sob a Licença MIT.
Contato
Para mais informações ou suporte, visite o repositório no GitHub.
Metadata
Release files for botweb 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| botweb-0.2.6.tar.gz | 11.8 kB | Without provenance | Details |
Release files / botweb-0.2.6.tar.gz
| Download URL | botweb-0.2.6.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f40bbb10a7f83efcb9ee21de7932c45108cae602e95052f0d54373850610a3c
|
|
BLAKE2b-256 checksum How to use checksums |
8c0866e8f3832a1756c8fce440f28b9fc7d2b9279d36221501bfe51cca6707cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Security for botweb 0.2.6
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.