Giter Site home page Giter Site logo

matheusfelipeog / worldometer Goto Github PK

View Code? Open in Web Editor NEW
55.0 2.0 9.0 864 KB

Get live, population, geography, projected, and historical data from around the world ๐ŸŒ

Home Page: https://worldometer.readthedocs.io

License: MIT License

Python 100.00%
worldometer worldometers worldometer-scraping worldometer-api scraping api python pypi mit-license world

worldometer's Introduction

Art with MF logo (Matheus Felipe) to the top of readme.md

Hi, Human ๐Ÿ––

I'm Matheus, a developer passionate about this amazing world of technology.

Welcome to my GitHub, here you will find my projects and my collaborations for the open source world.


You can find me or contact me through these networks:

LinkedIn Badge Twitter Badge

Telegram Badge ProtonMail Badge

You can also support me financially via:

PayPal Badge PIX of Nubank Badge


More about me

I'm a self-taught student, introverted and very observant.
I'm currently contributing to the open source world to put into practice the knowledge acquired in my studies. I also help the guys who are starting programming in the communities.

  • ๐ŸŽ“ Technician in System Development by ETEC
  • ๐ŸŽฏ Contribute and create open source projects
  • ๐Ÿ“š I'm studying Python | Algorithms | Dev Web | English
  • ๐Ÿ’ฌ You can ask me questions, I like to help!
  • ๐ŸŒ‘ Observing space
  • ๐ŸŽฎ Find me in the gaming world: TheuzzLivee
My GitHub stats

Trophies GitHub

General Statistics

Streak Stats

Techs used in projects

Activity Graph

Art for footer readme.md

worldometer's People

Contributors

dependabot[bot] avatar imgbotapp avatar matheusfelipeog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

worldometer's Issues

Issue with integrating this api in Django

My issue occurs 80% of the time I start my server.

At the moment this line gets executed "from worldometer import api", my server gets frozen and gives this error:
Exception: There is no current event loop in thread 'django-main-thread'.

I've tried all possible solutions and yet no solution has worked .

Import Error

I want to use worldometer lib, but there is an import error in the below :

"Exception: HTTPSConnectionPool(host='www.worldometers.info', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)')))"

When i try to import worldometer, i receivess the exception

Issue with "sanitize_metrics" method.

code:

api.get_metric_of(label='computers_produced_this_year')

Errors:
..\worldoMeter.venv\Lib\site-packages\worldometer\core.py", line 181, in init
self._metrics = self.collect_metrics()
^^^^^^^^^^^^^^^^^^^^^^
..\worldoMeter.venv\Lib\site-packages\worldometer\core.py", line 305, in collect_metrics
sanitized_metrics = self.sanitize_metrics(metric_list=metrics)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
..\worldoMeter.venv\Lib\site-packages\worldometer\core.py", line 283, in sanitize_metrics
found = re.search(r'[0-9,]+', metric).group()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'group'

Looks like the error is originating from the "sanitize_metrics" method in the "core.py" file of the package.

Import "requests_html" could not be resolved

how to solve this problem

[Running] python -u "f:\ggh\worldometer-master\worldometer\api.py"
Traceback (most recent call last):
File "f:\ggh\worldometer-master\worldometer\api.py", line 103, in
from .core import Worldometer
ImportError: attempted relative import with no known parent package

[Done] exited with code=1 in 0.771 seconds

Cannot extract daily data?

I am using worldometer api to extract daily data but it seems the api doesn't have any option to extract some daily data or am I missing something? Please let me know what I can do to extract daily data?

Problem with Importing and Crashing.

