<?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 Mehmet Karahan Çetinkaya on Medium]]></title>
        <description><![CDATA[Stories by Mehmet Karahan Çetinkaya on Medium]]></description>
        <link>https://medium.com/@mehmetkarahanc?source=rss-874bc92c9ce8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*gQjAaGWdcdx4h6cF</url>
            <title>Stories by Mehmet Karahan Çetinkaya on Medium</title>
            <link>https://medium.com/@mehmetkarahanc?source=rss-874bc92c9ce8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 07:36:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mehmetkarahanc/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[EPİAŞ’tan Veri Çekme]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@mehmetkarahanc/epi%CC%87a%C5%9Ftan-veri-%C3%A7ekme-35b05b07ac1b?source=rss-874bc92c9ce8------2"><img src="https://cdn-images-1.medium.com/max/1535/1*c5yONzT4SIjNVHdNkg4V8g.png" width="1535"></a></p><p class="medium-feed-snippet">EP&#x130;A&#x15E; Nedir?</p><p class="medium-feed-link"><a href="https://medium.com/@mehmetkarahanc/epi%CC%87a%C5%9Ftan-veri-%C3%A7ekme-35b05b07ac1b?source=rss-874bc92c9ce8------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@mehmetkarahanc/epi%CC%87a%C5%9Ftan-veri-%C3%A7ekme-35b05b07ac1b?source=rss-874bc92c9ce8------2</link>
            <guid isPermaLink="false">https://medium.com/p/35b05b07ac1b</guid>
            <category><![CDATA[electricity-market]]></category>
            <category><![CDATA[turkey]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[electricity]]></category>
            <dc:creator><![CDATA[Mehmet Karahan Çetinkaya]]></dc:creator>
            <pubDate>Tue, 11 Nov 2025 13:50:19 GMT</pubDate>
            <atom:updated>2025-11-11T13:50:19.316Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[How to Build a Free, Scalable Driving Distance Matrix Generator with Python and OSRM]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@mehmetkarahanc/how-to-build-a-free-scalable-driving-distance-matrix-generator-with-python-and-osrm-99a4d52442fc?source=rss-874bc92c9ce8------2"><img src="https://cdn-images-1.medium.com/max/1536/1*jJwuNdczze8Wc-i-65WGQQ.png" width="1536"></a></p><p class="medium-feed-snippet">Creating a driving distance matrix is a messy job, and it even gets messier when the number of nodes gets bigger.</p><p class="medium-feed-link"><a href="https://medium.com/@mehmetkarahanc/how-to-build-a-free-scalable-driving-distance-matrix-generator-with-python-and-osrm-99a4d52442fc?source=rss-874bc92c9ce8------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@mehmetkarahanc/how-to-build-a-free-scalable-driving-distance-matrix-generator-with-python-and-osrm-99a4d52442fc?source=rss-874bc92c9ce8------2</link>
            <guid isPermaLink="false">https://medium.com/p/99a4d52442fc</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[logistics]]></category>
            <category><![CDATA[distance-matrix]]></category>
            <category><![CDATA[osrm]]></category>
            <dc:creator><![CDATA[Mehmet Karahan Çetinkaya]]></dc:creator>
            <pubDate>Tue, 16 Sep 2025 06:59:40 GMT</pubDate>
            <atom:updated>2025-09-16T07:29:05.899Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Automating Data Extraction with Playwright and Python]]></title>
            <link>https://medium.com/@mehmetkarahanc/automating-data-extraction-with-playwright-and-python-db3dfbdd2fe0?source=rss-874bc92c9ce8------2</link>
            <guid isPermaLink="false">https://medium.com/p/db3dfbdd2fe0</guid>
            <category><![CDATA[web-scraping-automation]]></category>
            <category><![CDATA[workflow-automation]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-analytics]]></category>
            <dc:creator><![CDATA[Mehmet Karahan Çetinkaya]]></dc:creator>
            <pubDate>Thu, 20 Mar 2025 05:08:59 GMT</pubDate>
            <atom:updated>2025-03-21T10:06:44.025Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NYK5ftjUii7NhRmw" /></figure><h3>Introduction</h3><p>In the fast-paced world of data analytics and automation, efficiency is key. Manually retrieving data from websites is not only time-consuming but also prone to errors. This is where automation tools like Playwright come in handy. In this article, I will walk you through my latest project: an automated data extraction tool using Playwright, Python, and API integration.</p><h3>Why Playwright?</h3><p>Playwright is a powerful browser automation library that allows you to interact with web pages as if you were manually navigating them. Unlike Selenium, it supports modern web applications seamlessly, providing a more reliable way to interact with dynamic elements on a webpage.</p><h3>Project Overview</h3><p>The goal of this project is to automate the process of logging into a website, applying filters, extracting cookies and headers, and making an API request to retrieve structured data. Finally, the data is processed and saved into an Excel file.</p><h3>Tech Stack</h3><ul><li><strong>Python</strong>: The backbone of the projects</li><li><strong>Playwright</strong>: For browser automation</li><li><strong>Requests</strong>: For handling API calls</li><li><strong>Pandas</strong>: For data processing and exporting</li><li><strong>Dotenv</strong>: For securely handling credentials</li><li><strong>Excel (OpenPyXL)</strong>: For data storage</li></ul><h3>Step-by-Step Implementation</h3><h3>1. Setting Up Environment Variables</h3><p>Security is crucial when dealing with authentication. Instead of hardcoding credentials, I used dotenv to load them from an environment file:</p><pre>from dotenv import load_dotenv<br>import os<br><br>load_dotenv()<br>username = os.getenv(&quot;MY_APP_USERNAME&quot;)<br>password = os.getenv(&quot;MY_APP_PASSWORD&quot;)</pre><p>This keeps sensitive information out of the codebase.</p><h3>2. Automating Login with Playwright</h3><p>Playwright makes it easy to automate login flows. The script launches a Chromium browser, navigates to the login page, fills in credentials, and submits the form:</p><pre>from playwright.sync_api import sync_playwright<br><br>def login_to_website():<br>    with sync_playwright() as p:<br>        browser = p.chromium.launch(headless=False, slow_mo=50)<br>        page = browser.new_page()<br>        page.goto(&quot;WebsiteUrl&quot;)<br>        page.fill(&quot;input#__xmlview0--USR_NAME-inner&quot;, username)<br>        page.fill(&quot;input#__xmlview0--USR_PASS-inner&quot;, password)<br>        page.click(&quot;button[id=__xmlview0--BTN_LGN1]&quot;)</pre><h3>3. Applying Filters and Extracting Data</h3><p>After logging in, the script selects the necessary filters and executes the query:</p><pre>page.fill(&quot;input#__xmlview3--DAT_FRM-inner&quot;, &quot;01/01/2025&quot;)<br>page.fill(&quot;input#__xmlview3--DAT_TO-inner&quot;, datetime.datetime.now().strftime(&quot;%d/%m/%Y&quot;))<br>page.click(&quot;button[id=__xmlview3--BTN_RUN]&quot;)</pre><p>Before closing the browser, we extract the session cookies and request headers for API authentication:</p><pre>cookies = page.context.cookies()<br>session_cookies = {cookie[&quot;name&quot;]: cookie[&quot;value&quot;] for cookie in cookies}<br><br>headers = {<br>    &quot;User-Agent&quot;: page.evaluate(&quot;navigator.userAgent&quot;),<br>    &quot;Accept&quot;: &quot;*/*&quot;,<br>    &quot;X-Requested-With&quot;: &quot;XMLHttpRequest&quot;<br>}</pre><h3>4. Making an API Request</h3><p>Once authenticated, we fetch data via an API call:</p><pre>import requests<br><br> data = {<br>        &quot;bsa[]&quot;: [&quot;341-FU&quot;, &quot;341-LP&quot;, &quot;551-LP&quot;, &quot;351-FU&quot;],  # Business Area IDs<br>        &quot;vty[]&quot;: [&quot;51&quot;, &quot;50&quot;, &quot;4052&quot;, &quot;4127&quot;],  # Violation Types<br>        &quot;fdt&quot;: &quot;2025-01-01T00:00:00.00&quot;,  # From Date<br>        &quot;tdt&quot;: datetime.datetime.now().strftime(&quot;%Y-%m-%dT%H:%M:%S.%f&quot;)  # To Date<br>    }<br><br>    <br>    api_url = &quot;API URL&quot;<br>    response = requests.post(api_url, headers=headers, cookies=session_cookies, data=data)</pre><h3>5. Processing and Storing Data</h3><p>If the response is successful, we normalize the JSON data and save it as an Excel file:</p><pre>import pandas as pd<br><br>data = response.json().get(&quot;data&quot;, [])<br>df = pd.json_normalize(data)<br>df.to_excel(&quot;output.xlsx&quot;, index=False, engine=&quot;openpyxl&quot;)</pre><h3>Conclusion</h3><p>This project demonstrates how Playwright can be combined with API requests to create a powerful automation workflow. By leveraging browser automation, API integration, and data processing tools like Pandas, we can streamline data extraction and reporting tasks efficiently.</p><p>If you found this article helpful, follow me for more automation and data science projects! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db3dfbdd2fe0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Scraping Inflation Data with Python: A Step-by-Step Guide]]></title>
            <link>https://medium.com/@mehmetkarahanc/web-scraping-inflation-data-with-python-a-step-by-step-guide-1acace85b0ec?source=rss-874bc92c9ce8------2</link>
            <guid isPermaLink="false">https://medium.com/p/1acace85b0ec</guid>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Mehmet Karahan Çetinkaya]]></dc:creator>
            <pubDate>Thu, 06 Mar 2025 09:45:32 GMT</pubDate>
            <atom:updated>2025-03-06T09:45:32.215Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Inflation is one of the key indicators of economic health, affecting everything from interest rates to purchasing power. Tracking inflation metrics such as the <strong>Consumer Price Index (TÜFE)</strong> and <strong>Producer Price Index (ÜFE)</strong> can help analysts, economists, and businesses make data-driven decisions.</p><p>As a data analyst, I wanted to automate the collection of <strong>TÜFE and ÜFE</strong> data from the <strong>Central Bank of Turkey (TCMB)</strong> to facilitate economic analysis. In this article, I will guide you through how I built a <strong>Python web scraper</strong> to extract this data and save it as structured Excel files. Additionally, I automated the process using <strong>Windows Task Scheduler</strong> to ensure the data is updated regularly.</p><h3>Tools &amp; Libraries Used</h3><p>Before we dive into the code, let’s go over the tools and libraries that made this project possible:</p><ul><li><strong>Requests</strong> — To fetch web pages</li><li><strong>BeautifulSoup</strong> — To parse and extract HTML table data</li><li><strong>Pandas</strong> — To structure and process the data for analysis</li><li><strong>Windows Task Scheduler</strong> — To automate script execution</li></ul><h3>Step 1: Fetching the Webpage</h3><p>The first step in any web scraping project is to access the webpage containing the data. In this case, we are extracting inflation data from the <strong>Central Bank of Turkey’s website</strong>.</p><pre>import requests<br>from bs4 import BeautifulSoup</pre><pre># Define the URLs for TÜFE and ÜFE data<br>url_tufe = &#39;https://www.tcmb.gov.tr/wps/wcm/connect/TR/TCMB+TR/Main+Menu/Istatistikler/Enflasyon+Verileri/Tuketici+Fiyatlari&#39;<br>url_yıufe = &#39;https://www.tcmb.gov.tr/wps/wcm/connect/TR/TCMB+TR/Main+Menu/Istatistikler/Enflasyon+Verileri/Uretici+Fiyatlari&#39;</pre><pre># Fetch the pages<br>response_tufe = requests.get(url_tufe)<br>response_yıufe = requests.get(url_yıufe)</pre><p>Once the pages are fetched successfully, we need to <strong>parse</strong> the HTML content.</p><pre>soup_tufe = BeautifulSoup(response_tufe.text, &#39;html.parser&#39;)<br>soup_yıufe = BeautifulSoup(response_yıufe.text, &#39;html.parser&#39;)</pre><h3>Step 2: Extracting Data from HTML Tables</h3><p>Since the data is structured in tables, we extract it using <strong>BeautifulSoup</strong>.</p><pre># Locate the tables<br>table_tufe = soup_tufe.find(&#39;table&#39;)<br>table_yıufe = soup_yıufe.find(&#39;table&#39;)</pre><p>Next, we extract column headers and format them properly:</p><pre># Extract table headers<br>headers_tufe = [header.text for header in table_tufe.find_all(&#39;th&#39;)]<br>headers_yıufe = [header.text for header in table_yıufe.find_all(&#39;th&#39;)]</pre><pre># Adjust column names to improve readability<br>headers_tufe[0] = &#39;Tarih&#39;<br>headers_yıufe[0] = &#39;Tarih&#39;</pre><p>Now, we extract the actual <strong>data rows</strong> from the tables.</p><pre>import pandas as pd</pre><pre>df_tufe = pd.DataFrame(columns=headers_tufe)<br>df_yıufe = pd.DataFrame(columns=headers_yıufe)</pre><pre># Extract TÜFE data<br>for row in table_tufe.find_all(&#39;tr&#39;)[1:]:<br>    row_data = [data.text for data in row.find_all(&#39;td&#39;)]<br>    df_tufe.loc[len(df_tufe)] = row_data</pre><pre># Extract ÜFE data<br>for row in table_yıufe.find_all(&#39;tr&#39;)[1:]:<br>    row_data = [data.text for data in row.find_all(&#39;td&#39;)]<br>    df_yıufe.loc[len(df_yıufe)] = row_data</pre><h3>Step 3: Cleaning and Structuring the Data</h3><p>Once the data is collected, we <strong>clean and format it</strong> for further analysis.</p><pre># Rename specific columns for consistency<br>df_tufe.rename(columns={&#39;TÜFE (Yıllık % Değişim)&#39;: &#39;TUFE_Yillik_Degisim&#39;,<br>                         &#39;TÜFE (Aylık % Değişim)&#39;: &#39;TUFE_Aylik_Degisim&#39;}, inplace=True)</pre><pre>df_yıufe.rename(columns={&#39;Yıllık Değişim)&#39;: &#39;yıufe_Yillik_Degisim&#39;,<br>                         &#39;Aylık Değişim)&#39;: &#39;yıufe_Aylik_Degisim&#39;}, inplace=True)</pre><p>Additionally, we convert the <strong>Tarih</strong> (Date) column to a proper date format:</p><pre>df_tufe[&#39;Tarih&#39;] = pd.to_datetime(df_tufe[&#39;Tarih&#39;])<br>df_yıufe[&#39;Tarih&#39;] = pd.to_datetime(df_yıufe[&#39;Tarih&#39;], errors=&#39;coerce&#39;)</pre><h3>Step 4: Saving the Data to Excel</h3><p>Now that our data is cleaned and structured, we save it as an <strong>Excel file</strong> for easy access and further analysis.</p><pre>df_tufe.to_excel(&#39;tufe.xlsx&#39;, index=False)<br>df_yıufe.to_excel(&#39;yıufe.xlsx&#39;, index=False)</pre><h3>Step 5: Automating with Windows Task Scheduler</h3><p>To ensure that this script runs <strong>regularly and automatically</strong>, I set up a <strong>Windows Task Scheduler</strong> job that executes the script at predefined intervals.</p><h4>How to Set Up the Scheduler</h4><ol><li>Open <strong>Task Scheduler</strong> on Windows.</li><li>Click <strong>Create Basic Task</strong> and name it something like <em>Inflation Data Scraper</em>.</li><li>Set the frequency monthly.</li><li>Choose <strong>Start a Program</strong> and select your Python interpreter and script file.</li><li>Save the task and ensure it runs correctly.</li></ol><p>This ensures that my <strong>TÜFE and ÜFE data</strong> is updated automatically without manual intervention.</p><h3>Conclusion</h3><p>Through this project, I learned how to automate web scraping using <strong>Python, BeautifulSoup, and Pandas</strong>, and schedule it with <strong>Windows Task Scheduler</strong>. Automating inflation data collection saves time and ensures accurate, up-to-date records for analysis. If you’re interested in economic data analysis, I highly recommend trying out web scraping to collect the data you need.</p><p>Would you like to see more projects like this? Let me know in the comments! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1acace85b0ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>