HG-map
GIS, dev & data

Menu

  • Blog
  • Tutos
  • Astuces
  • À propos de moi
  • Réalisations
  • Contact
Angular Indicateur DNS MySQL WFS Sécurité CSV Symfony Excel Notepad GeoDjango Open Street Map SHOM KML Selenium Debian Regex Acymailing IRIS API
  • Identifiant oublié ?
  • Mot de passe oublié ?

Auto submit a form with Python, Selenium and Chromium

Détails
22 mai 2022
3973
  • Database
  • Access
  • XML
  • Python
  • Digital marketing
  • Excel
  • Selenium
  • Chromium

SeleniumHere a simple Selenium example where we go to fill then submit a form from data previously converted in XML.

I choose XML because this flat format is easy to grab with Python, and it can be created from an Excel file with Access for example. Morever, if the auto-submit crashs during the execution (it is possible even with a good code, depending on the website providing the form), Chromium will stop on the last record and you could remove the begining of the XML before to re-execute the same code (to avoid duplicates).

For those in a hurry (🧐) my code is here on GitHub. But for a full understanding just see below.

Auto submit a form with Python, Selenium and Chromium

Web scraping with Python and BeautifulSoup

Détails
25 avril 2021
2612
  • Data mining
  • Python
  • Web scraping
  • Digital marketing
  • BeautifulSoup

Beautiful SoupLet's go web scraping with Python and BeautifulSoup! Here BeautifulSoup will be able to extract formatted data from HTML and its CCS code. For confidentiality reasons, we will not name the parsed website, but a lot are built like that: pages containing record from a database use their ID in the URL. So you will to adapt the codes below to your own website and purposes.

We will use a complex website as example, where the IDs to guess are listed in a large pagination.

First, we will get the links to articles (with IDs in URLs) from all pages of the pagination, then we will store data in a CSV file, if interesting (we search emails). So we will do a loop in a loop, with a condition, but if the website you want to parse is simpler (without pagination), you will not need the first loop.

Libraries and receptacle

We start by importing some necessary libraries and creating the receptacle file for our data.

from bs4 import BeautifulSoup
import requests
import re
import csv
 
# CSV file to receive data
out_file = open('C:/python_projects/webscraping/email.csv', 'w', encoding='cp1252')
out_file.write("email" + "\n")

Web scraping with Python and BeautifulSoup

Acymailing, mass sending et bonnes pratiques

Détails
4 avril 2021
52671
  • Database
  • Joomla
  • Emailing
  • Acymailing
  • Elasticemail
  • SMTP
  • Mass sending
  • Newsletter
  • DNS
  • SPF
  • DKIM
  • Digital marketing

Acymailing est une extension Joomla permettant de mettre en place des outils newsletter du plus simple au plus puissant (filtres, vitesses d'envoi, tracking, stats, relai SMTP...). Ce système open-source existe en version gratuite (déjà très performante) ou payante (très abordable). L'extension peut bien sûr être overridée.

Cependant son développement régulier rend l'utilisation des overrides plus lourd que la modification directe du code source. En effet dans certains contextes (multi-utilisateurs, multi-bases, flotte d'outils...), les overrides risquent d'être complexes à maintenir dans le temps.

C'est en tout cas mon impression en utilisation intensive d'Acy. Certaines MAJ peuvent toucher les fichiers originaux et ne pas être prises en compte dans vos overrides... Mieux vaut donc connaître un minimum le code de l'extension et avoir quelques repères.

Ici quelques notes personnelles me permettant de maintenir facilement mes outils. Rappellons l'ancien forum encore en ligne d'où proviennent certaines de ces astuces (le support a évolué vers un système plus personnalisé).

emc1

Cet article est principalement destiné aux joomlistes avancés souhaitant personnaliser ou optimiser leurs applications newsletter.

Le paragraphe Quelques liens s'adresse généralement à tous webworkers digitaux (marketeurs, intégrateurs, graphistes...).

