<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Josue Gamboli Kazadi on Medium]]></title>
        <description><![CDATA[Stories by Josue Gamboli Kazadi on Medium]]></description>
        <link>https://medium.com/@forlankazadi123?source=rss-cfe9e624d188------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*m6fQQQESGncpwfn3a4-aAg.jpeg</url>
            <title>Stories by Josue Gamboli Kazadi on Medium</title>
            <link>https://medium.com/@forlankazadi123?source=rss-cfe9e624d188------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 11:46:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@forlankazadi123/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Practical Guide: Automating the Collection and Sending of Job Offers in CSV Format via Email using…]]></title>
            <link>https://medium.com/@forlankazadi123/practical-guide-automating-the-collection-and-sending-of-job-offers-in-csv-format-via-email-using-e0e1d933e6b0?source=rss-cfe9e624d188------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0e1d933e6b0</guid>
            <dc:creator><![CDATA[Josue Gamboli Kazadi]]></dc:creator>
            <pubDate>Sat, 11 Jan 2025 19:05:57 GMT</pubDate>
            <atom:updated>2025-01-11T19:32:04.962Z</atom:updated>
            <content:encoded><![CDATA[<h3>Practical Guide: Automating the Collection and Sending of Job Offers in CSV Format via Email using Python and BeautifulSoup (use case: www.emploi.cd)</h3><p><strong>Introduction</strong></p><p>In this tutorial, we will learn how to send emails using Python on Ubuntu. We will use the smtplib library to handle the email sending process and BeautifulSoup for web scraping. This tutorial will guide you through the steps to configure your email settings, scrape job data from a website, and send the data via email.</p><p><strong>Prerequisites</strong></p><ul><li>Basic knowledge of Python</li><li>Ubuntu installed on your computer</li><li>Internet connection</li></ul><p><strong>Step 1: Install Python and Required Libraries</strong></p><p>First, we need to install Python and the required libraries. Open your terminal and run the following commands:</p><pre>sudo apt update <br>sudo apt install python3 python3-pip python3-venv</pre><p><strong>Step 2: Create and Activate a Virtual Environment</strong></p><p>Next, we will create and activate a virtual environment to manage our project dependencies.</p><pre>python3 -m venv myenv <br>source myenv/bin/activate</pre><p><strong>Step 3: Install Required Python Libraries</strong></p><p>With the virtual environment activated, install the required libraries.</p><pre>pip install requests beautifulsoup4</pre><p><strong>Step 4: Configure Email Settings</strong></p><p>Now, we need to configure the email settings. Replace the placeholder values with your actual email credentials.</p><pre>sender_email = &quot;your_email@gmail.com&quot; <br>receiver_email = &quot;recipient_email@gmail.com&quot; <br>smtp_server = &quot;smtp.gmail.com&quot; <br>smtp_port = 587 <br>login = &quot;your_email@gmail.com&quot; <br>password = &quot;your_password</pre><p><strong>Step 5: Define the Function to Scrape Job Data</strong></p><p>We will define a function to scrape job data from a website. This function will send a GET request to the target URL and parse the HTML content to extract job information.</p><pre>import requests <br>from bs4 import BeautifulSoup<br><br>URL = &quot;https://www.emploi.cd/recherche-jobs-congo-rdc?f%5B0%5D=im_field_offre_metiers%3A31&quot;<br><br>def scrape_jobs(): <br>    job_list = [] <br>    response = requests.get(URL) <br>    if response.status_code != 200: <br>        print(f&quot;Error {response.status_code} accessing the site.&quot;) <br>        return job_list <br> <br>    soup = BeautifulSoup(response.text, &#39;html.parser&#39;) <br>    jobs = soup.find_all(&#39;div&#39;, class_=&#39;card-job-detail&#39;) <br>    for job in jobs: <br>        h3 = soup.find(&#39;h3&#39;)<br>        if h3: <br>           title_element = job.find(&#39;a&#39;) <br>           if title_element: <br>              title = title_element.text.strip() <br>              link = title_element[&#39;href&#39;] <br>              full_link = f&quot;https://www.emploi.cd{link}&quot; <br>              job_list.append({&quot;Title&quot;: title, &quot;Link&quot;: full_link}) <br>    return job_list</pre><p><strong>Step 6: Send Email with CSV Attachment</strong></p><p>We will define a function to send an email with the scraped job data as a CSV attachment.</p><pre>import smtplib <br>from email.mime.text import MIMEText <br>from email.mime.multipart import MIMEMultipart <br>from email.mime.base import MIMEBase <br>from email import encoders <br>import csv <br>import os <br>from datetime import datetime <br> <br>def send_email_with_csv(filename, sender_email, receiver_email, smtp_server, smtp_port, login, password): <br>    msg = MIMEMultipart() <br>    msg[&#39;From&#39;] = sender_email <br>    msg[&#39;To&#39;] = receiver_email <br>    msg[&#39;Subject&#39;] = &quot;Job Offers&quot; <br> <br>    body = &quot;Please find the attached CSV file with the latest job offers.&quot; <br>    msg.attach(MIMEText(body, &#39;plain&#39;)) <br> <br>    attachment = open(filename, &quot;rb&quot;) <br>    part = MIMEBase(&#39;application&#39;, &#39;octet-stream&#39;) <br>    part.set_payload(attachment.read()) <br>    encoders.encode_base64(part) <br>    part.add_header(&#39;Content-Disposition&#39;, f&quot;attachment; filename= {filename}&quot;) <br>    msg.attach(part) <br> <br>    server = smtplib.SMTP(smtp_server, smtp_port) <br>    server.starttls() <br>    server.login(login, password) <br>    text = msg.as_string() <br>    server.sendmail(sender_email, receiver_email, text) <br>    server.quit()</pre><p><strong>Step 7: Main Function</strong></p><p>Finally, we will define the main function to scrape the job data and send it via email.</p><pre>if __name__ == &quot;__main__&quot;: <br>    print(&quot;Scraping job offers...&quot;) <br>    jobs = scrape_jobs() <br>    if jobs: <br>        timestamp = datetime.now().strftime(&quot;%Y-%m-%d_%H-%M-%S&quot;) <br>        filename = f&quot;jobs_{timestamp}.csv&quot; <br>        with open(filename, &#39;w&#39;, newline=&#39;&#39;) as csvfile: <br>            fieldnames = [&#39;Title&#39;, &#39;Link&#39;] <br>            writer = csv.DictWriter(csvfile, fieldnames=fieldnames) <br>            writer.writeheader() <br>            for job in jobs: <br>                writer.writerow(job) <br>        send_email_with_csv(filename, sender_email, receiver_email, smtp_server, smtp_port, login, password) <br>    else: <br>        print(&quot;No job offers found.&quot;)</pre><p>You’ll view a result like this,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RpFTFAp5Gbq6h_c26GoPUQ.jpeg" /></figure><p><strong>Conclusion</strong></p><p>In conclusion, this tutorial has provided a comprehensive guide on how to automate the collection, scraping, and sending of job offers in CSV format via email using Python and BeautifulSoup on Ubuntu. By following the steps outlined, you can efficiently gather job data from a website, save it in a CSV file, and send it to your email. This automation not only saves time but also ensures that you stay updated with the latest job offers without manual intervention</p><p>Thank you for following this tutorial. We hope it has been helpful and informative. If you have any questions or need further assistance, please feel free to reach out. Happy coding!</p><p><a href="https://medium.com/u/9047f985461a">Mbula Mboma Jean Gilbert</a>, Thank you, Coach, for your unwavering guidance and encouragement. Your mentorship has empowered me to navigate the complexities of technology with confidence and passion. You’ve inspired me to push boundaries, embrace challenges, and keep learning every step of the way. I am deeply grateful for your belief in my potential.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0e1d933e6b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>