<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Web Development &#8211; Be on the Right Side of Change</title>
	<atom:link href="https://blog.finxter.com/category/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.finxter.com</link>
	<description></description>
	<lastBuildDate>Tue, 16 Dec 2025 22:11:49 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>

<image>
	<url>https://blog.finxter.com/wp-content/uploads/2020/08/cropped-cropped-finxter_nobackground-32x32.png</url>
	<title>Web Development &#8211; Be on the Right Side of Change</title>
	<link>https://blog.finxter.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>My Vibe Coding Tech Stack for 2026</title>
		<link>https://blog.finxter.com/my-vibe-coding-tech-stack-for-2026/</link>
		
		<dc:creator><![CDATA[Chris]]></dc:creator>
		<pubDate>Tue, 16 Dec 2025 22:11:48 +0000</pubDate>
				<category><![CDATA[Artificial Intelligence]]></category>
		<category><![CDATA[Coding Business]]></category>
		<category><![CDATA[Google Gemini]]></category>
		<category><![CDATA[Image Generation]]></category>
		<category><![CDATA[OpenAI]]></category>
		<category><![CDATA[Startup]]></category>
		<category><![CDATA[Vibe Coding]]></category>
		<category><![CDATA[Web Development]]></category>
		<guid isPermaLink="false">https://blog.finxter.com/?p=1671583</guid>

					<description><![CDATA[As we gear up for 2026, I&#8217;m streamlining my coding workflow with a lean, vibe-aligned stack that focuses on simplicity and scalability (I have many projects!). It&#8217;s perfect for solo devs or small teams building dynamic web apps. This stack might not be perfect if you work in a large corporation or something. You might ... <a title="My Vibe Coding Tech Stack for 2026" class="read-more" href="https://blog.finxter.com/my-vibe-coding-tech-stack-for-2026/" aria-label="Read more about My Vibe Coding Tech Stack for 2026">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">As we gear up for 2026, I&#8217;m streamlining my coding workflow with a lean, vibe-aligned stack that focuses on simplicity and scalability (I have many projects!). It&#8217;s perfect for solo devs or small teams building dynamic web apps. </p>



<p class="wp-block-paragraph"><strong>This stack might not be perfect if you work in a large corporation or something.</strong> You might want to use Cursor and other tools as well. Here&#8217;s the breakdown, tool by tool.</p>



<h2 class="wp-block-heading">OpenAI &#8211; Codex and Research</h2>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="257" src="https://blog.finxter.com/wp-content/uploads/2025/12/image-24-1024x257.png" alt="" class="wp-image-1671584" srcset="https://blog.finxter.com/wp-content/uploads/2025/12/image-24-1024x257.png 1024w, https://blog.finxter.com/wp-content/uploads/2025/12/image-24-300x75.png 300w, https://blog.finxter.com/wp-content/uploads/2025/12/image-24-768x193.png 768w, https://blog.finxter.com/wp-content/uploads/2025/12/image-24.png 1497w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">OpenAI powers my core ideation phase with Codex for rapid code generation and research tools for deep dives into algorithms or APIs. It&#8217;s like having a tireless co-pilot that turns vague concepts into functional prototypes, saving hours on boilerplate and letting me focus on the fun, innovative bits.</p>



<h2 class="wp-block-heading">Gemini App &#8211; Visuals and Infographics</h2>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="689" src="https://blog.finxter.com/wp-content/uploads/2025/12/image-27-1024x689.png" alt="" class="wp-image-1671587" srcset="https://blog.finxter.com/wp-content/uploads/2025/12/image-27-1024x689.png 1024w, https://blog.finxter.com/wp-content/uploads/2025/12/image-27-300x202.png 300w, https://blog.finxter.com/wp-content/uploads/2025/12/image-27-768x516.png 768w, https://blog.finxter.com/wp-content/uploads/2025/12/image-27.png 1511w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">For visuals and infographics, Gemini App is my go-to—it&#8217;s intuitive for whipping up charts, diagrams, and UI mockups that make complex data pop. Whether I&#8217;m explaining a new feature or prepping client decks, its drag-and-drop magic ensures polished outputs without the Photoshop slog.</p>



<h2 class="wp-block-heading">GitHub &#8211; Project Management and Deployment Pipeline</h2>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="679" src="https://blog.finxter.com/wp-content/uploads/2025/12/image-28-1024x679.png" alt="" class="wp-image-1671588" srcset="https://blog.finxter.com/wp-content/uploads/2025/12/image-28-1024x679.png 1024w, https://blog.finxter.com/wp-content/uploads/2025/12/image-28-300x199.png 300w, https://blog.finxter.com/wp-content/uploads/2025/12/image-28-768x509.png 768w, https://blog.finxter.com/wp-content/uploads/2025/12/image-28.png 1513w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">GitHub handles all project management and deployment pipelines with its robust repo features, Actions for CI/CD, and seamless collaboration tools. It&#8217;s the central hub where ideas branch, merge, and ship, keeping everything versioned and automated for zero-downtime releases.</p>



<h2 class="wp-block-heading">Heroku &#8211; Hosting</h2>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="431" src="https://blog.finxter.com/wp-content/uploads/2025/12/image-29-1024x431.png" alt="" class="wp-image-1671589" srcset="https://blog.finxter.com/wp-content/uploads/2025/12/image-29-1024x431.png 1024w, https://blog.finxter.com/wp-content/uploads/2025/12/image-29-300x126.png 300w, https://blog.finxter.com/wp-content/uploads/2025/12/image-29-768x323.png 768w, https://blog.finxter.com/wp-content/uploads/2025/12/image-29.png 1496w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">Heroku simplifies hosting with one-click deploys and auto-scaling, ideal for spinning up full-stack apps without server wrangling. Its free tier for testing and easy add-ons for extras like logging make it a no-brainer for quick iterations and reliable uptime.</p>



<h2 class="wp-block-heading">MariaDB &#8211; Database for Dynamic Web Apps</h2>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="455" src="https://blog.finxter.com/wp-content/uploads/2025/12/image-30-1024x455.png" alt="" class="wp-image-1671590" srcset="https://blog.finxter.com/wp-content/uploads/2025/12/image-30-1024x455.png 1024w, https://blog.finxter.com/wp-content/uploads/2025/12/image-30-300x133.png 300w, https://blog.finxter.com/wp-content/uploads/2025/12/image-30-768x341.png 768w, https://blog.finxter.com/wp-content/uploads/2025/12/image-30.png 1398w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">MariaDB anchors my dynamic web apps as a robust, open-source database that&#8217;s MySQL-compatible but faster and more feature-rich. It excels at handling relational data for user auth, content management, or e-commerce backends, with easy scaling for growing traffic.</p>



<h2 class="wp-block-heading">FastSpring &#8211; Payments (VAT and Sales Tax Handling)</h2>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="612" src="https://blog.finxter.com/wp-content/uploads/2025/12/image-31-1024x612.png" alt="" class="wp-image-1671591" srcset="https://blog.finxter.com/wp-content/uploads/2025/12/image-31-1024x612.png 1024w, https://blog.finxter.com/wp-content/uploads/2025/12/image-31-300x179.png 300w, https://blog.finxter.com/wp-content/uploads/2025/12/image-31-768x459.png 768w, https://blog.finxter.com/wp-content/uploads/2025/12/image-31-1536x917.png 1536w, https://blog.finxter.com/wp-content/uploads/2025/12/image-31.png 1599w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">Payments flow through FastSpring for its global compliance magic, auto-handling VAT, sales tax, and subscriptions across 200+ countries. It&#8217;s plug-and-play for monetizing apps, reducing legal headaches so I can prioritize product over paperwork.</p>



<h2 class="wp-block-heading">Namecheap &#8211; Domains</h2>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="1024" height="526" src="https://blog.finxter.com/wp-content/uploads/2025/12/image-32-1024x526.png" alt="" class="wp-image-1671592" srcset="https://blog.finxter.com/wp-content/uploads/2025/12/image-32-1024x526.png 1024w, https://blog.finxter.com/wp-content/uploads/2025/12/image-32-300x154.png 300w, https://blog.finxter.com/wp-content/uploads/2025/12/image-32-768x395.png 768w, https://blog.finxter.com/wp-content/uploads/2025/12/image-32-1536x789.png 1536w, https://blog.finxter.com/wp-content/uploads/2025/12/image-32.png 1720w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">Namecheap locks in domains with affordable, straightforward registration and privacy protection. Quick WHOIS guards and easy transfers keep my online presence secure and branded, without the upsell drama of bigger registrars.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">Feel free to <a href="https://blog.finxter.com/ai/">subscribe to my vibe coding newsletter</a> &#8211; the goal is to help you be on the right side of change.</p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Creating a Live Bitcoin Price Chart Using Binance API (No API Key!)</title>
		<link>https://blog.finxter.com/creating-a-live-bitcoin-price-chart-using-binance-api-no-api-key/</link>
		
		<dc:creator><![CDATA[Jean Rousseau]]></dc:creator>
		<pubDate>Sun, 28 Apr 2024 14:14:46 +0000</pubDate>
				<category><![CDATA[App Development]]></category>
		<category><![CDATA[Bitcoin]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Scraping]]></category>
		<guid isPermaLink="false">https://blog.finxter.com/?p=1670164</guid>

					<description><![CDATA[In this tutorial, we&#8217;ll learn how to create a simple live-updating Bitcoin price chart using the Binance API. This straightforward guide will cover all the necessary HTML, JavaScript, and CSS code required to get started with real-time cryptocurrency price tracking. You don&#8217;t need much for this tutorial: ✅ We&#8217;ll create a single HTML document that ... <a title="Creating a Live Bitcoin Price Chart Using Binance API (No API Key!)" class="read-more" href="https://blog.finxter.com/creating-a-live-bitcoin-price-chart-using-binance-api-no-api-key/" aria-label="Read more about Creating a Live Bitcoin Price Chart Using Binance API (No API Key!)">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">In this tutorial, we&#8217;ll learn how to create a simple live-updating Bitcoin price chart using the Binance API. This straightforward guide will cover all the necessary HTML, JavaScript, and CSS code required to get started with real-time cryptocurrency price tracking.</p>



<p class="wp-block-paragraph">You don&#8217;t need much for this tutorial: <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> </p>



<ol class="wp-block-list">
<li>Basic understanding of HTML, CSS, and JavaScript.</li>



<li>A modern web browser.</li>
</ol>



<p class="wp-block-paragraph">We&#8217;ll create a single HTML document that includes inline JavaScript and CSS. This approach ensures that you can easily copy, paste, and run the example without managing multiple files.</p>



<p class="has-global-color-8-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4c8.png" alt="📈" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Execution</strong>: To run the Bitcoin price checker, copy the entire HTML code into a file with a <code>.html</code> extension. Open this file in any modern web browser to see the live Bitcoin price updating every few seconds.</p>



<p class="wp-block-paragraph">You can see it live right here:</p>



<!DOCTYPE html>
<html lang="en">
<head>
    
    
    <title>Live Bitcoin Price Chart</title>
    <style>
        body {
            font-family: Arial, sans-serif;
        }
        #chartContainer {
            height: 300px;
            width: 100%;
            margin: 20px auto;
            border: 1px solid #ccc;
        }
    </style>
</head>
<body>
    <div id="chartContainer"></div>
    <script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
    <script>
        let priceDataPoints = [];

        function updateChartData() {
            fetch('https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT')
                .then(response => response.json())
                .then(data => {
                    const btcPrice = parseFloat(data.price);
                    const currentTime = new Date();
                    priceDataPoints.push({ x: currentTime, y: btcPrice });
                    if (priceDataPoints.length > 20) {
                        priceDataPoints.shift();
                    }
                    updateChart();
                }).catch(error => console.error("Error fetching BTC price:", error));
        }

        function updateChart() {
            let chart = new CanvasJS.Chart("chartContainer", {
                title: {
                    text: "Live Bitcoin Price"
                },
                axisX: {
                    title: "Time",
                    valueFormatString: "HH:mm:ss",
                    labelAngle: -30
                },
                axisY: {
                    title: "Price (USD)",
                    includeZero: false,
                    prefix: "$"
                },
                data: [{
                    type: "line",
                    xValueType: "dateTime",
                    dataPoints: priceDataPoints
                }]
            });
            chart.render();
        }

        updateChartData(); // Initial call to populate the chart
        setInterval(updateChartData, 5000); // Update chart every 5 seconds
    </script>
</body>
</html>



<p class="wp-block-paragraph">Here&#8217;s the full HTML document with embedded CSS and JavaScript:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;!DOCTYPE html>
&lt;html lang="en">
&lt;head>
    &lt;meta charset="UTF-8">
    &lt;meta name="viewport" content="width=device-width, initial-scale=1.0">
    &lt;title>Live Bitcoin Price Chart&lt;/title>
    &lt;style>
        body {
            font-family: Arial, sans-serif;
        }
        #chartContainer {
            height: 300px;
            width: 100%;
            margin: 20px auto;
            border: 1px solid #ccc;
        }
    &lt;/style>
&lt;/head>
&lt;body>
    &lt;div id="chartContainer">&lt;/div>
    &lt;script src="https://canvasjs.com/assets/script/canvasjs.min.js">&lt;/script>
    &lt;script>
        let priceDataPoints = [];

        function updateChartData() {
            fetch('https://api.binance.com/api/v3/ticker/price?symbol=BTCUSDT')
                .then(response => response.json())
                .then(data => {
                    const btcPrice = parseFloat(data.price);
                    const currentTime = new Date();
                    priceDataPoints.push({ x: currentTime, y: btcPrice });
                    if (priceDataPoints.length > 20) {
                        priceDataPoints.shift();
                    }
                    updateChart();
                }).catch(error => console.error("Error fetching BTC price:", error));
        }

        function updateChart() {
            let chart = new CanvasJS.Chart("chartContainer", {
                title: {
                    text: "Live Bitcoin Price"
                },
                axisX: {
                    title: "Time",
                    valueFormatString: "HH:mm:ss",
                    labelAngle: -30
                },
                axisY: {
                    title: "Price (USD)",
                    includeZero: false,
                    prefix: "$"
                },
                data: [{
                    type: "line",
                    xValueType: "dateTime",
                    dataPoints: priceDataPoints
                }]
            });
            chart.render();
        }

        updateChartData(); // Initial call to populate the chart
        setInterval(updateChartData, 5000); // Update chart every 5 seconds
    &lt;/script>
&lt;/body>
&lt;/html></pre>



<p class="wp-block-paragraph">The code works as follows:</p>



<p class="wp-block-paragraph"><strong>HTML Structure</strong>: We have a <code>div</code> element where the chart will be displayed.</p>



<p class="wp-block-paragraph"><strong>CSS Styling</strong>: Simple styles are applied to ensure the chart container is visually defined.</p>



<p class="wp-block-paragraph"><strong>JavaScript for Live Data</strong>:</p>



<ul class="wp-block-list">
<li><strong>Fetching Data</strong>: The JavaScript uses the <code>fetch</code> API to pull live Bitcoin prices from Binance&#8217;s public API endpoint.</li>



<li><strong>Updating the Chart</strong>: We use CanvasJS (a third-party library) to render the price chart. New data points are added every 5 seconds, and the oldest data points are removed to keep the chart clean and readable.</li>



<li><strong>CanvasJS Library</strong>: This is a powerful and easy-to-use chart library, which we include from a CDN. It simplifies drawing the live chart.</li>
</ul>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>The Art of Clean Code &#8211; Less Is More In Design</title>
		<link>https://blog.finxter.com/the-art-of-clean-code-less-is-more-in-design/</link>
		
		<dc:creator><![CDATA[Chris]]></dc:creator>
		<pubDate>Tue, 16 Jan 2024 14:41:52 +0000</pubDate>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Data Visualization]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Web Development]]></category>
		<guid isPermaLink="false">https://blog.finxter.com/?p=1654234</guid>

					<description><![CDATA[As developers, we rarely perceive ourselves as designers, yet interface crafting is an integral facet of our craft. Be it shaping an intuitive dashboard for data analysis, architecting an easily navigable API, or constructing straightforward web interfaces for blockchain applications, a grasp on basic design principles separates the forgettable from the functional. 💡 This chapter ... <a title="The Art of Clean Code &#8211; Less Is More In Design" class="read-more" href="https://blog.finxter.com/the-art-of-clean-code-less-is-more-in-design/" aria-label="Read more about The Art of Clean Code &#8211; Less Is More In Design">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">As developers, we rarely perceive ourselves as designers, yet interface crafting is an integral facet of our craft. </p>



<p class="wp-block-paragraph">Be it shaping an intuitive dashboard for data analysis, architecting an easily navigable API, or constructing straightforward web interfaces for blockchain applications, a grasp on basic design principles separates the forgettable from the functional. </p>



<p class="has-base-2-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> This chapter examines the impactful principle of minimalism in design and user experience (UX).</p>



<p class="wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Previous Chapter</strong>: <a href="https://blog.finxter.com/the-unix-philosophy/" data-type="link" data-id="https://blog.finxter.com/the-unix-philosophy/">The Art of Clean Code — 14 Unix Principles</a></p>



<h2 class="wp-block-heading">Transformative Minimalism in Tech&#8217;s Evolution</h2>



<p class="wp-block-paragraph">Reflect on the mobile phone&#8217;s trajectory—from the cumbersome &#8217;80s bulk to the sleek smartphones of the 21st century. Through Nokia&#8217;s iterative shedding of weight and size, and the eventual rise of the iPhone, a pattern emerges: elegance in tech aligns with the pursuit of less.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="604" height="340" src="https://blog.finxter.com/wp-content/uploads/2024/01/image-103.png" alt="" class="wp-image-1654235" srcset="https://blog.finxter.com/wp-content/uploads/2024/01/image-103.png 604w, https://blog.finxter.com/wp-content/uploads/2024/01/image-103-300x169.png 300w" sizes="auto, (max-width: 604px) 100vw, 604px" /><figcaption class="wp-element-caption">Milestones in the evolution of mobile phones</figcaption></figure>
</div>


<p class="wp-block-paragraph">This narrative is not exclusive to phones. Google&#8217;s search homepage offers a masterclass in minimalism—billions of users are welcomed daily by simplicity incarnate. </p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="605" height="340" src="https://blog.finxter.com/wp-content/uploads/2024/01/image-104.png" alt="" class="wp-image-1654236" srcset="https://blog.finxter.com/wp-content/uploads/2024/01/image-104.png 605w, https://blog.finxter.com/wp-content/uploads/2024/01/image-104-300x169.png 300w" sizes="auto, (max-width: 605px) 100vw, 605px" /></figure>
</div>


<p class="wp-block-paragraph">In stark contrast, competitors like Yahoo muddied their interfaces with ads and news, a move that cost them users and market dominance.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="604" height="340" src="https://blog.finxter.com/wp-content/uploads/2024/01/image-105.png" alt="" class="wp-image-1654237" srcset="https://blog.finxter.com/wp-content/uploads/2024/01/image-105.png 604w, https://blog.finxter.com/wp-content/uploads/2024/01/image-105-300x169.png 300w" sizes="auto, (max-width: 604px) 100vw, 604px" /></figure>
</div>


<p class="wp-block-paragraph">Google&#8217;s <a href="https://material.io/design" data-type="link" data-id="https://material.io/design">Material Design</a> philosophies reinforce this commitment to intuitive, minimalist interfaces that resonate with users through familiarity and ease of interaction. These design choices aren&#8217;t solely about aesthetics; they are strategic, optimizing the most valuable resources: </p>



<ul class="wp-block-list">
<li>user time, </li>



<li>interface space, and </li>



<li>financial investment.</li>
</ul>



<h2 class="wp-block-heading">Crafting Minimalistic Design: Principles and Practices</h2>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="604" height="340" src="https://blog.finxter.com/wp-content/uploads/2024/01/image-106.png" alt="" class="wp-image-1654238" srcset="https://blog.finxter.com/wp-content/uploads/2024/01/image-106.png 604w, https://blog.finxter.com/wp-content/uploads/2024/01/image-106-300x169.png 300w" sizes="auto, (max-width: 604px) 100vw, 604px" /><figcaption class="wp-element-caption">Material vs Non-Material Design</figcaption></figure>
</div>


<h3 class="wp-block-heading">Prioritizing Whitespace</h3>



<p class="wp-block-paragraph">Whitespace may wrongly be deemed wasted space—when it&#8217;s quite the contrary. Google and Apple leverage it to maintain user focus and clarity. An uncluttered interface may be the divider between retaining users and losing them to confusion.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="604" height="340" src="https://blog.finxter.com/wp-content/uploads/2024/01/image-107.png" alt="" class="wp-image-1654239" srcset="https://blog.finxter.com/wp-content/uploads/2024/01/image-107.png 604w, https://blog.finxter.com/wp-content/uploads/2024/01/image-107-300x169.png 300w" sizes="auto, (max-width: 604px) 100vw, 604px" /></figure>
</div>


<p class="wp-block-paragraph">The figure shows a simple design idea for an <strong>online pizza delivery service</strong>. The whitespace supports the focus on the main thing: getting customers to order pizza. Unfortunately, seldomly will a pizza delivery service be bold enough to use whitespace in such an extreme way.</p>



<p class="wp-block-paragraph">Whitespace also helps increasing clarity with text:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="604" height="340" src="https://blog.finxter.com/wp-content/uploads/2024/01/image-108.png" alt="" class="wp-image-1654240" srcset="https://blog.finxter.com/wp-content/uploads/2024/01/image-108.png 604w, https://blog.finxter.com/wp-content/uploads/2024/01/image-108-300x169.png 300w" sizes="auto, (max-width: 604px) 100vw, 604px" /></figure>
</div>


<p class="wp-block-paragraph">The left side of the figure is far less readable. </p>



<p class="wp-block-paragraph">The right side injects whitespace to improve readability and UX: </p>



<ul class="wp-block-list">
<li>margins on the left and right around the text block, </li>



<li>indentation of paragraphs, </li>



<li>an increased line height, </li>



<li>top and bottom margins around paragraphs, and </li>



<li>increased font size. </li>
</ul>



<p class="wp-block-paragraph">The costs of this additional space are negligible: scrolling is cheap, and we don’t have to physically cut more trees for paper when the publication is digital. </p>



<p class="wp-block-paragraph">On the other hand, the benefits are very real: the UX of your website or application improves significantly!</p>



<h3 class="wp-block-heading">Eliminating Redundant Elements</h3>



<p class="wp-block-paragraph">In the quest for simplicity, question every element&#8217;s utility. Discard the superfluous, maintain the essential. The goal is not just good design; it is great design, one that prioritizes user needs over decorative features.</p>



<p class="wp-block-paragraph">Here&#8217;s how you can think about it:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="604" height="340" src="https://blog.finxter.com/wp-content/uploads/2024/01/image-109.png" alt="" class="wp-image-1654241" srcset="https://blog.finxter.com/wp-content/uploads/2024/01/image-109.png 604w, https://blog.finxter.com/wp-content/uploads/2024/01/image-109-300x169.png 300w" sizes="auto, (max-width: 604px) 100vw, 604px" /></figure>
</div>


<p class="wp-block-paragraph">This shows an <strong>idealized editing process</strong> in which you classify each element according to its importance regarding the UX. </p>



<p class="wp-block-paragraph">For example, does a menu item referring to your company’s blog help the user in the checkout process when ordering a product? No, so it should be classified as <em>not important</em>. </p>



<p class="wp-block-paragraph">Amazon has stripped all unnecessary design elements from the ordering process, for instance, by introducing the one-click buy button. </p>



<p class="has-base-2-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f9d1-200d-1f4bb.png" alt="🧑‍💻" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Story</strong>: When I first learned about this method in a scientific writing workshop, it completely transformed the way I thought about editing. Removing unimportant and less important design elements guarantees improved usability with little risk. But only truly great designers have the boldness to remove important design elements and leave only very important elements. Yet, this is what separates great from merely good design.</p>



<p class="wp-block-paragraph">Here&#8217;s another example where many design elements have been successfully removed to accomplish greater quality and superior design:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="604" height="340" src="https://blog.finxter.com/wp-content/uploads/2024/01/image-110.png" alt="" class="wp-image-1654242" srcset="https://blog.finxter.com/wp-content/uploads/2024/01/image-110.png 604w, https://blog.finxter.com/wp-content/uploads/2024/01/image-110-300x169.png 300w" sizes="auto, (max-width: 604px) 100vw, 604px" /><figcaption class="wp-element-caption"><strong>Remove unimportant elements</strong>. Left: Unfocused order page with many design elements. Right: Focused order page with unnecessary design elements removed.</figcaption></figure>
</div>


<h3 class="wp-block-heading">Cutting Down on Features</h3>



<p class="wp-block-paragraph">Just as an author must kill their darlings, a developer must curb feature creep. The success stories of tech—think of Microsoft&#8217;s apparent bloated offerings—are actually narratives of ruthless feature prioritization.</p>



<p class="wp-block-paragraph">But you don&#8217;t see the features that have been removed or not pursued further. To keep learning about this, check out our lesson on MVPs:</p>



<p class="wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <a href="https://blog.finxter.com/the-art-of-clean-code-minimum-viable-product-mvp/" data-type="link" data-id="https://blog.finxter.com/the-art-of-clean-code-minimum-viable-product-mvp/">The Art of Clean Code – Minimum Viable Product (MVP)</a></p>



<h3 class="wp-block-heading">Streamlining Design Variations</h3>



<p class="wp-block-paragraph">Cognitive ease should guide design choices. Limit font variations, color uses, and sizes to reduce complexity. Consistent, focused use of these elements leads to a more coherent user experience.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="604" height="340" src="https://blog.finxter.com/wp-content/uploads/2024/01/image-111.png" alt="" class="wp-image-1654243" srcset="https://blog.finxter.com/wp-content/uploads/2024/01/image-111.png 604w, https://blog.finxter.com/wp-content/uploads/2024/01/image-111-300x169.png 300w" sizes="auto, (max-width: 604px) 100vw, 604px" /></figure>
</div>


<h3 class="wp-block-heading">Consistency Across Interfaces</h3>



<p class="wp-block-paragraph">Uniformity across app interfaces isn&#8217;t merely about aesthetics—it&#8217;s about creating a cohesive and instantly recognizable user experience. Adherence to brand guidelines ensures this consistency.</p>



<h2 class="wp-block-heading">The Future of Design: Simplicity Reigns</h2>



<p class="wp-block-paragraph">As we look ahead, the essence of minimalism in design seems poised to deepen with advancements in voice recognition and virtual interfaces.</p>



<p class="wp-block-paragraph">The trend suggests an evolution toward even more streamlined user experiences. We&#8217;re moving towards an era where the ultimate design may well be an &#8216;invisible&#8217; interface, integrated seamlessly into our daily lives.</p>



<p class="wp-block-paragraph">Through examples from giants like Apple and Google, we&#8217;ve observed the powerful impact minimalism has in the tech world—a realm where the simplest interfaces are often the most successful. As technology continues to evolve, one truth remains clear: <strong>in the world of design, less indeed proves to be more</strong>.</p>



<p class="wp-block-paragraph">Stay tuned for the next chapter, where we conclude with focus—its critical role and impact in the realm of programming.</p>



<p class="has-base-2-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Advanced Reading</strong>: For those eager to delve into the principles highlighted in this chapter, detailed insights can be found in Google&#8217;s Material Design guidelines (<a href="https://material.io/design/introduction/">https://material.io/design/introduction/</a>) and Apple&#8217;s Interface design documentation (<a href="https://developer.apple.com/design/human-interface-guidelines/">https://developer.apple.com/design/human-interface-guidelines/</a>). </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>(Solved) Python Request Error 403 When Web Scraping</title>
		<link>https://blog.finxter.com/solved-python-request-error-403-when-web-scraping/</link>
		
		<dc:creator><![CDATA[Emily Rosemary Collins]]></dc:creator>
		<pubDate>Tue, 09 Jan 2024 19:45:47 +0000</pubDate>
				<category><![CDATA[Error]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Python Requests]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Scraping]]></category>
		<guid isPermaLink="false">https://blog.finxter.com/?p=1654082</guid>

					<description><![CDATA[Quick Fix Trying to parse a site when web scraping or calling APIs with Python requests, but getting slapped with a 403 Forbidden error. Ouch! The basic code looks like this: And the server is like, “Nope, you&#8217;re not coming in” 🥸, showing a 403 Forbidden error. Turns out, servers can be picky. They might ... <a title="(Solved) Python Request Error 403 When Web Scraping" class="read-more" href="https://blog.finxter.com/solved-python-request-error-403-when-web-scraping/" aria-label="Read more about (Solved) Python Request Error 403 When Web Scraping">Read more</a>]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Quick Fix</h2>



<p class="wp-block-paragraph">Trying to parse a site when web scraping or calling APIs with Python <code>requests</code>, but getting slapped with a 403 Forbidden error. Ouch! The basic code looks like this:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import requests
url = 'http://example.com/'
result = requests.get(url)
print(result.content.decode())</pre>



<p class="wp-block-paragraph">And the server is like, <em>“Nope, you&#8217;re not coming in”</em> <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f978.png" alt="🥸" class="wp-smiley" style="height: 1em; max-height: 1em;" />, showing a 403 Forbidden error.</p>



<p class="wp-block-paragraph">Turns out, servers can be picky. They might block requests that don&#8217;t seem to come from a web browser. For example, Elon Musk decided to block bots from scraping Twitter content to maintain data sovereignty in the AI race. </p>



<p class="wp-block-paragraph"><strong>The trick to do it anyways?</strong> Add a <code>User-Agent</code> header to your request. It&#8217;s like wearing a disguise to look like a regular visitor.</p>



<p class="wp-block-paragraph">Here’s how you do it:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import requests
url = 'http://worldagnetwork.com/'
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'}
result = requests.get(url, headers=headers)
print(result.content.decode())</pre>



<p class="wp-block-paragraph">Still getting the cold shoulder with a 403 error? Time to beef up your disguise with more headers, like <code>Referer</code>. </p>



<p class="wp-block-paragraph">You can find these headers in your browser&#8217;s developer tools (<code>F12 → Network → Headers → Request Headers</code>).</p>



<p class="wp-block-paragraph">Here&#8217;s an enhanced header example:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">headers = {
    'User-Agent': 'Your User Agent',
    'Referer': 'https://example.com'
}</pre>



<p class="wp-block-paragraph"><strong>Finding User-Agent</strong>: Too lazy to dig through the Network tab? Just type <code>navigator.userAgent</code> in the Chrome developer console.</p>



<p class="wp-block-paragraph"><strong>Headers Missing in Network Tab?</strong>: Refresh the page, check any HTTP request, and scroll down to see the request headers.</p>



<h2 class="wp-block-heading">What is the 403 Forbidden Error?</h2>



<p class="wp-block-paragraph">Have you been a nasty boy (or girl)? <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p class="has-global-color-8-background-color has-background wp-block-paragraph">The 403 Forbidden Error is like a strict doorkeeper saying you can&#8217;t enter. When you try to access a webpage, your browser sends a request. If the website&#8217;s server decides you shouldn’t access that page, it responds with a <code>403 Forbidden Error</code>. It&#8217;s like the server saying, <em>“I understand what you want, but I won&#8217;t let you in.”</em> This happens for various reasons, like access control settings or website configurations.</p>



<p class="wp-block-paragraph">Here&#8217;s a handy table of common HTTP error codes and their meanings. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /> </p>



<figure class="wp-block-table is-style-stripes"><table><thead><tr><th><strong>Error Code</strong></th><th><strong>Meaning</strong></th></tr></thead><tbody><tr><td><strong>200 OK</strong></td><td>Everything went well. The request was successful.</td></tr><tr><td><strong>201 Created</strong></td><td>A new resource was successfully created.</td></tr><tr><td><strong>301 Moved Permanently</strong></td><td>The requested URL has been permanently moved to a new location.</td></tr><tr><td><strong>302 Found</strong></td><td>The resource temporarily resides at a different URI.</td></tr><tr><td><strong>304 Not Modified</strong></td><td>The resource hasn&#8217;t been modified since the last request.</td></tr><tr><td><strong>400 Bad Request</strong></td><td>The server couldn&#8217;t understand the request due to invalid syntax.</td></tr><tr><td><strong>401 Unauthorized</strong></td><td>Authentication is required and has failed or hasn&#8217;t been provided.</td></tr><tr><td><strong><mark>403 Forbidden</mark></strong></td><td><mark>The server understood the request but refuses to authorize it.</mark></td></tr><tr><td><strong>404 Not Found</strong></td><td>The server can&#8217;t find the requested resource.</td></tr><tr><td><strong>405 Method Not Allowed</strong></td><td>The request method is known by the server but is not supported for the resource.</td></tr><tr><td><strong>500 Internal Server Error</strong></td><td>A generic error message when the server encounters an unexpected condition.</td></tr><tr><td><strong>501 Not Implemented</strong></td><td>The server does not support the functionality required to fulfill the request.</td></tr><tr><td><strong>502 Bad Gateway</strong></td><td>The server received an invalid response from the upstream server.</td></tr><tr><td><strong>503 Service Unavailable</strong></td><td>The server is not ready to handle the request, often due to maintenance or overloading.</td></tr><tr><td><strong>504 Gateway Timeout</strong></td><td>The server didn&#8217;t receive a timely response from the upstream server.</td></tr></tbody></table></figure>



<p class="wp-block-paragraph">These codes are part of the HTTP protocol, and they help developers understand what&#8217;s happening when their application interacts with web servers. They&#8217;re like a universal language for communicating the status of web requests.</p>



<h2 class="wp-block-heading">Solving the Python Request Forbidden Error 403 When Web Scraping</h2>



<p class="wp-block-paragraph">When you&#8217;re web scraping with Python and hit a 403 error, it&#8217;s like knocking on a door and being turned away. </p>



<p class="wp-block-paragraph">To solve this, change your approach. Use <code>headers</code> in your Python requests to mimic a real browser. </p>



<p class="wp-block-paragraph">Here&#8217;s an example:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import requests

url = 'https://example.com'
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'}
response = requests.get(url, headers=headers)</pre>



<p class="wp-block-paragraph">This code tells the server, <em>“Hey, I&#8217;m just like a regular browser, let me in!”</em></p>



<h2 class="wp-block-heading">Python Requests Post Error 403</h2>



<p class="wp-block-paragraph"><strong>Facing a 403 error when sending a POST request in Python? </strong>This is like trying to submit a form on a website and being rejected.</p>



<p class="wp-block-paragraph">To fix this, check if the website needs specific headers or cookies. Sometimes, including a &#8216;Referer&#8217; header or a valid &#8216;User-Agent&#8217; string helps:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import requests

url = 'https://example.com/post'
data = {'key': 'value'}
headers = {'User-Agent': 'Your User Agent', 'Referer': 'https://example.com'}
response = requests.post(url, data=data, headers=headers)</pre>



<p class="wp-block-paragraph">Here, you&#8217;re assuring the server that your request is legitimate.</p>



<h2 class="wp-block-heading">Python Request Get 403 Error</h2>



<p class="wp-block-paragraph">When your Python GET request returns a 403 error, it&#8217;s like being denied entry <strong>when you ask for information</strong>. To bypass this, add <code>headers</code> that make your request look like it&#8217;s coming from a regular web browser:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import requests

url = 'https://example.com'
headers = {'User-Agent': 'Your User Agent'}
response = requests.get(url, headers=headers)</pre>



<p class="wp-block-paragraph">This code is your digital disguise to get past the server&#8217;s restrictions.</p>



<h2 class="wp-block-heading">Python Requests Proxy Error 403</h2>



<p class="wp-block-paragraph">A 403 error when using a proxy in Python requests is like a bouncer blocking your disguised entry. Sometimes, servers block known proxies. Try using a different proxy or adding headers:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import requests

url = 'https://example.com'
proxies = {'http': 'http://10.10.1.10:3128'}
headers = {'User-Agent': 'Your User Agent'}
response = requests.get(url, proxies=proxies, headers=headers)</pre>



<p class="wp-block-paragraph">This approach is like changing your disguise and trying a different door.</p>



<h2 class="wp-block-heading">Python urllib.request Error 403</h2>



<p class="wp-block-paragraph">Encountering a 403 error with <code>urllib.request</code>? It&#8217;s similar to using <code><a href="https://blog.finxter.com/python-async-requests-getting-urls-concurrently-via-https/" data-type="post" data-id="1651606">requests</a></code>, but you&#8217;re using a different tool. Add a <code>User-Agent</code> in your request header:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import urllib.request

url = 'https://example.com'
req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
response = urllib.request.urlopen(req)</pre>



<p class="wp-block-paragraph">This method tells the server that your request is coming from a common web browser.</p>



<h2 class="wp-block-heading">403 Forbidden Delete Request</h2>



<p class="wp-block-paragraph">A 403 error on a DELETE request means you&#8217;re trying to remove something from the server, but it’s not allowing you. Check if you have the right permissions and if your request headers are correctly set. Sometimes, you also need an authentication token.</p>



<h2 class="wp-block-heading">Getting the Authentication Token</h2>



<p class="wp-block-paragraph">An authentication token in the Python context, or in any programming context really, is a digital key that allows you to access certain resources or services. Imagine it like a special pass that lets you into a VIP area; without it, you&#8217;re not getting in.</p>



<p class="wp-block-paragraph">When you&#8217;re coding in Python, especially when dealing with web APIs or <a href="https://blog.finxter.com/python-web-scraping-from-url-to-csv-in-no-time/" data-type="post" data-id="1313474">web scraping</a>, you often need to prove who you are to access certain data or functionalities. This is where the authentication token comes in. It&#8217;s a string (a series of characters) that verifies your identity to the server or service you&#8217;re trying to access.</p>



<p class="wp-block-paragraph">Here&#8217;s a simple breakdown:</p>



<ol class="wp-block-list">
<li><strong>Obtaining the Token</strong>: First, you need to get this token. This usually happens after you log in or send a request with your credentials (like your username and password). The server then gives you a token as a response.</li>



<li><strong>Using the Token</strong>: Once you have the token, you include it in the headers of your subsequent requests. This is like showing your pass every time you try to access something.</li>



<li><strong>Server Verification</strong>: The server checks the token to ensure it&#8217;s valid and corresponds to a user with the right permissions. If everything checks out, you get access.</li>
</ol>



<p class="wp-block-paragraph">In Python, using an authentication token might look something like this:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import requests

url = 'https://example.com/api/data'
token = 'your-authentication-token-here'
headers = {'Authorization': f'Bearer {token}'}

response = requests.get(url, headers=headers)</pre>



<p class="wp-block-paragraph">In this example, the <code>Authorization</code> header is used to pass the token with each request, and the format <code>Bearer {token}</code> is a common way to present the token. The server, upon receiving this request, checks the token and then allows access to the data or functionality you requested.</p>



<h2 class="wp-block-heading">403 Error Reasons</h2>



<p class="wp-block-paragraph">Common reasons for a 403 error include:</p>



<ul class="wp-block-list">
<li><strong>Incorrect URL</strong>: Like dialing a wrong number.</li>



<li><strong>Access Control</strong>: The server&#8217;s way of saying, “You&#8217;re not on the guest list.”</li>



<li><strong>Firewall Settings</strong>: A digital guard blocking your path.</li>



<li><strong>Outdated Cache</strong>: Old information leading you astray.</li>
</ul>



<h2 class="wp-block-heading">Is Web Scraping Legal?</h2>



<p class="wp-block-paragraph">Web scraping walks a fine line between being super helpful and potentially troublesome. It&#8217;s legal if you respect the website&#8217;s terms of service and don&#8217;t overburden their server. </p>



<p class="wp-block-paragraph">Think of it like fishing: do it responsibly, without depleting the fish population! Always check the website&#8217;s <code>robots.txt</code> file to understand their scraping rules.</p>



<p class="wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f449.png" alt="👉" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <a href="https://blog.finxter.com/is-web-scraping-legal/" data-type="post" data-id="383048">Is Web Scraping Legal?</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>(Fixed) Python Request Error 500</title>
		<link>https://blog.finxter.com/fixed-python-request-error-500/</link>
		
		<dc:creator><![CDATA[Emily Rosemary Collins]]></dc:creator>
		<pubDate>Mon, 08 Jan 2024 17:56:29 +0000</pubDate>
				<category><![CDATA[Error]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Python Requests]]></category>
		<category><![CDATA[Web Development]]></category>
		<guid isPermaLink="false">https://blog.finxter.com/?p=1654043</guid>

					<description><![CDATA[When using Python&#8217;s requests library, encountering a 500 Internal Server Error indicates that the server has experienced an unexpected condition, preventing it from fulfilling the request. 🔧 Quick Fix: To solve a 500 error, start by examining the server-side logs for detailed error messages. If the server is within your control, review your server code ... <a title="(Fixed) Python Request Error 500" class="read-more" href="https://blog.finxter.com/fixed-python-request-error-500/" aria-label="Read more about (Fixed) Python Request Error 500">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">When using Python&#8217;s <a href="https://blog.finxter.com/python-requests-library/" data-type="post" data-id="37796"><code>requests</code> library</a>, encountering a<strong> 500 Internal Server Error</strong> indicates that the server has experienced an unexpected condition, preventing it from fulfilling the request.</p>



<p class="has-base-2-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f527.png" alt="🔧" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Quick Fix</strong>: To solve a 500 error, start by examining the server-side logs for detailed error messages. If the server is within your control, review your server code for bugs. If you&#8217;re a client, check your request for correctness, or try again later, as 500 errors can be temporary. Occasionally, contacting the server&#8217;s support team can help diagnose and resolve the issue.</p>



<h2 class="wp-block-heading">Problem Formulation</h2>



<p class="wp-block-paragraph">An <strong>HTTP request error 500</strong>, often referred to as an <code>"Internal Server Error"</code> is a general status code indicating that something has gone wrong on the server side, but the server cannot be more specific about the exact problem. </p>



<p class="wp-block-paragraph">Here’s an example where a 500 error might occur during a Python <code>requests</code> session:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import requests

url = 'https://example.com/api/data'
data = {'key': 'value'}

response = requests.post(url, json=data)

if response.status_code == 500:
    print('Server Error: Status Code 500')</pre>



<p class="wp-block-paragraph">This error can occur due to various issues on the server, such as misconfigurations, faulty scripts, or server overload. </p>



<p class="wp-block-paragraph">Unlike client-side errors (4xx), which are typically due to incorrect requests, a 500 error suggests a problem that needs to be resolved by the server administrator.</p>



<p class="wp-block-paragraph"><strong><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f9d1-200d-1f4bb.png" alt="🧑‍💻" class="wp-smiley" style="height: 1em; max-height: 1em;" /></strong> <strong>HTTP response status codes</strong> separate into five categories as defined by the first digit:</p>



<figure class="wp-block-table is-style-stripes"><table><tbody><tr><td>1XX</td><td>Informational Response</td><td>The request was received, continuing process.</td></tr><tr><td>2XX</td><td>Success</td><td>The request was successfully received, understood &amp; accepted.</td></tr><tr><td>3XX</td><td>Redirection</td><td>Further action is needed to complete the request.</td></tr><tr><td>4XX</td><td>Client Error</td><td>The requests contain invalid syntax or incomplete data.</td></tr><tr><td>5XX</td><td>Server Error</td><td>The server failed to fulfill a valid request.</td></tr></tbody></table></figure>



<p class="wp-block-paragraph">In practice, however, it could still be due to a bad request format. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<h2 class="wp-block-heading">Method 1: Verify Request Format</h2>



<p class="has-global-color-8-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Idea</strong>: Confirm that the request body and headers are correctly formatted as per the API documentation.</p>



<p class="wp-block-paragraph">Here&#8217;s a minimal example:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">headers = {'Content-Type': 'application/json'}
response = requests.post(url, json=data, headers=headers)</pre>



<p class="wp-block-paragraph">The example includes a <code>Content-Type</code> header to indicate the type of the data being sent. This can resolve a 500 error if the issue was due to the server not understanding the request format.</p>



<h2 class="wp-block-heading">Method 2: Handle Server Overload</h2>



<p class="has-global-color-8-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Idea</strong>: Implement exponential backoff and retry logic to handle cases where the server might be temporarily overloaded.</p>



<p class="wp-block-paragraph">Here&#8217;s a practical code example:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import time

for i in range(3):
    response = requests.post(url, json=data)
    if response.status_code == 500:
        wait = 2 ** i
        time.sleep(wait)
    else:
        break</pre>



<p class="wp-block-paragraph">If the server error is temporary due to overload, waiting before retrying the request may result in a successful response.</p>



<h2 class="wp-block-heading">Method 3: Contact Server Administrator</h2>



<p class="has-global-color-8-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Idea</strong>: If the server is not under your control, reach out to the server administrator for insight into the error.</p>



<p class="wp-block-paragraph"><strong>Explanation</strong>: By contacting the admin, you might learn about ongoing issues or receive guidance on how to formulate your request to avoid the error.</p>



<h2 class="wp-block-heading">Method 4: Update Endpoint Configuration</h2>



<p class="has-global-color-8-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Idea</strong>: Ensure that the server&#8217;s endpoint configuration is correct, which may involve updating server-side code or settings. This will depend on the specifics of the server-side software.</p>



<p class="wp-block-paragraph"><strong>Explanation</strong>: This is applicable if you have control over the server. Updating the configuration, such as increasing resource limits or fixing a server bug, can resolve the issue.</p>



<h2 class="wp-block-heading">Method 5: Log and Debug Server Error</h2>



<p class="has-global-color-8-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Idea</strong>: Increase server-side logging to capture detailed stack traces or error messages when the 500 error occurs. This will depend on the server-side language and framework but may involve adding error logging around potentially problematic code blocks.</p>



<p class="wp-block-paragraph">With enhanced logging, you can pinpoint the cause of the error on the server, which is crucial for troubleshooting and fixing the issue.</p>



<h2 class="wp-block-heading">Summary</h2>



<p class="wp-block-paragraph">Each method has its pros and cons:</p>



<ul class="wp-block-list">
<li><strong>Method 1 (Request Format)</strong> often resolves client-side mistakes, but won&#8217;t help if the server error is unrelated to request syntax.</li>



<li><strong>Method 2 (Server Overload)</strong> is useful for temporary errors, but is only a workaround and doesn&#8217;t address underlying server capacity issues.</li>



<li><strong>Method 3 (Contacting Server Admin)</strong> can provide insights or a fix, but it relies on external communication and may not yield immediate results.</li>



<li><strong>Method 4 (Update Endpoint Configuration)</strong> directly resolves server configuration issues, but requires server access, which may not be possible for all clients.</li>



<li><strong>Method 5 (Log and Debug Server Error)</strong> provides a way to precisely address the root cause, but it&#8217;s time-consuming and only applicable for server administrators.</li>
</ul>



<hr class="wp-block-separator has-alpha-channel-opacity"/>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Mobile App Development with Python and Kivy: Your Guide to Building Apps Easily</title>
		<link>https://blog.finxter.com/mobile-app-development-with-python-and-kivy-your-guide-to-building-apps-easily/</link>
		
		<dc:creator><![CDATA[Emily Rosemary Collins]]></dc:creator>
		<pubDate>Mon, 25 Dec 2023 17:16:22 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Web Development]]></category>
		<guid isPermaLink="false">https://blog.finxter.com/?p=1653742</guid>

					<description><![CDATA[Getting Started with Kivy and Python Embarking on your app development journey with Python can be an exciting venture, especially with the Kivy framework. Kivy is a free and open-source Python library that simplifies the process of building cross-platform applications. With this guide, you&#8217;ll set up your development environment and create your first basic application. ... <a title="Mobile App Development with Python and Kivy: Your Guide to Building Apps Easily" class="read-more" href="https://blog.finxter.com/mobile-app-development-with-python-and-kivy-your-guide-to-building-apps-easily/" aria-label="Read more about Mobile App Development with Python and Kivy: Your Guide to Building Apps Easily">Read more</a>]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Getting Started with Kivy and Python</h2>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="Install &amp; Setup Kivy + Create your first Kivy App with Python [for beginners]" width="937" height="527" src="https://www.youtube.com/embed/lQkjroaPz80?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">Embarking on your app development journey with Python can be an exciting venture, especially with the <a href="https://kivy.org/" data-type="link" data-id="https://kivy.org/">Kivy framework</a>. Kivy is a <strong>free and open-source Python library</strong> that simplifies the process of building cross-platform applications. With this guide, you&#8217;ll set up your development environment and create your first basic application.</p>



<h3 class="wp-block-heading">Setting Up the Development Environment</h3>



<p class="wp-block-paragraph">Before you dive into creating your first mobile app, you need to prepare your development environment. This setup is crucial for a smooth Kivy experience. Start by ensuring you have <strong><a href="https://blog.finxter.com/start-learning-python/">Python installed</a></strong> on your system. Kivy is compatible across <strong>Linux, Windows, and macOS</strong> platforms, and it&#8217;s vital to download the correct Python version for your operating system.</p>



<p class="wp-block-paragraph">Once Python is set up, the next step is to establish a <strong><a href="https://blog.finxter.com/python-virtual-environments-with-venv-a-step-by-step-guide/">virtual environment</a></strong>. This is a sandbox that allows you to manage dependencies for different projects without conflicts. </p>



<p class="wp-block-paragraph">You can create a virtual environment using <code>python -m venv kivy_venv</code> and activate it with </p>



<p class="wp-block-paragraph"><code>source kivy_venv/bin/activate</code> </p>



<p class="wp-block-paragraph">on Linux/macOS or </p>



<p class="wp-block-paragraph"><code>kivy_venv\Scripts\activate</code> </p>



<p class="wp-block-paragraph">on Windows.</p>



<p class="wp-block-paragraph">Now it&#8217;s time to install Kivy. With your virtual environment active, use <strong>pip</strong>, the Python package installer, to add Kivy to your project by running <code>pip install kivy</code>. </p>



<p class="wp-block-paragraph"></p>



<h3 class="wp-block-heading">Creating Your First Kivy App</h3>



<p class="wp-block-paragraph">After setting up your environment, you&#8217;re ready to create your inaugural <strong><a href="https://blog.finxter.com/how-i-created-a-short-quiz-app-with-kivy/">Kivy app</a></strong>. </p>



<p class="wp-block-paragraph">Begin by importing Kivy’s <strong>App class</strong> alongside other necessary components, like the <strong>Label class</strong>, which you&#8217;ll use to display text. </p>



<p class="wp-block-paragraph">The outline of your first <a href="https://blog.finxter.com/python-hello-world/">&#8216;HelloWorld&#8217; app</a> would look like this:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">from kivy.app import App
from kivy.uix.label import Label

class HelloWorldApp(App):
    def build(self):
        return Label(text='Hello, World!')

if __name__ == '__main__':
    HelloWorldApp().run()
</pre>



<p class="wp-block-paragraph">In this simple app, the <code>build</code> method of your <code>HelloWorldApp</code> class returns a <strong>Label</strong> with the text <code>'Hello, World!'</code>. </p>



<p class="wp-block-paragraph">When you run this script, a window should pop up displaying your message.</p>



<p class="wp-block-paragraph">To add interactive elements, like a <strong>button</strong>, you would import the <strong><code>Button</code> class</strong> and attach an <strong>event</strong>. The <code>on_press</code> event triggers a function whenever the button is pressed:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">from kivy.uix.button import Button

class HelloWorldApp(App):
    def build(self):
        def on_button_press(instance):
            print('The button was pressed!')

        button = Button(text='Press me')
        button.bind(on_press=on_button_press)
        return button
</pre>



<p class="wp-block-paragraph">With these steps completed, you&#8217;ve successfully built a Kivy application that responds to user interactions. As you grow more comfortable with Kivy&#8217;s components and event handling, you&#8217;ll be able to expand your <strong>&#8216;HelloWorld&#8217; app</strong> into more complex projects.</p>



<h2 class="wp-block-heading">Designing the User Interface</h2>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="Gravity Ride gameplay trailer HD" width="937" height="527" src="https://www.youtube.com/embed/8SfPk5Dfeow?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">When you&#8217;re creating a <a href="https://blog.finxter.com/android-app-developer/">mobile app</a> with <a href="https://blog.finxter.com/how-to-install-kivy-on-pycharm/">Kivy</a>, the <a href="https://blog.finxter.com/ui-ux-developer/">user interface</a> (<a href="https://blog.finxter.com/real-life-skills-you-need-as-a-ui-developer/">UI</a>) is where users interact with your application. It&#8217;s important to make this experience intuitive and engaging.</p>



<h3 class="wp-block-heading">Understanding Kivy Widgets</h3>



<p class="wp-block-paragraph">Widgets are the building blocks of your UI in Kivy. Each <strong>widget</strong> is an element such as a <strong><a href="https://blog.finxter.com/matplotlib-widgets-button/">Button</a></strong>, <strong>Label</strong>, or <strong>TextInput</strong>, which users will interact with. It’s your job to decide where these widgets go and how they behave. </p>



<p class="wp-block-paragraph">For example, a <strong>Button</strong> widget is not only defined by its <strong>size</strong> and <strong>color</strong>, but also by the <strong>events</strong> it triggers when touched. Here&#8217;s a quick list of common widgets you might use:</p>



<ul class="wp-block-list">
<li><strong>Button</strong>: Triggers an action on press.</li>



<li><strong>Label</strong>: Displays text.</li>



<li><strong>TextInput</strong>: Allows text input from users.</li>
</ul>



<p class="wp-block-paragraph">Kivy allows you to customize these widgets with various <strong>properties</strong>, such as <code>text</code>, <code>font_size</code>, and <code>background_color</code>, to fit the design and functionality of your app.</p>



<h3 class="wp-block-heading">Managing Layouts and Events</h3>



<p class="wp-block-paragraph"><strong>Managing Layouts</strong>: The layout of your widgets is vital for a polished UI. You&#8217;ll work with layouts like <strong>BoxLayout</strong> and <strong>GridLayout</strong> to structure your widgets. </p>



<p class="wp-block-paragraph"><strong>BoxLayout</strong> arranges widgets in a horizontal or vertical line, based on the <code>orientation</code> property. </p>



<p class="wp-block-paragraph">To arrange widgets in a matrix, you&#8217;d use <strong>GridLayout</strong>, configuring its <code>cols</code> or <code>rows</code> properties to set the number of columns or rows.</p>



<ul class="wp-block-list">
<li><strong>BoxLayout</strong>: Simple linear arrangement, either vertical or horizontal.</li>



<li><strong>GridLayout</strong>: More complex matrix-style arrangements.</li>
</ul>



<p class="wp-block-paragraph"><strong>Managing Events</strong>: Widgets also have <strong>events</strong> that your app must handle. When a user presses a button, the button dispatches an &#8216;<code>on_press</code>&#8216; event. Here&#8217;s how you might bind a function to a Button&#8217;s event:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">def on_button_press(instance):
    print('The button &amp;#x3C;%s> was pressed!' % instance.text)

btn = Button(text='Click me!')
btn.bind(on_press=on_button_press)
</pre>



<p class="wp-block-paragraph">In this example, pressing the button will trigger the <code>on_button_press</code> function, which can contain the <strong>logic</strong> for what should happen next.</p>



<h2 class="wp-block-heading">Structuring Your Kivy Project</h2>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="488" src="https://blog.finxter.com/wp-content/uploads/2023/12/image-123-1024x488.png" alt="" class="wp-image-1653746" srcset="https://blog.finxter.com/wp-content/uploads/2023/12/image-123-1024x488.png 1024w, https://blog.finxter.com/wp-content/uploads/2023/12/image-123-300x143.png 300w, https://blog.finxter.com/wp-content/uploads/2023/12/image-123-768x366.png 768w, https://blog.finxter.com/wp-content/uploads/2023/12/image-123.png 1167w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p class="wp-block-paragraph">When you start your <strong>Kivy project</strong>, remember that a solid structure is the backbone of any good application. Organize your files by separating your <strong>app logic</strong> from your <strong>app class</strong>, and make sure to follow <strong><a href="https://blog.finxter.com/introduction-to-python-classes/">object-oriented programming</a> (<a href="https://blog.finxter.com/welcome-in-object-oriented-python/">OOP</a>)</strong> principles. This approach not only makes your code cleaner but also easier to manage. </p>



<p class="wp-block-paragraph">A common project structure might look like this:</p>



<ul class="wp-block-list">
<li><strong>main.py</strong>: The entry point of your app which runs the app class.</li>



<li><strong>YourAppName/</strong>: A directory containing:
<ul class="wp-block-list">
<li><strong>app_class.py</strong>: Defines your app class.</li>



<li><strong>screens/</strong>: Contains different screen files for your app.</li>



<li><strong>uix/</strong>: Custom widgets or user interface elements go here.</li>
</ul>
</li>



<li><strong>assets/</strong>: All your images, fonts, and other static resources.</li>



<li><strong>data/</strong>: For non-static data files, like configuration or JSON files.</li>
</ul>



<p class="wp-block-paragraph">Refer to this <a href="https://pythonistaplanet.com/python-kivy-projects/">tutorial on Python Kivy projects</a> that can provide some excellent examples to get you started.</p>



<h3 class="wp-block-heading">Debugging and Optimization</h3>



<p class="wp-block-paragraph">As you develop your application, you&#8217;ll inevitably encounter bugs. Use Kivy&#8217;s built-in <strong>debugging tools</strong> to help you troubleshoot issues in real-time. </p>



<p class="wp-block-paragraph">Tools like the <strong>Kivy Inspector</strong> allow you to interactively alter widget properties to see immediate changes. For optimization, profile your application to identify bottlenecks. Remember to:</p>



<ul class="wp-block-list">
<li>Write efficient <strong>logic</strong> by reducing redundant operations.</li>



<li>Use <strong>compile</strong>-time techniques, such as Cython to speed up performance.</li>
</ul>



<p class="wp-block-paragraph">Resource optimization is particularly critical; ensure that graphics and sound files are optimally compressed without losing quality.</p>



<h3 class="wp-block-heading">Deploying to Mobile Platforms</h3>



<p class="wp-block-paragraph">With a stable and polished application in hand, you&#8217;re ready to deploy to <strong>mobile platforms</strong> like <strong>Android</strong> and <strong>iOS</strong>. You&#8217;ll utilize tools like <strong>Buildozer</strong> or <strong>Python-for-Android</strong> to package your Kivy application. It&#8217;s crucial to test on actual devices to ensure compatibility across different platforms and screen sizes. Here&#8217;s what you need to do:</p>



<ul class="wp-block-list">
<li>Install all necessary dependencies for <strong>compiling</strong> the app for your target platform.</li>



<li>Configure your <strong>build specifications</strong> appropriately in your <code>buildozer.spec</code> file.</li>



<li>Run the build command and fix any issues that arise during the compilation process.</li>
</ul>



<p class="wp-block-paragraph">For more details on the process, especially for <strong>Android</strong>, you can view this <a href="https://blog.logrocket.com/build-android-application-kivy-python-framework/">guide on building an Android application with Kivy Python framework</a>.</p>



<p class="wp-block-paragraph">By adhering to these project development and best practices, you&#8217;ll maximize the <strong>benefits</strong> of using Kivy in the <strong>mobile app development space</strong> and set your <strong>mobile applications</strong> up for success across various platforms.</p>



<h2 class="wp-block-heading">Extended Learning and Community Resources</h2>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="701" src="https://blog.finxter.com/wp-content/uploads/2023/12/image-10-1024x701.jpeg" alt="" class="wp-image-1653745" srcset="https://blog.finxter.com/wp-content/uploads/2023/12/image-10-1024x701.jpeg 1024w, https://blog.finxter.com/wp-content/uploads/2023/12/image-10-300x205.jpeg 300w, https://blog.finxter.com/wp-content/uploads/2023/12/image-10-768x525.jpeg 768w, https://blog.finxter.com/wp-content/uploads/2023/12/image-10.jpeg 1216w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p class="wp-block-paragraph">As you delve deeper into mobile app development with Python using Kivy, it&#8217;s valuable to connect with the community and enhance your skills through additional resources. Beyond just constructing a basic calculator application, you have the opportunity to contribute to a bustling open-source community and further your learning through comprehensive materials.</p>



<h3 class="wp-block-heading">Contributing to Open Source</h3>



<p class="wp-block-paragraph"><strong>Kivy</strong> falls under the MIT License, making it a prime candidate for your contributions. You can give back and support Kivy, which remains <strong>open-source</strong> and relies on community efforts for growth and improvement. Begin by exploring <a href="https://kivy.org/">Kivy&#8217;s official website</a>, which includes detailed information on how to contribute, whether it&#8217;s by submitting patches for bugs or suggesting new features.</p>



<p class="wp-block-paragraph"><strong>Beeware</strong> and <strong>PyQt</strong> are other Python GUI frameworks that welcome contributions as well. Each project has its own set of guidelines for contributors, which can typically be found on their respective websites or repositories.</p>



<h3 class="wp-block-heading">Further Learning Resources</h3>



<p class="wp-block-paragraph"><strong>Tutorials and Examples:</strong><br>For a structured approach to learning, consider diving into an in-depth <strong>video course</strong> such as the one found on <a href="https://www.udemy.com/course/comprehensive-course-on-python-kivymd-appapks-with-python/">Udemy for Python KivyMD</a>. Courses like this provide hands-on examples, including building a <strong>graphical user interface</strong> and creating <strong>cross-platform</strong> applications.</p>



<p class="wp-block-paragraph"><strong>Community and Packages:</strong><br>Joining forums and discussions can provide real-world insights and help. The Kivy community can be found on platforms like <a href="https://groups.google.com/forum/#!forum/kivy-users">Kivy&#8217;s Google Group</a> or the <a href="https://pythondiscord.com/">Python Discord</a>, where you can engage with other developers, ask questions, and share your experiences.</p>



<p class="wp-block-paragraph"><strong>Web Development with Flask:</strong><br>If you&#8217;re interested in extending your Python knowledge to <strong><a href="https://blog.finxter.com/flask-vs-django-a-comparison-between-the-two-most-popular-python-web-frameworks/">web applications</a></strong>, explore <strong>Flask</strong>. Although not directly related to Kivy, Flask is a lightweight <strong>web application</strong> framework that can complement your understanding of Python in client-side and server-side environments. You&#8217;ll find extensive <a href="https://flask.palletsprojects.com/en/1.1.x/tutorial/">documentation and tutorials</a> that can teach you the ropes of web development.</p>



<p class="wp-block-paragraph">Remember, the purpose of these resources is to empower your learning journey—you&#8217;re not just passively consuming information, but actively engaging in the vibrant Python community.</p>



<h2 class="wp-block-heading">Frequently Asked Questions</h2>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="701" src="https://blog.finxter.com/wp-content/uploads/2023/12/image-9-1024x701.jpeg" alt="" class="wp-image-1653744" srcset="https://blog.finxter.com/wp-content/uploads/2023/12/image-9-1024x701.jpeg 1024w, https://blog.finxter.com/wp-content/uploads/2023/12/image-9-300x205.jpeg 300w, https://blog.finxter.com/wp-content/uploads/2023/12/image-9-768x525.jpeg 768w, https://blog.finxter.com/wp-content/uploads/2023/12/image-9.jpeg 1216w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p class="wp-block-paragraph">In this section, you&#8217;ll find common questions and clear answers to help you navigate <a href="https://blog.finxter.com/mobile-app-developer/">mobile app development</a> using Python and Kivy.</p>



<h3 class="wp-block-heading">How can I create a mobile app using Kivy in Python?</h3>



<p class="wp-block-paragraph">To create a mobile app using Kivy in Python, you need to install Kivy on your machine, design your app&#8217;s layout using Kv language, and then add functionality with Python code. Kivy&#8217;s documentation provides a step-by-step guide on how to <a href="https://realpython.com/mobile-app-kivy-python/">get started</a>.</p>



<h3 class="wp-block-heading">What are the benefits of using Python with Kivy for mobile app development?</h3>



<p class="wp-block-paragraph">Using Python with Kivy offers benefits such as cross-platform compatibility, allowing you to write your app once and deploy it on multiple platforms. Kivy&#8217;s use of Python makes it highly readable and maintainable, which can speed up development. For detailed benefits, you can refer to this <a href="https://www.geeksforgeeks.org/kivy-python-framework-for-mobile-app-development/">informative article</a>.</p>



<h3 class="wp-block-heading">Where can I find examples of mobile apps built with Kivy?</h3>



<p class="wp-block-paragraph">You can find examples of mobile apps developed with Kivy by exploring projects shared in the Kivy community or by checking out showcase apps on the <a href="https://kivy.org/#gallery">official Kivy website</a>.</p>



<h3 class="wp-block-heading">Can you provide a tutorial to help beginners start with Kivy for mobile app development?</h3>



<p class="wp-block-paragraph">Absolutely, for beginners looking to start with Kivy, there are tutorials available that guide you through building attractive mobile apps in Python. Here is one such <a href="https://www.androidauthority.com/kivy-python-tutorial-build-attractive-mobile-apps-in-python-1142003/">Kivy Python tutorial</a> that demonstrates the process.</p>



<h3 class="wp-block-heading">Is the Kivy framework actively maintained and updated for developing mobile apps?</h3>



<p class="wp-block-paragraph">Yes, Kivy is an open-source framework that is actively maintained and frequently updated, ensuring it remains a relevant tool for mobile app development. You can follow their updates and contributions on the <a href="https://github.com/kivy/kivy">Kivy GitHub repository</a>.</p>



<h3 class="wp-block-heading">How do I download and set up the Kivy environment for Android app development?</h3>



<p class="wp-block-paragraph">To download and set up Kivy for Android app development, follow the instructions on their <a href="https://kivy.org/doc/stable/gettingstarted/installation.html">installation page</a>, which includes steps for setting up your environment on various operating systems, including Android.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Improve Your Upwork Job Search with RSS and Data Scraping</title>
		<link>https://blog.finxter.com/improve-your-upwork-job-search-with-rss-and-data-scraping/</link>
		
		<dc:creator><![CDATA[Martin Rhodes]]></dc:creator>
		<pubDate>Tue, 19 Dec 2023 19:25:27 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Web Scraping]]></category>
		<guid isPermaLink="false">https://blog.finxter.com/?p=1653658</guid>

					<description><![CDATA[📝 TLDR Freelancers that use Upwork have an advantage if they apply to job soon after they are posted. Upwork offers an RSS feed that can be parsed for job information sent in the jobs broadcast. Feedparser is a python module that can be used to extract some of the key data from the XML ... <a title="Improve Your Upwork Job Search with RSS and Data Scraping" class="read-more" href="https://blog.finxter.com/improve-your-upwork-job-search-with-rss-and-data-scraping/" aria-label="Read more about Improve Your Upwork Job Search with RSS and Data Scraping">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="has-global-color-8-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4dd.png" alt="📝" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>TLDR</strong><br><br>Freelancers that use Upwork have an advantage if they apply to job soon after they are posted.<br><br>Upwork offers an RSS feed that can be parsed for job information sent in the jobs broadcast.<br><br>Feedparser is a python module that can be used to extract some of the key data from the XML data in that RSS field.<br><br>Some of the data in the feed is more deeply embedded and so must be extracted and cleaned before use.<br><br>By combining the extracted data into a Pandas DataFrame there is the ability to filter data and save to a more useful format.</p>



<p class="wp-block-paragraph">At the end of this article, I&#8217;ll provide an interactive Google Colab link for the interactive version of this article. But let&#8217;s start with the video: <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f447.png" alt="👇" class="wp-smiley" style="height: 1em; max-height: 1em;" /> </p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="Improve Your Upwork Job Search with RSS and Data Scraping" width="937" height="527" src="https://www.youtube.com/embed/M6Qp71RnwW8?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<h2 class="wp-block-heading">The Coding Challenge</h2>



<p class="wp-block-paragraph">Upwork is seen to be a good platform for potential freelance jobs.</p>



<p class="wp-block-paragraph">But there can be some challenges in getting to the jobs quickly enough. Early applications are frequently the ones accepted.</p>



<p class="wp-block-paragraph">The job search interface is also not very well suited to the filtering and listing of jobs you are looking for.</p>



<p class="wp-block-paragraph">And…<br>Freelancers need to actively search the jobs page!</p>



<p class="wp-block-paragraph">This tutorial and video look at a way to accelerate that search and filter the jobs on preferred criteria.</p>



<h2 class="wp-block-heading">Learning Objectives</h2>



<p class="wp-block-paragraph">By the end of this tutorial, you will have:</p>



<ul class="wp-block-list">
<li>Defined the project requirements</li>



<li>Explored aspects of Data Scraping</li>



<li>Explored RSS feeds and XML</li>



<li>Followed a potentially useful and repeatable workflow</li>



<li>Built a useful tool</li>



<li>Developed some useful Python skills</li>
</ul>



<h2 class="wp-block-heading">Approach</h2>



<p class="wp-block-paragraph">As freelancers, it can be helpful to approach every task as a formal project.<br>It is good practise and you never know when project might become something more valuable.</p>



<p class="wp-block-paragraph">A client may want something similar or it may become a product you can sell.<br>So, it is a good discipline and will save time in the long run to approach such projects professionally.</p>



<h2 class="wp-block-heading">A Useful Workflow</h2>



<p class="wp-block-paragraph">This pattern of development has proven helpful for me:</p>



<ul class="wp-block-list">
<li>Set the project requirements</li>



<li>Follow a sound process for data scraping
<ul class="wp-block-list">
<li>Investigate the data source</li>



<li>Acquire the data</li>



<li>Extract the data you want</li>



<li>Clean the data</li>



<li>Filter the data</li>



<li>Output the data</li>



<li>Use the data and confirm the information is valid</li>
</ul>
</li>



<li>Document the project</li>



<li>Deliver to the client</li>
</ul>



<p class="wp-block-paragraph">And we&#8217;ll follow this process now.</p>



<h2 class="wp-block-heading">Requirements Setting</h2>



<p class="wp-block-paragraph">Just like we do for our clients, we should have specific requirements.</p>



<p class="wp-block-paragraph">I use the MoSCow approach to setting my requirements.</p>



<p class="wp-block-paragraph">This identifies the parts that the project we:</p>



<ul class="wp-block-list">
<li>Must Do</li>



<li>Should Do</li>



<li>Could Do</li>



<li>Won&#8217;t Do</li>
</ul>



<p class="wp-block-paragraph">And sets out clearly what will be delivered and equally as important, what will not be delivered.</p>



<p class="wp-block-paragraph">Our requirements:</p>



<p class="wp-block-paragraph"><strong>MUST</strong>:</p>



<ol class="wp-block-list">
<li>Provide data from Upwork relevant to the Freelancer</li>



<li>Present the information in a readable format</li>
</ol>



<p class="wp-block-paragraph"><strong>SHOULD</strong>:</p>



<ol class="wp-block-list">
<li>Allow filtering and manipulation of the data as needed by the user</li>



<li>Allow for rapid refresh</li>
</ol>



<p class="wp-block-paragraph"><strong>COULD</strong>:</p>



<ol class="wp-block-list">
<li>Run from the command line with arguments</li>



<li>Could be automated</li>
</ol>



<p class="wp-block-paragraph"><strong>WONT</strong>:</p>



<ol class="wp-block-list">
<li>Have a graphical interface</li>
</ol>



<p class="wp-block-paragraph">We are limited on time. So we will focus on the data-scraping aspect of the task. And we will only complete the <strong>Must</strong> and <strong>Should</strong> requirements.</p>



<h2 class="wp-block-heading">Getting the Data</h2>



<h3 class="wp-block-heading">Investigation</h3>



<p class="wp-block-paragraph">We can see here on the Upwork &#8216;search page&#8217;, entering a search term will give you a large number of potential tasks. But we only want some of these and preferably the latest. And we want them filtered to our needs. So we need to defer from what is presented here.</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="523" src="https://blog.finxter.com/wp-content/uploads/2023/12/Image1-1024x523.png" alt="" class="wp-image-1653661" srcset="https://blog.finxter.com/wp-content/uploads/2023/12/Image1-1024x523.png 1024w, https://blog.finxter.com/wp-content/uploads/2023/12/Image1-300x153.png 300w, https://blog.finxter.com/wp-content/uploads/2023/12/Image1-768x393.png 768w, https://blog.finxter.com/wp-content/uploads/2023/12/Image1-1536x785.png 1536w, https://blog.finxter.com/wp-content/uploads/2023/12/Image1-2048x1047.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p class="wp-block-paragraph">This symbol identifies the Really Simple Syndication (RSS) feed that we shall be using that feed for our data.</p>



<p class="wp-block-paragraph">If we click the link and select RSS, a new page opens with the job feed structured in the Extensible Markup Language (XML).</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="489" src="https://blog.finxter.com/wp-content/uploads/2023/12/Image2-1024x489.png" alt="" class="wp-image-1653662" srcset="https://blog.finxter.com/wp-content/uploads/2023/12/Image2-1024x489.png 1024w, https://blog.finxter.com/wp-content/uploads/2023/12/Image2-300x143.png 300w, https://blog.finxter.com/wp-content/uploads/2023/12/Image2-768x367.png 768w, https://blog.finxter.com/wp-content/uploads/2023/12/Image2-1536x734.png 1536w, https://blog.finxter.com/wp-content/uploads/2023/12/Image2-2048x979.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p class="wp-block-paragraph">We can also see that the feed format is XML.</p>



<p class="wp-block-paragraph">This is similar to HTML and is a markup language that is readable by the computer and by people (people who can look past the tags and format).</p>



<p class="wp-block-paragraph">Apparently this dense text is &#8216;person&#8217; readable!</p>



<p class="wp-block-paragraph">Some of it seems ok but most is hard to read.</p>



<p class="wp-block-paragraph">Let&#8217;s make this more readable.</p>



<p class="wp-block-paragraph">Time is money for the Freelancer.<br>So let&#8217;s copy this data and use a web tool, an <a href="https://jsonformatter.org/xml-formatter">XML formatter</a> to explore the RSS XML data.</p>



<p class="wp-block-paragraph">Here we can see that the XML forms a tree. With 10 indiviual elements, one for each job in this field.</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="394" src="https://blog.finxter.com/wp-content/uploads/2023/12/image3-1024x394.png" alt="" class="wp-image-1653663" srcset="https://blog.finxter.com/wp-content/uploads/2023/12/image3-1024x394.png 1024w, https://blog.finxter.com/wp-content/uploads/2023/12/image3-300x115.png 300w, https://blog.finxter.com/wp-content/uploads/2023/12/image3-768x296.png 768w, https://blog.finxter.com/wp-content/uploads/2023/12/image3-1536x591.png 1536w, https://blog.finxter.com/wp-content/uploads/2023/12/image3-2048x788.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p class="wp-block-paragraph">If we look in to the first few items, we can see the information about each job.</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="389" src="https://blog.finxter.com/wp-content/uploads/2023/12/image4-1024x389.png" alt="" class="wp-image-1653664" srcset="https://blog.finxter.com/wp-content/uploads/2023/12/image4-1024x389.png 1024w, https://blog.finxter.com/wp-content/uploads/2023/12/image4-300x114.png 300w, https://blog.finxter.com/wp-content/uploads/2023/12/image4-768x291.png 768w, https://blog.finxter.com/wp-content/uploads/2023/12/image4-1536x583.png 1536w, https://blog.finxter.com/wp-content/uploads/2023/12/image4-2048x777.png 2048w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<h3 class="wp-block-heading">Observations</h3>



<p class="wp-block-paragraph">It looks like the feed has 10 elements and each element has the Title, Link to the Job and a Description. The description appears to be an HTML script that contains some of the information that we need.</p>



<p class="wp-block-paragraph">So let&#8217;s scrape that data next!</p>



<h3 class="wp-block-heading">Acquisition</h3>



<p class="wp-block-paragraph">There are Python packages that we can use to scrape data from such XML feeds.</p>



<p class="wp-block-paragraph">And it looks like we will be able to extract data from the &#8216;description&#8217; field too. It appears to be a long string object and we have Python mehtods for strings.</p>



<p class="wp-block-paragraph">For the RSS feed with will use &#8216;<a href="https://feedparser.readthedocs.io/en/latest/introduction.html" target="_blank" rel="noreferrer noopener">feedparser&#8217;</a></p>



<p class="has-base-2-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Note</strong>: For simple data-scraping tasks, I like to use a Jupyter notebook. The notebook is useful because it holds the data in memory so it can be explored while we change the code.</p>



<p class="wp-block-paragraph">This means we don&#8217;t need to capture the feed many times.</p>



<p class="wp-block-paragraph">There is no reason you can&#8217;t use VSCode or Pycharm or any other editor.</p>



<p class="wp-block-paragraph">Again as a freelancer, time is money, so use the tools you are familiar with.</p>



<p class="wp-block-paragraph">Looking at the <a href="https://feedparser.readthedocs.io/en/latest/introduction.html">feedparser documents</a></p>



<p class="wp-block-paragraph">We can learn here that the data is acquired by and then parsed by</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import feedparser
data = feedparser.parse(UPWORK_RSS_FEED_URL)</pre>



<p class="wp-block-paragraph">and then we can extract our 3 elements of data using:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import feedparser
data = feedparser.parse(UPWORK_RSS_FEED_URL)

item_title = data.entries[0].title
item_title
item_link = data.entries[0].link
item_link
description  = data.entries[0].description
description</pre>



<p class="has-base-2-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Note</strong>: This data will change frequently as the RSS feed is updated with the latest jobs. This is why the RSS feed is so useful to us Finxters.</p>



<h3 class="wp-block-heading">Extraction</h3>



<p class="wp-block-paragraph">We have already extracted the Title and the Link of the job just from the feedparser entries data.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">item_title = data.entries[0].title
item_link = data.entries[0].link</pre>



<p class="wp-block-paragraph">Now we need to extract the individual elements of information from the &#8216;<code>description</code>&#8216; string.</p>



<p class="wp-block-paragraph">Let&#8217;s take a closer look at one of the &#8216;<code>description</code>&#8216; strings.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">description: We are looking for a skilled developer who can create a mobile application and web application for a fitness app. The main feature of the app will be the integration of AI technology to detect the user&amp;#039;s body, diet, and workout plan. The successful candidate will be responsible for designing and developing the app, ensuring it is user-friendly and has a modern, sleek design. The app should be able to track user progress and provide personalized recommendations based on the user&amp;#039;s inputs and body data. Key skills required for this project include: &lt;br />&lt;br />
- Mobile app development &lt;br />
- Web app development &lt;br />
- AI integration &lt;br />
- UX/UI design &lt;br />
- Data analysis and interpretation&lt;br />&lt;br />&lt;b>Hourly Range&lt;/b>: $8.00-$10.00
&lt;br />&lt;b>Posted On&lt;/b>: December 02, 2023 17:57 UTC&lt;br />&lt;b>Category&lt;/b>: Mobile App Development&lt;br />&lt;b>Skills&lt;/b>:iOS, Android, Smartphone, Python, Mobile App Development
&lt;br />&lt;b>Skills&lt;/b>: iOS, Android, Smartphone, Python, Mobile App Development &lt;br />&lt;b>Country&lt;/b>: United States
&lt;br />&lt;a href="https://www.upwork.com/jobs/Fitness-App-Development-with-Functionality_%7E01494dc445d89c9f7f?source=rss">click to apply&lt;/a></pre>



<p class="wp-block-paragraph">Here we see 14 lines of text with HTML markup and tag and characters such as &#8216;<code>br</code>&#8216; and <code>&amp;# 039 ;</code></p>



<p class="wp-block-paragraph">Then we see a selection of headings inside HTML bold tags.</p>



<p class="wp-block-paragraph">So the general theme for the description block is:</p>



<ul class="wp-block-list">
<li><strong>description </strong>&#8211; HTML code of variable lengths and with some HTML character codes and tags</li>



<li><strong>Hourly Range</strong> &#8211; <code>b_tags</code> and some text</li>



<li><strong>Posted On</strong> &#8211; <code>b_tags</code> and some text</li>



<li><strong>Category</strong> &#8211; <code>b_tags</code> and some text</li>



<li><strong>Skills</strong> &#8211; <code>b_tags</code> and 1 or more skills with commas and spaces in between</li>



<li><strong>Skills </strong>&#8211; a repeated line of skills</li>



<li><strong>Country </strong>&#8211; <code>b_tags</code> and some text</li>



<li><strong>Link </strong>&#8211; a repeat of the link</li>
</ul>



<p class="wp-block-paragraph">Knowing this data structure, we can now use Python to extract the information we need.</p>



<p class="wp-block-paragraph">Let&#8217;s write some code!</p>



<p class="wp-block-paragraph">First we need to import some packages.</p>



<ul class="wp-block-list">
<li><code>feedparser</code> for the RSS feed.</li>



<li><code>pandas</code> for our data storage and filtering</li>



<li><code>ssl</code> to bypass some <code>ssl</code> elements of the feed <code>broadcast</code>.</li>
</ul>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import feedparser
import pandas as pd
import ssl</pre>



<p class="wp-block-paragraph">Now we need a function to create and return an empty and prepared Dataframe in Pandas.</p>



<p class="wp-block-paragraph">As we&#8217;ve discussed, we need to store each jobs:</p>



<ul class="wp-block-list">
<li>Title</li>



<li>Link</li>



<li>Description</li>



<li>Posted on</li>



<li>Category</li>



<li>Skills List</li>



<li>Price Type (Hourly Range or Budget</li>



<li>Price of budget of max Hourly Rate</li>



<li>Country the job originates in</li>
</ul>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">def make_dataframe():

    jobs_df = pd.DataFrame(columns=[
        'Title', 
        'Link',
        'Description', 
        'Posted',
        'Category',
        'Skills',
        'Price Type', 
        'Price', 
        'Country' ])

    return jobs_df</pre>



<p class="wp-block-paragraph">We need a function that steps through the feed and extracts our information.</p>



<p class="wp-block-paragraph">Firstly, we set up a list of blank data so that if there are gaps in the information, we still have data to place in the DataFrame. Failure to do this would raise an error.</p>



<p class="wp-block-paragraph">Then we &#8216;Parse the Feed&#8217;</p>



<p class="wp-block-paragraph">Title and Job link we can get directly from the feed entry.</p>



<p class="wp-block-paragraph">But for the &#8216;<code>description</code>&#8216;, we need to use the &#8216;<code><a href="https://blog.finxter.com/python-string-split/" data-type="post" data-id="26097">string.split</a></code>&#8216; method and split the string into a list of elements using the &#8216;<code>bold</code>&#8216; tag as the separator.</p>



<p class="wp-block-paragraph">This gives us:</p>



<ul class="wp-block-list">
<li><code>description[0]</code> is the first item in the list and is the main description field we just need to stip this of HTML tags Here we use the &#8216;<code>clean_string</code>&#8216; function.</li>



<li>&#8216;Posted On&#8217; and &#8216;Category&#8217; also get cleaned with &#8216;<code>clean_string</code>&#8216;.</li>
</ul>



<p class="wp-block-paragraph"><em>Notice that we slice off only that part we need to send to be &#8216;cleaned&#8217; eg <code>clean_string(b_tag[15:]</code>)</em></p>



<ul class="wp-block-list">
<li>&#8216;Hourly Range&#8217; / Budget&#8217; get special treatment in the &#8216;clean_price&#8217; function where we return a float for the money value and a string for &#8216;Budget&#8217; or &#8216;Hourly Rate&#8217;</li>



<li>&#8216;Skills&#8217; needs to be stripped into a list (for searching) and also cleaned.</li>



<li>&#8216;Country&#8217; also needs some special treatment</li>
</ul>



<p class="wp-block-paragraph">Once cleaned the data is assigned to a dictionary and added to a DataFrame and added to the master DataFrame.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">def get_data(entry):  # entry is a job item from the RSS feed

    # Some data ends up Null so set those values just in case
    item_posted = ''
    item_cat = ''
    item_price_type = ''
    item_price = 0.0
    item_skills = []
    item_country = ''

    # Set from parsing the feed
    item_title = entry.title
    item_link = entry.link
    description  = entry.description
    description = description.split('&lt;b>')
    item_desc = clean_string(description[0])
    for b_tag in description[1:]:
        if "Hourly Range" in b_tag or "Budget" in b_tag:
            item_price_type, item_price = clean_price(b_tag)
        elif "Posted On" in b_tag:
            item_posted = clean_string(b_tag[15:])
        elif "Category" in b_tag:
            item_cat = clean_string(b_tag[14:])
        elif "Skills" in b_tag and not item_skills :
            item_skills = clean_skills(b_tag[11:])
        elif "Country" in b_tag:
            item_country = clean_country(b_tag[10:])




    # build the DataFrame and return it

    new_job = {
    'Title': item_title, 
    'Link': item_link, 
    'Description': item_desc,
    'Posted': item_posted,
    'Category': item_cat, 
    'Skills': item_skills, 
    'Price Type': item_price_type, 
    'Price': item_price, 
    'Country': item_country}

    new_job_df = pd.DataFrame([new_job])

    return new_job_df</pre>



<p class="wp-block-paragraph">The &#8216;<code>clean_string</code>&#8216; function uses the &#8216;<code>replace</code>&#8216; method and takes each substring that isn&#8217;t required and either removes it or replaces it with the correct value.</p>



<h5 class="wp-block-heading has-base-2-background-color has-background"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> Note: This is not the most pythonic approach, but it has been written for clarity for beginners in mind. How would you make it more Pythonic?</h5>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">def clean_string(string):

    string = string.replace('&lt;br />','')
    string = string.replace('&lt;/b>','')
    string = string.replace('&amp;nbsp;','')
    string= string.replace('&amp;#039;','\'')
    string = string.replace('&amp;rsquo;','\'')
    string = string.replace('&amp;ldquo;','\"') 
    string = string.replace('&amp;rdquo;','\"') 
    string = string.replace('quot;','\'')
    string = string.strip()

    return string</pre>



<p class="wp-block-paragraph">The &#8216;<code>clean_price</code>&#8216; function splits the identifier (&#8216;Hourly Range&#8217; or &#8216;Budget&#8217;) into a new string.</p>



<p class="wp-block-paragraph">It then extracts the number (also a string) and returns it as a float along wth the identifier.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">def clean_price(item_Bud_HR):

    price_split = item_Bud_HR.split(':')
    item_price_type = clean_string(price_split[0]) 
    item_price = price_split[1] # Get and clean the value
    item_price = item_price.replace('$','')
    item_price = item_price.replace('&lt;br />','')
    item_price = item_price.strip()
    if '-' in item_price:
        item_price = item_price.split('-') # If the price is an 'Hourly Range' we split, returning the number on the right of  '-'  
        item_price = item_price[1]
    item_price = float(item_price)

    return item_price_type, item_price</pre>



<p class="wp-block-paragraph">The &#8216;<code>clean_country</code>&#8216; function splits the string on <code>'\n'</code>. It then takes the first element, cleans off the white space and returns the Country name.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">def clean_country(item_country):

    item_country = item_country.split('\n')
    item_country = clean_string(item_country[0])
    item_country = item_country[1].strip()

    return item_country</pre>



<p class="wp-block-paragraph">The &#8216;<code>clean_skills</code>&#8216; function is a little more complex.</p>



<p class="wp-block-paragraph">We create a new empty list, &#8216;<code>item_skills_list</code>&#8216;.</p>



<p class="wp-block-paragraph">We then clean the string by removing HTML tags.</p>



<p class="wp-block-paragraph">We split the string on the <code>','</code> character and step through the list that is created, cleaning each string and then appending it to the list before it is returned.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">def clean_skills(item_skills):

    item_skills_list =[]
    item_skills = item_skills.replace('&lt;br />','')
    item_skills = item_skills.split(',')
    for skill in item_skills:
        item_skills_list.append(skill.strip())

    return item_skills_list</pre>



<p class="wp-block-paragraph">Once a new job DataFrame is created for each job, it is &#8216;concatenated&#8217; to the master DataFrame for later filtering.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">def join_dataframes(new_item_df,jobs_df):

    jobs_df = pd.concat([jobs_df, new_item_df], ignore_index=True)

    return jobs_df</pre>



<p class="wp-block-paragraph">The DataFrame <code>jobs_df</code> now holds all of the RSS feed jobs and their associated data. We can now filter it as required.</p>



<p class="wp-block-paragraph">The ones I have presented here (commented out) offer examples for your own filters.</p>



<ol class="wp-block-list">
<li>Strips out any duplicates based on the &#8216;Posted&#8217; time.</li>



<li>Looks for budgets and hourly figures above 20.0 dollars</li>



<li>Looks for selected countries (United States and India)</li>
</ol>



<p class="wp-block-paragraph">What would you want to filter for?</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">def filter_output(jobs_df):


    # FILTER THE DATA USING Pandas

# 1. Strip out non unique values - Posted on is the pseudo-primary key
    # Uncomment if needed
    #jobs_df = jobs_df.drop_duplicates(subset=['Posted'], ignore_index=True) 

 #2. Only save for Price or budget greater than $10
    # Uncomment if needed
    #jobs_df = jobs_df[jobs_df['Price'] > 20] 

# 3. Only save for Specific Country 
    # selecting rows based on condition 
    # Uncomment below if needed
    #options = ['United States', 'India'] 
    #jobs_df = jobs_df[jobs_df['Country'].isin(options)]

    return jobs_df</pre>



<p class="wp-block-paragraph">Here we have the <code>main()</code> function that takes the Upwork RSS URL and feeds it to the function in turn.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># MAIN
def main():

# Why SSL
# Python is adding http verification in in the std library
# This bypasses the check for th moment
    if hasattr(ssl, '_create_unverified_context'):
        ssl._create_default_https_context = ssl._create_unverified_context


    url="https://www.upwork.com/ab/feed/jobs/rss?q=Python&amp;sort=recency&amp;paging=0%3B10&amp;api_params=1&amp;securityToken=6b9f07dc2632b4ac772d5daa37626af471b7d2526826c56a0c16aad6580245646f4e13804c72bd1ed3755f3bd552f5ba1d3f67a021987f714a1ff340ba7659dc&amp;userUid=1215586676591329280&amp;orgUid=1215586676603912193"

    #Get the Feed Data
    data = feedparser.parse(url)

    # Make the master dataframe
    jobs_df = make_dataframe()

    #Get the data for each item and add it to the DataFrame
    for entry in data.entries:
        new_job_df = get_data(entry)
        # join the new dataframe to the list
        jobs_df = join_dataframes(new_job_df, jobs_df)</pre>



<p class="wp-block-paragraph">Now we have the jobs from the RSS feed in a DataFrame, we can filter using the pandas methods.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">    filter_output(jobs_df)</pre>



<figure class="wp-block-table is-style-stripes"><table><thead><tr><th></th><th>Title</th><th>Link</th><th>Description</th><th>Posted</th><th>Category</th><th>Skills</th><th>Price Type</th><th>Price</th><th>Country</th></tr></thead><tbody><tr><th>0</th><td>AWS Python Consultant &#8211; Upwork</td><td>https://www.upwork.com/jobs/AWS-Python-Consult&#8230;</td><td>Fluent English speaking Python developer with &#8230;</td><td>December 02, 2023 20:13 UTC</td><td>DevOps Engineering</td><td>[Ubuntu, Amazon Web Services, Python, AWS Lamb&#8230;</td><td>Hourly Range</td><td>10.0</td><td>United Kingdom</td></tr><tr><th>1</th><td>1min Time Frame Forex Scalper &#8211; Upwork</td><td>https://www.upwork.com/jobs/1min-Time-Frame-Fo&#8230;</td><td>If you scalp the forex market on the m1 time f&#8230;</td><td>December 02, 2023 20:13 UTC</td><td>Deep Learning</td><td>[Forex Trading]</td><td>Hourly Range</td><td>40.0</td><td>United Kingdom</td></tr><tr><th>2</th><td>AI &#8211; driven crypto charting project &#8211; Upwork</td><td>https://www.upwork.com/jobs/driven-crypto-char&#8230;</td><td>Scope of work\nThedevelopment of a crypto char&#8230;</td><td>December 02, 2023 20:03 UTC</td><td>Machine Learning</td><td>[Artificial Intelligence, Machine Learning, Bl&#8230;</td><td>Hourly Range</td><td>40.0</td><td>Nigeria</td></tr><tr><th>3</th><td>Gelato Smart Contract Integration Upgrade &#8211; Up&#8230;</td><td>https://www.upwork.com/jobs/Gelato-Smart-Contr&#8230;</td><td>I&#8217;m looking for a Solidity developer with Foun&#8230;</td><td>December 02, 2023 20:01 UTC</td><td>Emerging Tech</td><td>[Solidity, Blockchain, TypeScript, Ethereum]</td><td>Hourly Range</td><td>40.0</td><td>United States</td></tr><tr><th>4</th><td>Publish Open-source AI Agent to Web UI (Flutte&#8230;</td><td>https://www.upwork.com/jobs/Publish-Open-sourc&#8230;</td><td>The goal of this project is to create a web UI&#8230;</td><td>December 02, 2023 20:01 UTC</td><td>Full Stack Development</td><td>[AI Agent Development, AI App Development, Flu&#8230;</td><td>Budget</td><td>100.0</td><td>Canada</td></tr><tr><th>5</th><td>Price check automation &#8211; Upwork</td><td>https://www.upwork.com/jobs/Price-check-automa&#8230;</td><td>Would like one of the experts to build me a bo&#8230;</td><td>December 02, 2023 19:57 UTC</td><td>Scripting &amp;amp; Automation</td><td>[Automation, Data Scraping, Data Mining, Data &#8230;</td><td>Hourly Range</td><td>100.0</td><td>Saudi Arabia</td></tr><tr><th>6</th><td>Need for Good Hackers to Assist in Scamming Si&#8230;</td><td>https://www.upwork.com/jobs/Need-for-Good-Hack&#8230;</td><td>We are looking for good hackers who can assist&#8230;</td><td>December 02, 2023 19:38 UTC</td><td>Information Security</td><td>[Data Entry, Python]</td><td>Hourly Range</td><td>45.0</td><td>United States</td></tr><tr><th>7</th><td>Microservices Architecture Help &#8211; Upwork</td><td>https://www.upwork.com/jobs/Microservices-Arch&#8230;</td><td>### **The Data Synchronization Dilemma**\n&#8212;\&#8230;</td><td>December 02, 2023 19:35 UTC</td><td>Back-End Development</td><td>[Python, Microservice, Software Architecture &amp;&#8230;</td><td>Hourly Range</td><td>40.0</td><td>India</td></tr><tr><th>8</th><td>Build two AVL trees for project &#8211; Upwork</td><td>https://www.upwork.com/jobs/Build-two-AVL-tree&#8230;</td><td>I need an avl tree to hold a string node (key)&#8230;</td><td>December 02, 2023 19:28 UTC</td><td>Full Stack Development</td><td>[C++]</td><td>Budget</td><td>250.0</td><td>United States</td></tr><tr><th>9</th><td>ROMP texture on 3D SMPL mesh using Pytorch (No&#8230;</td><td>https://www.upwork.com/jobs/ROMP-texture-SMPL-&#8230;</td><td>(WARNING to SCAMMER)\nStarting from an existin&#8230;</td><td>December 02, 2023 19:23 UTC</td><td>AR/VR Design</td><td>[Python, PyTorch, Augmented Reality, Linux, Ub&#8230;</td><td>Budget</td><td>300.0</td><td>Germany</td></tr></tbody></table></figure>



<p class="wp-block-paragraph">Once we have filtered the data to meet our needs, we use the pandas method to save the DataFrame to an Excel file.</p>



<p class="wp-block-paragraph">It also prints out the top 3 entries to demonstrate the data has been captured.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">    print(jobs_df.head(3))
    # Export to excel
    jobs_df.to_excel('jobs.xlsx', index=False)</pre>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">                                          Title  \
0                AWS Python Consultant - Upwork   
1        1min Time Frame Forex Scalper - Upwork   
2  AI - driven crypto charting project - Upwork   

                                                Link  \
0  https://www.upwork.com/jobs/AWS-Python-Consult...   
1  https://www.upwork.com/jobs/1min-Time-Frame-Fo...   
2  https://www.upwork.com/jobs/driven-crypto-char...   

                                         Description  \
0  Fluent English speaking Python developer with ...   
1  If you scalp the forex market on the m1 time f...   
2  Scope of work\nThedevelopment of a crypto char...   

                        Posted            Category  \
0  December 02, 2023 20:13 UTC  DevOps Engineering   
1  December 02, 2023 20:13 UTC       Deep Learning   
2  December 02, 2023 20:03 UTC    Machine Learning   

                                              Skills    Price Type  Price  \
0  [Ubuntu, Amazon Web Services, Python, AWS Lamb...  Hourly Range   10.0   
1                                    [Forex Trading]  Hourly Range   40.0   
2  [Artificial Intelligence, Machine Learning, Bl...  Hourly Range   40.0   

          Country  
0  United Kingdom  
1  United Kingdom  
2         Nigeria  </pre>



<p class="wp-block-paragraph">That completes our exploration of the code.</p>



<p class="wp-block-paragraph">I hope you have found some insight and value here.</p>



<p class="wp-block-paragraph">Let us review.</p>



<h2 class="wp-block-heading">Learning Objectives</h2>



<p class="wp-block-paragraph">This tutorial and video looked at how to read the RSS feed from Upwork, to accelerate your search and allow you to filter the jobs on your preferred criteria.</p>



<p class="wp-block-paragraph">We have covered:</p>



<ul class="wp-block-list">
<li>Defining your project requirements</li>



<li>Data Scraping</li>



<li>RSS feeds and XML (briefly)</li>



<li>A potentially useful workflow</li>



<li>The building of a useful tool</li>



<li>Some useful Python skills</li>
</ul>



<h2 class="wp-block-heading">Next Steps</h2>



<p class="wp-block-paragraph">This code is very flexible and so here are some options you might want to consider if you are extending its utility:</p>



<ul class="wp-block-list">
<li>You may want to run this code on a timer to give you frequent updates.</li>



<li>You may also want to load the previous jobs scraped into the <code>jobs_df</code> DataFrame so that you can append new jobs.</li>



<li>You may also want to have a <em>&#8216;list of urls&#8217;</em> for different searches that you step through in order to cover lots of searches</li>



<li>If you searches are very specific you might want to have the script email you when a job is posted.</li>
</ul>



<p class="wp-block-paragraph">What will you do?</p>



<h3 class="wp-block-heading">Resources:</h3>



<ul class="wp-block-list">
<li>https://jsonformatter.org/xml-formatter</li>



<li>https://ascii.cl/htmlcodes.htm</li>
</ul>



<p class="wp-block-paragraph">You can also check out this guide on Google Colab using <a href="https://colab.research.google.com/drive/19lIMTWTHw83Kv8JyvXbeAry6yiDrlGqT?usp=sharing" data-type="link" data-id="https://colab.research.google.com/drive/19lIMTWTHw83Kv8JyvXbeAry6yiDrlGqT?usp=sharing">this link</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>L4S: Low Latency, Low Loss, and Scalable Throughput (RFC 9330)</title>
		<link>https://blog.finxter.com/rfc-9330-revolutionizing-internet-speed-and-reliability/</link>
		
		<dc:creator><![CDATA[Emily Rosemary Collins]]></dc:creator>
		<pubDate>Mon, 11 Dec 2023 10:16:39 +0000</pubDate>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Distributed Systems]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Web Development]]></category>
		<guid isPermaLink="false">https://blog.finxter.com/?p=1653494</guid>

					<description><![CDATA[Imagine streaming your favorite 4K movie or playing high-speed online games with virtually no lag. That&#8217;s the promise of L4S: The need for speed and reliability in internet services is paramount. Enter RFC 9330, a groundbreaking document from the IETF that&#8217;s set to revolutionize how we experience the internet. This Low Latency, Low Loss, and ... <a title="L4S: Low Latency, Low Loss, and Scalable Throughput (RFC 9330)" class="read-more" href="https://blog.finxter.com/rfc-9330-revolutionizing-internet-speed-and-reliability/" aria-label="Read more about L4S: Low Latency, Low Loss, and Scalable Throughput (RFC 9330)">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Imagine streaming your favorite 4K movie or playing high-speed online games with virtually no lag. That&#8217;s the promise of L4S:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="760" height="634" src="https://blog.finxter.com/wp-content/uploads/2023/12/image-38.png" alt="" class="wp-image-1653496" srcset="https://blog.finxter.com/wp-content/uploads/2023/12/image-38.png 760w, https://blog.finxter.com/wp-content/uploads/2023/12/image-38-300x250.png 300w" sizes="auto, (max-width: 760px) 100vw, 760px" /><figcaption class="wp-element-caption"><a href="https://datatracker.ietf.org/doc/rfc9330/" data-type="link" data-id="https://datatracker.ietf.org/doc/rfc9330/">source</a></figcaption></figure>
</div>


<p class="wp-block-paragraph">The need for speed and reliability in internet services is paramount. Enter <strong>RFC 9330</strong>, a groundbreaking document from the IETF that&#8217;s set to revolutionize how we experience the internet. This <strong><em>Low Latency, Low Loss, and Scalable Throughput (L4S) Internet Service Architecture</em></strong> is a solution designed to drastically reduce internet queuing delays and congestion losses.</p>



<p class="has-base-2-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2699.png" alt="⚙" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Applications and Use Cases</strong>: The L4S architecture significantly enhances various applications, particularly those requiring low latency. <br><br>These include cloud-based gaming, VoIP, video conferencing, web browsing, adaptive video streaming, and instant messaging. <br><br>L4S&#8217;s low latency enables advanced cloud applications like interactive video and virtual/augmented reality, even on overloaded networks. It&#8217;s particularly beneficial for applications sensitive to latency, such as interactive remote presence and remote control of machinery. <br><br>L4S is applicable across diverse network types, including DSL, mobile, and satellite, and supports a range of transport controls like TCP/SCTP and RTP/RMCAT.</p>



<p class="wp-block-paragraph">It&#8217;s not just about speed; it&#8217;s about consistency and reliability. The L4S architecture targets the root causes of network delays, integrating advanced congestion control mechanisms. </p>



<p class="has-global-color-8-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f4a1.png" alt="💡" class="wp-smiley" style="height: 1em; max-height: 1em;" /> This means smoother video calls, faster file transfers, and a more responsive internet experience overall.</p>



<p class="wp-block-paragraph">What sets RFC 9330 apart is its focus on scalable throughput. </p>



<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" title="Netdev 0x13 -  Implementing the &#039;TCP Prague&#039; Requirements for L4S" width="937" height="527" src="https://www.youtube.com/embed/GyXwvRKW0QE?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">It&#8217;s not just for the tech giants; this architecture benefits everyone from small startups to large ISPs, ensuring that the internet can keep up with our ever-growing data demands. </p>



<p class="wp-block-paragraph">With its innovative approach to tackling internet congestion, RFC 9330 is poised to be a game-changer for tech enthusiasts and everyday users alike.</p>



<p class="wp-block-paragraph">It delves into the intricacies of capacity-seeking congestion controllers and a modified ECN system, offering insights into the future of internet architecture. </p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="590" src="https://blog.finxter.com/wp-content/uploads/2023/12/image-40-1024x590.png" alt="" class="wp-image-1653501" srcset="https://blog.finxter.com/wp-content/uploads/2023/12/image-40-1024x590.png 1024w, https://blog.finxter.com/wp-content/uploads/2023/12/image-40-300x173.png 300w, https://blog.finxter.com/wp-content/uploads/2023/12/image-40-768x443.png 768w, https://blog.finxter.com/wp-content/uploads/2023/12/image-40.png 1513w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p class="wp-block-paragraph">The L4S architecture is a complex system for improving internet performance, consisting of three main components:</p>



<ol class="wp-block-list">
<li><strong>Scalable Congestion Control on Sending Hosts</strong>: This part involves sophisticated methods for sending data over the internet. It adjusts the data flow to avoid congestion, ensuring faster and more reliable transmissions.</li>



<li><strong>Active Queue Management (AQM) at Network Bottlenecks</strong>: This component is deployed in network routers and switches. It intelligently manages data packets in busy network areas to reduce delays and prevent data loss.</li>



<li><strong>Protocol Linking Senders and Network</strong>: This establishes a communication protocol between the sending hosts and the network. It ensures that the new methods of sending data are compatible with the network&#8217;s way of managing traffic.</li>
</ol>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="573" src="https://blog.finxter.com/wp-content/uploads/2023/12/image-41-1024x573.png" alt="" class="wp-image-1653502" srcset="https://blog.finxter.com/wp-content/uploads/2023/12/image-41-1024x573.png 1024w, https://blog.finxter.com/wp-content/uploads/2023/12/image-41-300x168.png 300w, https://blog.finxter.com/wp-content/uploads/2023/12/image-41-768x430.png 768w, https://blog.finxter.com/wp-content/uploads/2023/12/image-41-1536x860.png 1536w, https://blog.finxter.com/wp-content/uploads/2023/12/image-41.png 1575w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<h2 class="wp-block-heading">How Is This Different Than TCP Congestion Control?</h2>



<p class="wp-block-paragraph">L4S differs from traditional TCP congestion control in its approach to handling network congestion. </p>



<p class="wp-block-paragraph">TCP typically detects congestion through packet loss, leading to a series of adjustments like exponential backoff and retransmission of lost packets. </p>



<p class="wp-block-paragraph">This often necessitates large router buffers, which can introduce additional latency.</p>



<p class="wp-block-paragraph">In contrast, L4S enhances the communication between routers and end devices. </p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="546" src="https://blog.finxter.com/wp-content/uploads/2023/12/image-39-1024x546.png" alt="" class="wp-image-1653500" srcset="https://blog.finxter.com/wp-content/uploads/2023/12/image-39-1024x546.png 1024w, https://blog.finxter.com/wp-content/uploads/2023/12/image-39-300x160.png 300w, https://blog.finxter.com/wp-content/uploads/2023/12/image-39-768x410.png 768w, https://blog.finxter.com/wp-content/uploads/2023/12/image-39.png 1335w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /><figcaption class="wp-element-caption"><a href="https://news.ycombinator.com/item?id=38597744" data-type="link" data-id="https://news.ycombinator.com/item?id=38597744">source</a></figcaption></figure>
</div>


<p class="wp-block-paragraph"><strong>It utilizes an additional bit in IP packets</strong>, allowing routers to explicitly indicate congestion before packet loss occurs. This direct signaling enables more efficient congestion management without relying on exponential backoff or large buffers. </p>



<p class="wp-block-paragraph">Consequently, L4S can reduce both the need for retransmissions and the latency associated with large buffers, offering a more efficient and responsive network experience.</p>



<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="wp-block-paragraph">Whether you&#8217;re a network engineer, a tech enthusiast, or just someone who loves a seamless online experience, <a href="https://datatracker.ietf.org/doc/rfc9330/" data-type="link" data-id="https://datatracker.ietf.org/doc/rfc9330/">RFC 9330</a> is a treasure trove.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>Embedding Your GPT in a Website</title>
		<link>https://blog.finxter.com/embedding-your-gpt-in-a-website/</link>
		
		<dc:creator><![CDATA[Chris]]></dc:creator>
		<pubDate>Thu, 16 Nov 2023 09:11:32 +0000</pubDate>
				<category><![CDATA[Artificial Intelligence]]></category>
		<category><![CDATA[ChatGPT]]></category>
		<category><![CDATA[GPTs]]></category>
		<category><![CDATA[Large Language Model (LLM)]]></category>
		<category><![CDATA[OpenAI]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://blog.finxter.com/?p=1653103</guid>

					<description><![CDATA[🧑‍💻 Question: I want to integrate a (custom) GPT model into my website to enhance its interactive features with AI-driven capabilities. How do I achieve this while ensuring the AI functions effectively within the web environment and aligns with my site&#8217;s design and functionality? How do I ensure real-time responses, contextually relevant interactions, and an ... <a title="Embedding Your GPT in a Website" class="read-more" href="https://blog.finxter.com/embedding-your-gpt-in-a-website/" aria-label="Read more about Embedding Your GPT in a Website">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="has-base-2-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f9d1-200d-1f4bb.png" alt="🧑‍💻" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Question</strong>: I want to integrate a (custom) <a href="https://blog.finxter.com/openais-gpt-builder-a-game-changer-for-exponential-entrepreneurs/" data-type="post" data-id="1652887">GPT</a> model into my website to enhance its interactive features with AI-driven capabilities. How do I achieve this while ensuring the AI functions effectively within the web environment and aligns with my site&#8217;s design and functionality? How do I ensure real-time responses, contextually relevant interactions, and an intuitive user interface for this AI integration?</p>



<p class="wp-block-paragraph">When facing these questions, I considered these three methods (and personally implemented the first one): </p>



<h2 class="wp-block-heading">Method 1: WordPress Plugin</h2>



<p class="has-global-color-8-background-color has-background wp-block-paragraph">A <a href="https://blog.finxter.com/top-7-gpts-created-by-finxters/" data-type="post" data-id="1652930" target="_blank" rel="noreferrer noopener">GPT</a> is mostly a context prompt with context data (=<a href="https://blog.finxter.com/openai-api-functions-embeddings-course-1-7-simple-function-request/" data-type="post" data-id="1651043">embeddings</a>), Avatar image, and potential actions. If you don’t badly need actions, i.e., external API calls such as weather data, and you run WordPress, I <a href="https://community.openai.com/t/embedding-a-gpt-in-website/484098/35" data-type="link" data-id="https://community.openai.com/t/embedding-a-gpt-in-website/484098/35">recommend</a> the <a href="https://meowapps.com/ai-engine/faq/" data-type="link" data-id="https://meowapps.com/ai-engine/faq/">Meow Apps</a> plugin (not affiliated).</p>



<p class="wp-block-paragraph">Here&#8217;s a screenshot:</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="617" src="https://blog.finxter.com/wp-content/uploads/2023/11/c7955fe703ce1f306e93c1c107a5661f4e0cda90-1024x617.png" alt="" class="wp-image-1653104" srcset="https://blog.finxter.com/wp-content/uploads/2023/11/c7955fe703ce1f306e93c1c107a5661f4e0cda90-1024x617.png 1024w, https://blog.finxter.com/wp-content/uploads/2023/11/c7955fe703ce1f306e93c1c107a5661f4e0cda90-300x181.png 300w, https://blog.finxter.com/wp-content/uploads/2023/11/c7955fe703ce1f306e93c1c107a5661f4e0cda90-768x463.png 768w, https://blog.finxter.com/wp-content/uploads/2023/11/c7955fe703ce1f306e93c1c107a5661f4e0cda90.png 1507w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></figure>
</div>


<p class="wp-block-paragraph">In the ‘<strong>Chatbots</strong>’ section, you can set the <strong>Context</strong>. Simply copy and paste the ‘<strong>Instructions</strong>’ prompt from the GPTs builder here.</p>



<p class="wp-block-paragraph">In the ‘<strong>Chatbots > Visual Settings</strong>’ section, you can set the name and Avatar of your GPT so it feels the same.</p>



<p class="wp-block-paragraph">In the ‘<strong>Chatbots > Embeddings</strong>’ section you can set the environment and add external data (e.g., using Pinecone).</p>



<p class="wp-block-paragraph">I’m super happy with the plugin and can generally recommend it. You can see it live on any of our (bottom right) with what you may call a ‘custom GPT’.</p>



<p class="wp-block-paragraph">Here are some alternative solutions for embedding a GPT model on a website, provided by the <a href="https://community.openai.com/t/embedding-a-gpt-in-website/484098/35" data-type="link" data-id="https://community.openai.com/t/embedding-a-gpt-in-website/484098/35">community</a> in November 2023:</p>



<h2 class="wp-block-heading">Method 2: Using Assistant API with an iFrame</h2>



<p class="wp-block-paragraph">Implement an iframe on your webpage to embed the GPT.</p>



<p class="wp-block-paragraph">Integrate a chat widget in the <code>base.html</code> file, using JavaScript to navigate the conversation based on the activated page.</p>



<p class="wp-block-paragraph">Set up a Flask backend to handle API requests and send responses​. Web developer <a href="https://community.openai.com/t/embedding-a-gpt-in-website/484098/24?u=chris42" data-type="link" data-id="https://community.openai.com/t/embedding-a-gpt-in-website/484098/24?u=chris42">Zorawar Purohit</a> provided this code for the Flask backend:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group=""># backend.py

from flask import Flask, request, jsonify
from flask_cors import CORS
import openai

app = Flask(__name__)
CORS(app)  # Enable CORS

openai.api_key = 'your-api-key'  # Replace with your OpenAI API key

@app.route('/ask', methods=['POST'])
def ask():
    data = request.json
    response = openai.Completion.create(
        engine="text-davinci-003",
        prompt=data['prompt'],
        max_tokens=150
    )
    return jsonify(response)

if __name__ == '__main__':
    app.run(port=5000)  # Run the Flask app on port 5000</pre>



<p class="wp-block-paragraph">​Include an HTML page setup with iframe, form, and JavaScript function to send messages to the AI and display responses​ (<a href="https://community.openai.com/t/embedding-a-gpt-in-website/484098/24?u=chris42" data-type="link" data-id="https://community.openai.com/t/embedding-a-gpt-in-website/484098/24?u=chris42">source</a>):</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;!-- index.html -->

&lt;!DOCTYPE html>
&lt;html lang="en">
&lt;head>
    &lt;meta charset="UTF-8">
    &lt;title>AI Assistant&lt;/title>
    &lt;script src="https://code.jquery.com/jquery-3.6.0.min.js">&lt;/script>
    &lt;style>
        iframe {
            width: 100%;
            height: 500px;
            border: none;
        }
    &lt;/style>
&lt;/head>
&lt;body>
    &lt;iframe id="ai_frame" sandbox="allow-scripts allow-same-origin">&lt;/iframe>

    &lt;form onsubmit="sendMessageToAI(); return false;">
        &lt;input type="text" id="prompt" name="prompt" required>
        &lt;input type="submit" value="Ask AI">
    &lt;/form>

    &lt;script>
        function sendMessageToAI() {
            var prompt = document.getElementById('prompt').value;
            $.ajax({
                url: 'http://localhost:5000/ask',  // Point to the backend endpoint
                type: 'POST',
                contentType: 'application/json',
                data: JSON.stringify({ prompt: prompt }),
                success: function(response) {
                    // Write the AI's response to the iframe
                    var iframeDocument = document.getElementById('ai_frame').contentDocument;
                    iframeDocument.open();
                    iframeDocument.write('&lt;p>' + response.choices[0].text + '&lt;/p>');
                    iframeDocument.close();
                },
                error: function(xhr, status, error) {
                    // Handle error
                    console.error("Error: " + status + " - " + error);
                }
            });
        }
    &lt;/script>
&lt;/body>
&lt;/html></pre>



<h2 class="wp-block-heading">Method 3: Creating an Assistant Instead of a GPT</h2>



<p class="wp-block-paragraph">Opt for creating an Assistant (using the <a href="https://platform.openai.com/docs/assistants/overview" data-type="link" data-id="https://platform.openai.com/docs/assistants/overview">Assistant API</a>) instead of directly embedding a GPT model.</p>



<p class="wp-block-paragraph">Consider having a chatbox integration built for you or waiting for a plugin builder (e.g., Meow) to add this functionality to their plugin.</p>



<p class="wp-block-paragraph">Note that the Assistant API might interact differently than GPT models, potentially requiring more instructions and tweaking​.</p>



<p class="wp-block-paragraph">Also, note that there may be additional solutions at the time you&#8217;re reading this &#8211; the space is rapidly evolving. <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f680.png" alt="🚀" class="wp-smiley" style="height: 1em; max-height: 1em;" /> </p>



<p class="wp-block-paragraph">To stay updated with all the trends, consider subscribing to our <a href="https://blog.finxter.com/subscribe/" data-type="page" data-id="1414" target="_blank" rel="noreferrer noopener">email newsletter</a> on the latest tech and trends in LLM and Python by downloading any of our cheat sheets:</p>






<hr class="wp-block-separator has-alpha-channel-opacity"/>



<p class="has-base-2-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f525.png" alt="🔥" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended</strong>: <a href="https://blog.finxter.com/openai-wants-us-to-create-gpts-i-e-miniature-ai-agent-helpers/" data-type="post" data-id="1652758">OpenAI Wants Us to Create GPTs, i.e., Miniature AI Agent Helpers</a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>How I Created Charts Using Charts.js in Django Web Application</title>
		<link>https://blog.finxter.com/how-i-created-charts-using-charts-js-in-django-web-application/</link>
		
		<dc:creator><![CDATA[Jonathan Okah]]></dc:creator>
		<pubDate>Fri, 04 Aug 2023 14:37:00 +0000</pubDate>
				<category><![CDATA[Data Visualization]]></category>
		<category><![CDATA[Django]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Web Development]]></category>
		<guid isPermaLink="false">https://blog.finxter.com/?p=1547017</guid>

					<description><![CDATA[If you want to display charts in your Django web application, whether it is a bar chart, a pie chart, or other charts, you have so many options at your disposal &#8212; from using Plotly in Python language to using HighCharts.js or Charts.js in JavaScript. The beauty of using the later over the former is ... <a title="How I Created Charts Using Charts.js in Django Web Application" class="read-more" href="https://blog.finxter.com/how-i-created-charts-using-charts-js-in-django-web-application/" aria-label="Read more about How I Created Charts Using Charts.js in Django Web Application">Read more</a>]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">If you want to display charts in your Django web application, whether it is a bar chart, a pie chart, or other charts, you have so many options at your disposal &#8212; from using <a href="https://blog.finxter.com/plotly-dash-vs-streamlit/" data-type="post" data-id="997098" target="_blank" rel="noreferrer noopener">Plotly</a> in Python language to using <code>HighCharts.js</code> or <code>Charts.js</code> in JavaScript.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="720" height="405" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-33.png" alt="" class="wp-image-1547022" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-33.png 720w, https://blog.finxter.com/wp-content/uploads/2023/08/image-33-300x169.png 300w" sizes="auto, (max-width: 720px) 100vw, 720px" /></figure>
</div>


<p class="wp-block-paragraph">The beauty of using the later over the former is that all the heavy lifting has been done for us. By placing the link in your template, you can take advantage of all the available features. We <a rel="noreferrer noopener" href="https://blog.finxter.com/how-i-created-charts-using-highcharts-js-in-django-web-application/" data-type="post" data-id="1529193" target="_blank">have already demonstrated</a> how to display charts using <code>Highcharts.js</code> in a Django web application.</p>



<p class="wp-block-paragraph">In this tutorial, we will pay attention to <code>Charts.js</code>. Specifically, we will learn:</p>



<ol class="wp-block-list" type="1">
<li>Another way to populate the database other than the ones mentioned while learning how to do so with <code>Highcharts.js</code></li>



<li>How to query the database to display the data structured in such a way that <code>Charts.js</code> can understand.</li>



<li>How to display both bar chart and pie chart</li>
</ol>



<h2 class="wp-block-heading">The Model</h2>



<p class="wp-block-paragraph">For this project, we will use the data from Kaggle<sup>1</sup> that shows the richest people in the world as of 2022. The data contains several columns but we are only interested in just a few of them. Let us create a database model for the dataset.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">from django.db import models

GENDER = (
    ('M', 'Male'),
    ('F', 'Female'),
)

class Richest(models.Model):
    name = models.CharField(max_length=100)
    gender = models.CharField(max_length=1, choices=GENDER)
    net_worth = models.IntegerField()
    country = models.CharField(max_length=100)
    source = models.CharField(max_length=100)

    def __str__(self):
        return self.name
</pre>



<p class="wp-block-paragraph">The model contains names of the richest people in the world, their net worth, country of origin and their source of wealth.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="720" height="405" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-34.png" alt="" class="wp-image-1547023" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-34.png 720w, https://blog.finxter.com/wp-content/uploads/2023/08/image-34-300x169.png 300w" sizes="auto, (max-width: 720px) 100vw, 720px" /></figure>
</div>


<h2 class="wp-block-heading">Populating the database</h2>



<p class="wp-block-paragraph">In the previous tutorial project on creating a chart using <code>Highcharts.js</code>, I showed you one of the ways to populate a database. I wrote a script from the Django shell to populate the database. In this tutorial, we will learn a different method.</p>



<p class="wp-block-paragraph">We will use Django’s <code>BaseCommand</code> class to create a custom management command that populates the database using the dataset.</p>



<p class="wp-block-paragraph">Start by creating new folders inside the app folder. For example, assuming the name of your Django app is charts and is created in your current directory, run the following in your Ubuntu terminal:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">mkdir charts/management/commands -p</pre>



<p class="wp-block-paragraph">The <code>p</code> flag makes it possible to create a nested folder in one command. Inside the <code>commands</code> folder, create a new file named <code>populate_db.py</code>:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">nano charts/management/commands/populate_db.py</pre>



<p class="wp-block-paragraph">let’s first import the required modules:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">from django.core.management.base import BaseCommand
from charts.models import Richest
import csv
import math
</pre>



<p class="wp-block-paragraph"><code>BaseCommand</code>&nbsp;is a class provided by Django that serves as the base class for writing custom management commands. Management commands are scripts that can be run from the command line to perform various tasks related to your Django app.</p>



<p class="wp-block-paragraph">The&nbsp;<code>BaseCommand</code>&nbsp;class provides several useful methods and attributes that make it easy to write custom management commands. When you create a custom management command by subclassing&nbsp;<code>BaseCommand</code>, you need to override the&nbsp;<code>handle</code>&nbsp;method to define the behavior of your command.</p>



<p class="wp-block-paragraph">The&nbsp;<code>handle</code>&nbsp;method is called when the command is executed, and it receives any command-line arguments passed to the command as keyword arguments.</p>



<p class="wp-block-paragraph">In addition to the&nbsp;<code>handle</code>&nbsp;method, the&nbsp;<code>BaseCommand</code>&nbsp;class provides several other methods and attributes that you can use when writing custom management commands.</p>



<p class="wp-block-paragraph">For example, as we shall see, you can use the&nbsp;<code>add_arguments</code>&nbsp;method to define custom command-line arguments for your command, and you can use the&nbsp;<code>stdout</code>&nbsp;and&nbsp;<code>stderr</code>&nbsp;attributes to write output to the Ubuntu terminal.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">class Command(BaseCommand):
    help = 'Populate the database using a CSV file'

    def add_arguments(self, parser):
        parser.add_argument('forbes_2022_billionaires.csv', type=str, help='The path to the CSV file')

    def handle(self, *args, **options):
        csv_file = options['forbes_2022_billionaires.csv']

        with open(csv_file, 'r') as f:
            reader = csv.DictReader(f)
            for row in reader:
                skip_row = False
                for value in row.values():
                    try:
                        if math.isnan(float(value)):
                            skip_row = True
                            break
                    except ValueError:
                        pass
                if skip_row:
                    continue
                net_worth = int(float(row['finalWorth']))
                obj, created = Richest.objects.get_or_create(
                    name=row['personName'],
                    gender=row['gender'],
                    net_worth=net_worth,
                    country=row['countryOfCitizenship'],
                    source=row['source']
                 )

        self.stdout.write(self.style.SUCCESS('Successfully populated the database'))
</pre>



<p class="wp-block-paragraph">We define a new&nbsp;<code>Command</code>&nbsp;class that inherits from&nbsp;<code>BaseCommand</code>.</p>



<p class="wp-block-paragraph">In the <code>add_arguments</code> method, we define a new command-line argument called <code>csv_file</code> that specifies the path to the CSV file. In the <code>handle</code> method, we <a href="https://blog.finxter.com/read-a-csv-file-to-a-pandas-dataframe/" data-type="post" data-id="440655" target="_blank" rel="noreferrer noopener">read the data from the CSV file</a> and use a conditional statement to check if any of the values in the current row are NaN.</p>



<p class="wp-block-paragraph">If any value is NaN, we use the&nbsp;<code>continue</code>&nbsp;statement to skip this row and move on to the next one. Otherwise, we use the&nbsp;<code>get_or_create</code>&nbsp;method to add the data to the database. Finally, we use the&nbsp;<code>self.stdout.write</code>&nbsp;method to print a success message.</p>



<p class="wp-block-paragraph">We use a <a rel="noreferrer noopener" href="https://blog.finxter.com/how-to-write-a-nested-for-loop-in-one-line-python/" data-type="post" data-id="11859" target="_blank">nested loop</a> to iterate over each value in the row. For each value, we use a try-except block to try to convert the value to a float and check if it is NaN. If a <code>ValueError</code> exception occurs, we catch it and ignore it using <a href="https://blog.finxter.com/python-pass-statement/" data-type="post" data-id="29709" target="_blank" rel="noreferrer noopener">the <code>pass</code> statement</a>.</p>



<p class="wp-block-paragraph">If any value in the row is NaN, we set the&nbsp;<code>skip_row</code>&nbsp;variable to&nbsp;<code>True</code>&nbsp;and use the&nbsp;<code>break</code>&nbsp;statement to exit the inner loop. After the inner loop completes, we use an if statement to check if the&nbsp;<code>skip_row</code>&nbsp;variable is&nbsp;<code>True</code>. If it is, we use the&nbsp;<code>continue</code>&nbsp;statement to skip this row and move on to the next one.</p>



<p class="wp-block-paragraph">However, a problem arises from the dataset. The <code>net_worth</code> field is an <code>IntegerField</code>. Whereas, the data type of the <code>finalWorth</code> column is float. To avoid errors, we first convert the value of the <code>net_worth</code> field in the current row to a float using the <code>float</code> function, and then convert it to an integer using the <code>int</code> function. We then assign this integer value to the <code>net_worth</code> field of the <code>Richest</code> model instance using the <code>get_or_create</code> method.</p>



<p class="wp-block-paragraph">Make sure you have the <code>forbes_2022_billionaires.csv</code> file downloaded and placed in your current directory. Then, run the command we defined from the command line using the <code>manage.py</code> script like this:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">python3 manage.py populate_db forbes_2022_billionaires.csv</pre>



<p class="wp-block-paragraph">Afterward, a success message will be displayed. We have populated our database. Open the admin interface to see it.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="720" height="405" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-35.png" alt="" class="wp-image-1547026" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-35.png 720w, https://blog.finxter.com/wp-content/uploads/2023/08/image-35-300x169.png 300w" sizes="auto, (max-width: 720px) 100vw, 720px" /></figure>
</div>


<h2 class="wp-block-heading">Displaying charts using Charts.js</h2>



<p class="wp-block-paragraph">Make sure you have included the <code>Charts.js</code> library in your template by adding the following script tag to the <code>&lt;head></code> section of your HTML file:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;script src="https://cdn.jsdelivr.net/npm/chart.js">&lt;/script></pre>



<p class="wp-block-paragraph">Next, add a <code>&lt;canvas></code> element to your template where you want to display the chart. Give this element an id so you can reference it in your JavaScript code.</p>



<p class="wp-block-paragraph">Here’s an example:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;canvas id="myChart">&lt;/canvas></pre>



<p class="wp-block-paragraph">In this demonstration, we will query the database to:</p>



<ol class="wp-block-list" type="1">
<li>Calculate total net worth of each country</li>



<li>Get the top 10 richest people in the world</li>



<li>Get the top 10 richest women in the world</li>



<li>Get the distribution of wealth by gender</li>
</ol>



<p class="wp-block-paragraph">We will also include a pie chart. You can always check the source code for more details.</p>



<h2 class="wp-block-heading">Displaying the total net worth of each country</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">from django.shortcuts import render
from django.db.models import Sum
from .models import Richest

def TotalNetWorth(request):
    # Query the database to get the data
    data = Richest.objects.values('country').annotate(total_net_worth=Sum('net_worth')).order_by('-total_net_worth')

    # Prepare the data for the chart
    chart_data = []
    for item in data:
        chart_data.append({
            'country': item['country'],
            'total_net_worth': item['total_net_worth']
        })

    # Render the template with the chart data
    return render(request, 'total_net_worth.html', {'chart_data': chart_data})
</pre>



<p class="wp-block-paragraph">We group the data by country using the <code>values</code> method, and using the <code><a href="https://blog.finxter.com/how-i-created-charts-using-highcharts-js-in-django-web-application/" data-type="post" data-id="1529193" target="_blank" rel="noreferrer noopener">annotate</a></code> method, we calculate the total net worth of each country. </p>



<p class="wp-block-paragraph">Next, we prepare the data for the chart by creating a new list called <code>chart_data</code> and appending a dictionary for each item in the query result. </p>



<p class="wp-block-paragraph">Each <a href="https://blog.finxter.com/python-dictionary/" data-type="post" data-id="5232" target="_blank" rel="noreferrer noopener">dictionary</a> contains two keys: <code>'country'</code> and <code>'total_net_worth'</code>, which represent the country and its total net worth, respectively.</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">&lt;script>
    var ctx = document.getElementById('myChart').getContext('2d');
    var chart = new Chart(ctx, {
        type: 'bar',
        data: {
            labels: {{ chart_data|safe }}.map(item => item.country),
            datasets: [{
                label: 'Total Net Worth',
                data: {{ chart_data|safe }}.map(item => item.total_net_worth),
                backgroundColor: 'rgba(54, 162, 235, 0.2)',
                borderColor: 'rgba(54, 162, 235, 1)',
                borderWidth: 1	
            }]
        },
        options: {
            scales: {
                y: {
                    beginAtZero: true
                }
            }
        }
    });
&lt;/script>
</pre>



<p class="wp-block-paragraph">Here, we create a new <code>Chart</code> object and pass it the context of the <code>&lt;canvas></code> element and an options object that specifies the type of chart and its data. </p>



<p class="wp-block-paragraph">We use the <code>chart_data</code> variable passed as context to populate the chart with data. </p>



<p class="wp-block-paragraph">Then, we use the <code>map</code> method to extract the country names and total net worth values from the <code>chart_data</code> and assign them to the <code>labels</code> and <code>data</code> properties of the chart’s datasets.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="720" height="405" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-36.png" alt="" class="wp-image-1547027" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-36.png 720w, https://blog.finxter.com/wp-content/uploads/2023/08/image-36-300x169.png 300w" sizes="auto, (max-width: 720px) 100vw, 720px" /></figure>
</div>


<p class="wp-block-paragraph">Check out the source code for a demonstration of a pie chart. It’s almost the same.</p>



<h2 class="wp-block-heading">Displaying the top ten richest people in the world</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">def TopTenRichest(request):
    # Query the database to get the data
    data = Richest.objects.order_by('-net_worth')[:10]

    # Prepare the data for the chart
    chart_data = []
    for item in data:
        chart_data.append({
            'name': item.name,
            'net_worth': item.net_worth
        })

    # Render the template with the chart data
    return render(request, 'top_ten_richest.html', {'chart_data': chart_data})
</pre>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="720" height="405" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-37.png" alt="" class="wp-image-1547028" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-37.png 720w, https://blog.finxter.com/wp-content/uploads/2023/08/image-37-300x169.png 300w" sizes="auto, (max-width: 720px) 100vw, 720px" /></figure>
</div>


<p class="wp-block-paragraph">The following code shows how to display a pie chart using <code>Charts.js</code>:</p>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">var ctx = document.getElementById('myChart').getContext('2d');
var myChart = new Chart(ctx, {
    type: 'pie',
    data: {
        labels: {{ chart_data|safe }}.map(item => item.name),
        datasets: [{
            label: 'Net Worth',
            data: {{ chart_data|safe }}.map(item => item.net_worth),
            backgroundColor: [
                'rgb(255, 99, 132)',
                'rgb(54, 162, 235)',
                'rgb(255, 205, 86)',
                'rgb(75, 192, 192)',
                'rgb(153, 102, 255)',
                'rgb(255, 159, 64)',
                'rgb(255, 99, 132)',
                'rgb(54, 162, 235)',
                'rgb(255, 205, 86)',
                'rgb(75, 192, 192)'
            ],
            hoverOffset: 4
        }]
    },
    options: {
        title: {
            display: true,
            text: 'Top Ten Richest People'
        }
    }
});
</pre>



<p class="wp-block-paragraph">This code creates a new <code>Chart</code> object and sets its type to <code>'pie'</code>. The data for the chart is taken from the <code>chart_data</code> variable that was passed to the template from <code>TopTenRichest</code> view function. </p>



<p class="wp-block-paragraph">The <code>labels</code> for the chart are set to the names of the richest people, and the data for the chart is set to their net worths.</p>



<p class="wp-block-paragraph">The source code also contains the bar chart example.</p>



<h2 class="wp-block-heading">Displaying the top ten richest women</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">def TopRichestWomen(request):
    data = Richest.objects.filter(gender='F').order_by('-net_worth')[:10]
    names = [item.name for item in data]
    net_worths = [item.net_worth for item in data]
    return render(request, 'top_richest_women.html', {
        'names': names,
        'net_worths': net_worths
    })
</pre>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="720" height="405" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-38.png" alt="" class="wp-image-1547031" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-38.png 720w, https://blog.finxter.com/wp-content/uploads/2023/08/image-38-300x169.png 300w" sizes="auto, (max-width: 720px) 100vw, 720px" /></figure>
</div>


<h2 class="wp-block-heading">Distribution of wealth by gender</h2>



<pre class="EnlighterJSRAW" data-enlighter-language="generic" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">def WealthByGender(request):
    # Query the database to get the total net worth for each gender
    male_net_worth = Richest.objects.filter(gender='M').aggregate(Sum('net_worth'))['net_worth__sum']
    female_net_worth = Richest.objects.filter(gender='F').aggregate(Sum('net_worth'))['net_worth__sum']

    # Prepare the data for the chart
    data = {
        'labels': ['Male', 'Female'],
        'datasets': [{
            'data': [male_net_worth, female_net_worth],
            'backgroundColor': ['#36A2EB', '#FF6384']
        }]
    }

    # Render the chart using the Chart.js library
    return render(request, 'wealth_by_gender.html', {'data': data})
</pre>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="720" height="405" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-39.png" alt="" class="wp-image-1547034" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-39.png 720w, https://blog.finxter.com/wp-content/uploads/2023/08/image-39-300x169.png 300w" sizes="auto, (max-width: 720px) 100vw, 720px" /></figure>
</div>


<p class="wp-block-paragraph">And this is the pie chart. Check the source code for more details:</p>



<h2 class="wp-block-heading">Conclusion</h2>



<p class="wp-block-paragraph">In this project tutorial, we have learned various ways to query our database, structure the data and displayed them using <code>charts.js</code>, a JavaScript library for data visualization. We saw how Django interacts with <code>charts.js</code> to display charts on a template.</p>



<p class="wp-block-paragraph">We also learned another way to populate the database by using Django’s <code>BaseCommand</code> class. Due to the nature of the dataset, we were restricted to only bar and pie charts. However, we can apply the process to create other charts.</p>



<p class="wp-block-paragraph">Use the knowledge you learned to integrate charts in your Django web application.</p>



<ul class="wp-block-list">
<li><a rel="noreferrer noopener" href="https://www.kaggle.com/datasets/prasertk/forbes-worlds-billionaires-list-2022?resource=download" target="_blank">Forbes World&#8217;s Billionaires List 2022 | Kaggle</a></li>
</ul>


<div class="wp-block-image">
<figure class="aligncenter size-large"><a href="https://blog.finxter.com/the-math-of-becoming-a-millionaire/" target="_blank" rel="noreferrer noopener"><img loading="lazy" decoding="async" width="1024" height="618" src="https://blog.finxter.com/wp-content/uploads/2023/08/image-40-1024x618.png" alt="" class="wp-image-1547035" srcset="https://blog.finxter.com/wp-content/uploads/2023/08/image-40-1024x618.png 1024w, https://blog.finxter.com/wp-content/uploads/2023/08/image-40-300x181.png 300w, https://blog.finxter.com/wp-content/uploads/2023/08/image-40-768x463.png 768w, https://blog.finxter.com/wp-content/uploads/2023/08/image-40.png 1363w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></a></figure>
</div>


<p class="has-base-background-color has-background wp-block-paragraph"><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2705.png" alt="✅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> <strong>Recommended</strong>: <a href="https://blog.finxter.com/the-math-of-becoming-a-millionaire/" data-type="URL" data-id="https://blog.finxter.com/the-math-of-becoming-a-millionaire/" target="_blank" rel="noreferrer noopener">The Math of Becoming a Millionaire in 13 Years</a></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Minified using Disk

Served from: blog.finxter.com @ 2026-10-29 08:32:12 by W3 Total Cache
-->