worldometer.current_world_population()
Traceback (most recent call last):
File "", line 1, in
NameError: name 'worldometer' is not defined
from worldometer import Worldometer
Traceback (most recent call last):
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/worldometer/core.py", line 234, in _get_html
self.__r.html.render(timeout=self.__timeout)
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/requests_html.py", line 586, in render
self.browser = self.session.browser # Automatically create a event loop and browser
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/requests_html.py", line 730, in browser
self._browser = self.loop.run_until_complete(super().browser)
File "/nix/store/2vm88xw7513h9pyjyafw32cps51b0ia1-python3-3.8.12/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/requests_html.py", line 714, in browser
self._browser = await pyppeteer.launch(ignoreHTTPSErrors=not(self.verify), headless=True, args=self.__browser_args)
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/pyppeteer/launcher.py", line 307, in launch
return await Launcher(options, **kwargs).launch()
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/pyppeteer/launcher.py", line 168, in launch
self.browserWSEndpoint = get_ws_endpoint(self.url)
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/pyppeteer/launcher.py", line 227, in get_ws_endpoint
raise BrowserError('Browser closed unexpectedly:\n')
pyppeteer.errors.BrowserError: Browser closed unexpectedly:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/worldometer/init.py", line 84, in
from .api import *
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/worldometer/api.py", line 108, in
__w = Worldometer()
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/worldometer/core.py", line 181, in init
self._metrics = self.collect_metrics()
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/worldometer/core.py", line 300, in collect_metrics
html = self._get_html(url=URL)
File "/home/runner/Worldmeter/venv/lib/python3.8/site-packages/worldometer/core.py", line 239, in _get_html
raise Exception(err)
Exception: Browser closed unexpectedly:

This is the error

Issue when running program

I have a main.py file that imports worldometer and tries to communicate with worldometer. But, when I run main.py, I get the error below

Traceback (most recent call last):
  File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\worldometer\core.py", line 234, in _get_html
    self.__r.html.render(timeout=self.__timeout)
  File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\requests_html.py", line 598, in render
    content, result, page = self.session.loop.run_until_complete(self._async_render(url=self.url, script=script, sleep=sleep, wait=wait, content=self.html, reload=reload, scrolldown=scrolldown, timeout=timeout, keep_page=keep_page))
  File "c:\users\gigabyte\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\requests_html.py", line 512, in _async_render
    await page.goto(url, options={'timeout': int(timeout * 1000)})
  File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\pyppeteer\page.py", line 885, in goto
    raise error
pyppeteer.errors.TimeoutError: Navigation Timeout Exceeded: 30000 ms exceeded.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:/Users/Gigabyte/PycharmProjects/pythonProject1/main.py", line 1, in <module>
    import worldometer
  File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\worldometer\__init__.py", line 84, in <module>
    from .api import *
  File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\worldometer\api.py", line 108, in <module>
    __w = Worldometer()
  File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\worldometer\core.py", line 181, in __init__
    self._metrics = self.collect_metrics()
  File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\worldometer\core.py", line 300, in collect_metrics
    html = self._get_html(url=URL)
  File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\worldometer\core.py", line 239, in _get_html
    raise Exception(err)
Exception: Navigation Timeout Exceeded: 30000 ms exceeded.
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\pyppeteer\launcher.py", line 219, in killChrome
    self._cleanup_tmp_user_data_dir()
  File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\pyppeteer\launcher.py", line 134, in _cleanup_tmp_user_data_dir
    raise IOError('Unable to remove Temporary User Data')
OSError: Unable to remove Temporary User Data

Navigation Timeout Exceeded Error

I am getting the following error when I try to run the main.py script:

from worldometer import Worldometer

w = Worldometer()

w.what_is_here()

Exception: Navigation Timeout Exceeded: 30000 ms exceeded.

import worldometer error

I have found a problem that is, I can't import worldometer to notebooks.

Env: anaconda3, WSL
Version: Python 3.8.3, worldometer-1.0.1

The full error response is:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
~/anaconda3/lib/python3.8/site-packages/worldometer/core.py in _get_html(self, url)
    233             self.__r = session.get(url, timeout=self.__timeout)
--> 234             self.__r.html.render(timeout=self.__timeout)
    235 

~/anaconda3/lib/python3.8/site-packages/requests_html.py in render(self, retries, script, wait, scrolldown, sleep, reload, timeout, keep_page)
    585 