Le paragraphe Relai SMTP évoque  le relai Elastic Email en contexte de mass sending.

Et non, je ne travaille pas pour eux.

Acymailing, mass sending et bonnes pratiques

Cryptage d'emails en MD5 - exemples d'utilisation en marketing digital

Détails
4 avril 2021
4795
  • Emailing
  • Big data
  • Mass sending
  • Digital marketing

Le cryptage MD5 est une forme de hachage relativement ancienne mais toujours bien pratique. On peut l'utiliser pour comparer des bases d'emails avec celles d'un prestataire sans fournir les données brutes par exemple. En vue d'un partenariat, d'un échange...

Attention nous ne parlons pas ici de réelle sécurisation. Le MD5 SQL - même salé ou doublé - est sujet à caution. Il ne s'agit que de permettre la transmission de données avec une relative tranquilité quant à un usage non-souhaité de ses fichiers. Parfois le partenaire qui vous transmettra ses données cryptées vous fera également signer un engagement de non-divulgation ou de non-utilisation frauduleuse (non-disclosure). Et si c'est vous qui transmettez les données (j'avoue ne jamais le faire...), pensez-y !

Quoiqu'il en soit il est courant de demander cela à un prestataire fournisseur (l'inverse est moins acceptable). Certes PhpMyAdmin permet nativement de saisir du texte puis de l'encrypter en MD5 (Insérer/Fonction/MD5). Mais pour mettre en place un worflow ou comparer des bases en lot, il est nécessaire de maîtriser la chose en SQL.

Quelques requêtes SQL d'exemple :

Voir le cryptage MD5 d'une chaîne

SELECT MD5(Cette adresse e-mail est protégée contre les robots spammeurs. Vous devez activer le JavaScript pour la visualiser.') ;

Cryptage d'emails en MD5 - exemples d'utilisation en marketing digital

SQL Automatic deduplication

Détails
17 janvier 2021
2151
  • Database
  • SQL

All living databases has its duplicates. Depending on their nature or number, it may be interesting to dedupe them quickly. For this goal SQL is our friend.

Below a simple example in order to describe the main concepts of the method. Then you will be able to do this in more complex situations. Because the final formula is a bit long, we will proceed iteratively, to understand the different steps.

SQL Automatic deduplication

Automate the opening of your favorite apps

Détails
16 janvier 2021
1293
  • Python

python picture

Maybe each morning you have to open some softwares, websites or any apps before to start working.

For me: my professional email box (Outlook), my personnal email box (Gmail), my testing email boxes (Thunderbird, Yahoo ...), Teams, the official CRM of my company, the unofficial CRM of my company, the marketing tools of my company, my Google shortcuts ... Hum, tired in the morning!

Thanks to Python and his libraries os and webbrowser, we can save time and neurons. Just add the code below in a Python script:

import os
import webbrowser
 
os.startfile("outlook")
os.startfile("thunderbird")
 
webbrowser.open('https://hg-map.fr/')
 
os.startfile(r"C:\Users\Georges\Desktop\Communications\Gmail.lnk")
os.startfile(r"C:\Users\Georges\Desktop\Communications\Microsoft Teams.lnk")
os.startfile(r"C:\Users\Georges\Desktop\Communications\Yahoo.lnk")

Clicking into will open your favourite applications. Me I prefere store my scripts in a dedicated folder, and then add shortcuts on my desktop.

Maybe you should adapt the code according your OS and your apps subtilities. Here above for example, Outlook and Thunderbird are recognized by Python, and just need to mention their system names to the os library. A website need the webbrowser library, and the Google shortcuts need the os library but from their full paths.

 

  1. BatAdmin, CRM with Django
  2. Symfony 4
  3. Extraction de données géographiques et qualification
  4. Astuces PHP sur le CCK Fabrik

Page 2 sur 6

  • 1
  • 2
  • 3
  • 4
  • ...
  • 6

Haut de page

© 2023 HG-Map