<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ebram Shehata</title>
    <description>The latest articles on DEV Community by Ebram Shehata (@ebram96).</description>
    <link>https://dev.to/ebram96</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F759985%2Fea100e0b-e089-45e3-a9df-29a31050970f.png</url>
      <title>DEV Community: Ebram Shehata</title>
      <link>https://dev.to/ebram96</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ebram96"/>
    <language>en</language>
    <item>
      <title>Abstract API Python SDK</title>
      <dc:creator>Ebram Shehata</dc:creator>
      <pubDate>Sat, 20 Jan 2024 00:14:56 +0000</pubDate>
      <link>https://dev.to/ebram96/abstract-api-python-sdk-4jkl</link>
      <guid>https://dev.to/ebram96/abstract-api-python-sdk-4jkl</guid>
      <description>&lt;p&gt;I'm excited :) to share about my open source Python library I created to help with using &lt;a href="https://www.abstractapi.com/" rel="noopener noreferrer"&gt;AbstractAPI&lt;/a&gt; services.&lt;br&gt;
What can you do with the library? It supports using all current AbstractAPI services:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Email validation&lt;/li&gt;
&lt;li&gt;Phone number validation&lt;/li&gt;
&lt;li&gt;IP geolocation&lt;/li&gt;
&lt;li&gt;Lookup holidays of a country on a specific date or date range.&lt;/li&gt;
&lt;li&gt;VAT validation/calculation/categories&lt;/li&gt;
&lt;li&gt;IBAN validation&lt;/li&gt;
&lt;li&gt;Exchange Rates live/conversion/historical rates&lt;/li&gt;
&lt;li&gt;Lookup company data using only its domain&lt;/li&gt;
&lt;li&gt;Timezone current/conversion&lt;/li&gt;
&lt;li&gt;Avatars generation&lt;/li&gt;
&lt;li&gt;Website screenshot&lt;/li&gt;
&lt;li&gt;Website scrape&lt;/li&gt;
&lt;li&gt;Image processing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It supports Python &amp;gt;= 3.9 and it is tested on all environments from 3.9 up to 3.12. Tests are run automatically on all supported Python versions by a CI workflow.&lt;/p&gt;

&lt;p&gt;Check it and maybe give a star? :)&lt;br&gt;
Repo: &lt;a href="https://github.com/ebram96/AbstractAPI-Python-SDK" rel="noopener noreferrer"&gt;https://github.com/ebram96/AbstractAPI-Python-SDK&lt;/a&gt;&lt;br&gt;
Doc: &lt;a href="https://abstractapi-python-sdk.readthedocs.io/en/latest/" rel="noopener noreferrer"&gt;https://abstractapi-python-sdk.readthedocs.io/en/latest/&lt;/a&gt;&lt;br&gt;
Package: &lt;a href="https://pypi.org/project/abstract-api/" rel="noopener noreferrer"&gt;https://pypi.org/project/abstract-api/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Contributions are very welcome.&lt;/p&gt;

</description>
      <category>python</category>
      <category>api</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Checking Whether a Celery Task is Already Running</title>
      <dc:creator>Ebram Shehata</dc:creator>
      <pubDate>Tue, 07 Mar 2023 01:58:00 +0000</pubDate>
      <link>https://dev.to/ebram96/checking-whether-a-celery-task-is-already-running-59f4</link>
      <guid>https://dev.to/ebram96/checking-whether-a-celery-task-is-already-running-59f4</guid>
      <description>&lt;p&gt;Ever tried to check whether a Celery task is already running?&lt;br&gt;
Here is the piece of code I created for checking whether a task is running by its name.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;celery&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;current_app&lt;/span&gt;


&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CeleryHelper&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Contains helper functionalities to be used while interacting with Celery.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="nd"&gt;@staticmethod&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;is_being_executed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Returns whether the task with given task_name is already being executed.

        Args:
            task_name: Name of the task to check if it is running currently.
        Returns: A boolean indicating whether the task with the given task name is
            running currently.
        &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;active_tasks&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;current_app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;control&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;inspect&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;active&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;worker&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;running_tasks&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;active_tasks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;running_tasks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;name&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;task_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;False&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I searchedd for that a while ago and I couldn't really find a direct way to do that in a Django project but the above code is tested and works in Django-based projects.&lt;/p&gt;

</description>
      <category>python</category>
      <category>django</category>
      <category>celery</category>
    </item>
  </channel>
</rss>