--> 586         self.browser = self.session.browser  # Automatically create a event loop and browser
    587         content = None

~/anaconda3/lib/python3.8/site-packages/requests_html.py in browser(self)
    728             if self.loop.is_running():
--> 729                 raise RuntimeError("Cannot use HTMLSession within an existing event loop. Use AsyncHTMLSession instead.")
    730             self._browser = self.loop.run_until_complete(super().browser)

RuntimeError: Cannot use HTMLSession within an existing event loop. Use AsyncHTMLSession instead.

During handling of the above exception, another exception occurred:

Exception                                 Traceback (most recent call last)
<ipython-input-3-c4b22f2d5ddf> in <module>
----> 1 import worldometer

~/anaconda3/lib/python3.8/site-packages/worldometer/__init__.py in <module>
     82 
     83 from .core import Worldometer
---> 84 from .api import *

~/anaconda3/lib/python3.8/site-packages/worldometer/api.py in <module>
    106 
    107 
--> 108 __w = Worldometer()
    109 
    110 

~/anaconda3/lib/python3.8/site-packages/worldometer/core.py in __init__(self, timeout)
    179         self.__timeout = timeout
    180 
--> 181         self._metrics = self.collect_metrics()
    182 
    183     def __str__(self):

~/anaconda3/lib/python3.8/site-packages/worldometer/core.py in collect_metrics(self)
    298 
    299         if self.__r is None:
--> 300             html = self._get_html(url=URL)
    301         else:
    302             html = self.__r.html.raw_html

~/anaconda3/lib/python3.8/site-packages/worldometer/core.py in _get_html(self, url)
    237 
    238         except Exception as err:
--> 239             raise Exception(err)
    240 
    241     @staticmethod

Exception: Cannot use HTMLSession within an existing event loop. Use AsyncHTMLSession instead.

I thinks this is one of a limitation of WSL hence hope anyone find out the solution soon.

Issue when running program

I have a main.py file that imports worldometer and tries to communicate with worldometer. But, when I run main.py, I get the error below

Traceback (most recent call last):
File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\worldometer\core.py", line 234, in _get_html
self.__r.html.render(timeout=self.__timeout)
File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\requests_html.py", line 598, in render
content, result, page = self.session.loop.run_until_complete(self._async_render(url=self.url, script=script, sleep=sleep, wait=wait, content=self.html, reload=reload, scrolldown=scrolldown, timeout=timeout, keep_page=keep_page))
File "c:\users\gigabyte\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\requests_html.py", line 512, in _async_render
await page.goto(url, options={'timeout': int(timeout * 1000)})
File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\pyppeteer\page.py", line 885, in goto
raise error
pyppeteer.errors.TimeoutError: Navigation Timeout Exceeded: 30000 ms exceeded.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:/Users/Gigabyte/PycharmProjects/pythonProject1/main.py", line 1, in
import worldometer
File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\worldometer_init_.py", line 84, in
from .api import *
File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\worldometer\api.py", line 108, in
__w = Worldometer()
File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\worldometer\core.py", line 181, in init
self._metrics = self.collect_metrics()
File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\worldometer\core.py", line 300, in collect_metrics
html = self._get_html(url=URL)
File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\worldometer\core.py", line 239, in _get_html
raise Exception(err)
Exception: Navigation Timeout Exceeded: 30000 ms exceeded.
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\pyppeteer\launcher.py", line 219, in killChrome
self._cleanup_tmp_user_data_dir()
File "C:\Users\Gigabyte\PycharmProjects\pythonProject1\venv\lib\site-packages\pyppeteer\launcher.py", line 134, in _cleanup_tmp_user_data_dir
raise IOError('Unable to remove Temporary User Data')
OSError: Unable to remove Temporary User Data

Suggestion for adding temperature module

First of all, thank you for this module and your hard work. Now I want a real-time temperature list of Global city to help the public understand climate change. If you have time, can you increase it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.