Giter Site home page Giter Site logo

bonzanini / book-socialmediaminingpython Goto Github PK

View Code? Open in Web Editor NEW
539.0 73.0 311.0 5 MB

Companion code for the book "Mastering Social Media Mining with Python"

Python 98.92% CSS 0.11% HTML 0.97%
python paperback data-science data-mining data-visualization twitter-api facebook-api natural-language-processing ebook

book-socialmediaminingpython's People

Contributors

bonzanini 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

book-socialmediaminingpython's Issues

ImportError: cannot import name 'API' from 'tweepy' (unknown location)

Hi I am using a 2020 mac book air

I am getting this error the same issue was closed but it worked on Windows.
I am using the recent Twitter API.

/Users/apple/project/Mining-twitter-data-with-pyth
on/Tweet/my_env/bin/python /Users/apple/project/Mining-twitter-data-with-python/Tweet/tw
itter_get_home_timeline.py
Traceback (most recent call last):
File "/Users/apple/project/Mining-twitter-data-with-python/Tweet/twitter_get_home_timeline.py", line 14, in
from twitter_client import get_twitter_client
File "/Users/apple/project/Mining-twitter-data-with-python/Tweet/twitter_client.py", line 11, in
from tweepy import API
ImportError: cannot import name 'API' from 'tweepy' (unknown location)

twitter_get_user modify limits ? and how to run the code in jupyter notebook ?

hello my friend @bonzanini am having a problem with this script on how i can control the amount followers or friends as twitter restricting the amount i can have so the script never finish the process it stop on getting followers and telling me that i exceed the limits ?
also i want to be able to write the user i want to track and folder name , within the code it self , what code line should i modify to be able to do this ? this is very important for me as am using the code in juypter notebook ,
and is there a magic command or any command that i can write it in jupyter to simulate the running script process , something like writing python twitter_get_user 'userName' withing the cell in juypter notebook ,
to save the affort and time in modifying the code so that it can be run in juypter notebook cell
thank very much for your work sir :)

TWITTER_* environment variables not set

Hi:

I am having a problem setting the twitter keys. I have went over this issue many times entering the code word for word from the book. I also tried using the code code you have that can be downloaded. From the CMD, I made sure I navigated to the book files and folder with the twitter_get_home_timeline.py
and twitter_client.py files. Then I entered in my twitter keys one at a time:

set TWITTER_CONSUMER_KEY="your-consumer-key"
set TWITTER_CONSUMER_SECRET="your-consumer-secret"
set TWITTER_ACCESS_TOKEN="your-access-token"
set TWITTER_ACCESS_TOKEN_SECRET="your-access-token-secret"

I even tried leaving in the quotes around the keys to see what would happen. But I would still get this error:

TWITTER_* environment variables not set

I am using Windows 10 Pro, actually a clean copy as of yesterday. However, I was having the problem prior to that install.
Unlike the book instructions, I am not virtual environment but I would not think that would make a difference but you never know.
The only thing I can think of is the problem is with Tweepy perhaps? Let me know what you think?

Thanks,
Drew

twitter_get_user_timeline.py

I'm able to run get_home_timeline.py but user_timeline erros with the following. Any guidance is appreciated.

runfile('C:/Users/chris/Documents/DataMiningWithPython/Book-SocialMediaMiningPython-master/Chap02-03/twitter_get_user_timeline.py', wdir='C:/Users/chris/Documents/DataMiningWithPython/Book-SocialMediaMiningPython-master/Chap02-03')
Reloaded modules: twitter_client
sys argv: ['C:/Users/chris/Documents/DataMiningWithPython/Book-SocialMediaMiningPython-master/Chap02-03/twitter_get_user_timeline.py']
Usage:
python C:/Users/chris/Documents/DataMiningWithPython/Book-SocialMediaMiningPython-master/Chap02-03/twitter_get_user_timeline.py
An exception has occurred, use %tb to see the full traceback.

SystemExit: 1

C:\Users\chris\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py:2889: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)

Fedora 25 gensim pip error

I'm trying to install this on Fedora 25. I have pip3 instead of just pip as both Python 2 and Python 3 are installed by default.

I got the following error when running the pip3 install -r requirements.txt command:

Collecting gensim==0.13.1 (from -r requirements.txt (line 11))
  Downloading gensim-0.13.1.tar.gz (4.2MB)
    100% |████████████████████████████████| 4.2MB 312kB/s 
    Complete output from command python setup.py egg_info:
    non-existing path in 'numpy/distutils': 'site.cfg'
    Could not locate executable gfortran
    Could not locate executable f95
    Could not locate executable ifort
    Could not locate executable ifc
    Could not locate executable lf95
    Could not locate executable pgfortran
    Could not locate executable f90
    Could not locate executable f77
    Could not locate executable fort
    Could not locate executable efort
    Could not locate executable efc
    Could not locate executable g77
    Could not locate executable g95
    Could not locate executable pathf95
    don't know how to compile Fortran code on platform 'posix'
    gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
    Running from numpy source directory.
    /tmp/easy_install-o9k9n2qu/numpy-1.12.0/setup.py:366: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
      run_build = parse_setuppy_commands()
    /tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/system_info.py:572: UserWarning:
        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      self.calc_info()
    /tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/system_info.py:572: UserWarning:
        Blas (http://www.netlib.org/blas/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [blas]) or by setting
        the BLAS environment variable.
      self.calc_info()
    /tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/system_info.py:572: UserWarning:
        Blas (http://www.netlib.org/blas/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [blas_src]) or by setting
        the BLAS_SRC environment variable.
      self.calc_info()
    /tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/system_info.py:572: UserWarning:
        Lapack (http://www.netlib.org/lapack/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [lapack]) or by setting
        the LAPACK environment variable.
      self.calc_info()
    /tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/system_info.py:572: UserWarning:
        Lapack (http://www.netlib.org/lapack/) sources not found.
        Directories to search for the sources can be specified in the
        numpy/distutils/site.cfg file (section [lapack_src]) or by setting
        the LAPACK_SRC environment variable.
      self.calc_info()
    /usr/lib64/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution option: 'define_macros'
      warnings.warn(msg)
    Traceback (most recent call last):
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 157, in save_modules
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 65, in save_path
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 56, in save_argv
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 83, in override_temp
        yield
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 93, in pushd
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 255, in run_setup
        DirectorySandbox(setup_dir).run(runner)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 285, in run
        return func()
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 253, in runner
        _execfile(setup_script, ns)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 47, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/setup.py", line 391, in <module>
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/setup.py", line 383, in setup_package
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/core.py", line 169, in setup
      File "/usr/lib64/python3.5/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib64/python3.5/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib64/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/bdist_egg.py", line 152, in run
        self.run_command("egg_info")
      File "/usr/lib64/python3.5/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/egg_info.py", line 18, in run
      File "/usr/lib64/python3.5/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 148, in run
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 159, in build_sources
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 294, in build_library_sources
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 377, in generate_sources
      File "numpy/core/setup.py", line 665, in get_mathlib_info
    RuntimeError: Broken toolchain: cannot link a simple C program
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-fib1zbop/gensim/setup.py", line 189, in <module>
        include_package_data=True,
      File "/usr/lib64/python3.5/distutils/core.py", line 108, in setup
        _setup_distribution = dist = klass(attrs)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/dist.py", line 317, in __init__
        self.fetch_build_eggs(attrs['setup_requires'])
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/dist.py", line 372, in fetch_build_eggs
        replace_conflicting=True,
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 851, in resolve
        dist = best[req.key] = env.best_match(req, ws, installer)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1123, in best_match
        return self.obtain(req, installer)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/pkg_resources/__init__.py", line 1135, in obtain
        return installer(requirement)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/dist.py", line 440, in fetch_build_egg
        return cmd.easy_install(req)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 674, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 636, in _tmpdir
        yield str(tmpdir)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 674, in easy_install
        return self.install_item(spec, dist.location, tmpdir, deps)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 700, in install_item
        dists = self.install_eggs(spec, download, tmpdir)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 881, in install_eggs
        return self.build_and_install(setup_script, setup_base)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 1120, in build_and_install
        self.run_setup(setup_script, setup_base, args)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/easy_install.py", line 1106, in run_setup
        run_setup(setup_script, args)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 258, in run_setup
        raise
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 181, in save_pkg_resources_state
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 169, in save_modules
        saved_exc.resume()
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 144, in resume
        six.reraise(type, exc, self._tb)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/six.py", line 685, in reraise
        raise value.with_traceback(tb)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 157, in save_modules
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 65, in save_path
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 56, in save_argv
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 83, in override_temp
        yield
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/usr/lib64/python3.5/contextlib.py", line 77, in __exit__
        self.gen.throw(type, value, traceback)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 93, in pushd
        yield saved
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 198, in setup_context
        yield
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 255, in run_setup
        DirectorySandbox(setup_dir).run(runner)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 285, in run
        return func()
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 253, in runner
        _execfile(setup_script, ns)
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/sandbox.py", line 47, in _execfile
        exec(code, globals, locals)
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/setup.py", line 391, in <module>
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/setup.py", line 383, in setup_package
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/core.py", line 169, in setup
      File "/usr/lib64/python3.5/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib64/python3.5/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib64/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/ian/Book-SocialMediaMiningPython/book_env/lib/python3.5/site-packages/setuptools/command/bdist_egg.py", line 152, in run
        self.run_command("egg_info")
      File "/usr/lib64/python3.5/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/egg_info.py", line 18, in run
      File "/usr/lib64/python3.5/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib64/python3.5/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 148, in run
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 159, in build_sources
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 294, in build_library_sources
      File "/tmp/easy_install-o9k9n2qu/numpy-1.12.0/numpy/distutils/command/build_src.py", line 377, in generate_sources
      File "numpy/core/setup.py", line 665, in get_mathlib_info
    RuntimeError: Broken toolchain: cannot link a simple C program
    gcc: error: /usr/lib/rpm/redhat/redhat-hardened-cc1: No such file or directory
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-fib1zbop/gensim/

micro_geo2kml.py errors when run

Hi,
while executing the python file micro_geo2kml.py I found many errors
first for loop in the line 39, can't accept the argument.
in the line 40 for the same reson
image

micro_geo2kml.py errors when run

again when running the updated version of the script it throws this error
Traceback (most recent call last):
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\connection.py", line 60, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
chunked=chunked)
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 345, in _make_request
self._validate_conn(conn)
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 844, in _validate_conn
conn.connect()
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connection.py", line 284, in connect
conn = self._new_conn()
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connection.py", line 150, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x036D7E70>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\adapters.py", line 449, in send
timeout=timeout
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\connectionpool.py", line 649, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\urllib3\util\retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='en.wikipedia.org%20', port=443): Max retries exceeded with url: /wiki/List_of_United_States_cities_by_population (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x036D7E70>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "micro_geo2kml.py", line 36, in
doc = mf2py.parse(url=args.url)
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mf2py\parser.py", line 44, in parse
return Parser(doc, url, html_parser, img_with_alt).to_dict()
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\mf2py\parser.py", line 96, in init
'User-Agent': self.useragent,
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:\Users\Peter Samoaa\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests\adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='en.wikipedia.org%20', port=443): Max retries exceeded with url: /wiki/List_of_United_States_cities_by_population (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x036D7E70>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

twitter_time_series.py error when run

Using Windows 10 , python 3.5.3
Chapter 2-3.
When I run the twitter_time_series.py (with the following argument -python twitter_time_series.py stream__RWC2015__RWCFinal_Rugby.jsonl ) I am getting the following error
image
Why is the jsonl file not read?

Program

Do you program script that can manage 2000 facebook account for likes and shares and comments??

Always get Twitter Environment Variable Not set

Hi, I feel a bit silly asking really but here is the issue. I have the code as documented for the twitter_client.py and the home_timeline.py (copied and pasted the code to eradicate any errors caused by my fingers).

I have these two files in the same folder as advised. I am on a Mac and have my /etc/paths with:

export TWITTER_CONSUMER_KEY="my_key_here" and so on for all 4 variables. I have also tried this without 'export' at the front.

When I run the twitter_client.py file by itself, I get no errors, but when I then run home_timeline.py it throws the error "TWITTER_* environment variables not set".

Printing out os.environ shows the keys + secrets as expected. I'm going round in circles trying to nail down where the issue lies so I would be very grateful for any help!

Thanks,
Peter

uncomplete tweet text obtained

Hi, I wonder why the tweet we obtained using source code in chapter2 is uncomplete, almost 100 characters or so end with the tweet link. Is this the shortcoming by using api?
look forward for ur reply, thanks

stream example file .raise ConnectionError(err, request=request)

hello @bonzanini first of all , thanks for your great book , its really really useful book ,
i have many question but for now it will be in the twitter stream example , plz forgive me if any of them seem naive ,
when i use stream example , give me the error above ,
here 's a photo
stream2
am using python 3 by the way
and by the way , what is 'rugby' for , i thought its because of the name of file , but it was only part of the file name , in the book said its a key word , but i couldn't understand it-why keyword with hashtag'? , thanks any way

How to filter tweets (status) by attributes?

Hello!
I'm working on an academic project based on Twitter data collecting. Before generating the JSON with tweets from a chosen user, like in twitter_get_user_timeline.py I'd like to select only tweets created in a certain day.
How do I do that?

  for status in page:
       if status.created_at like Mon Sep 10:
                f.write(json.dumps(status._json)+"\n")

Is that close?
Thanks

Getting tweets from the timeline C2 code

Working through the book and testing the code, I get the error below "No module named twitter_client"
Can't seem to find the solution anywhere. Any help is appreciated!

from twitter_client import get_twitter client

ImportError Traceback (most recent call last)
in ()
----> 1 from twitter_client import get_twitter_client

ImportError: No module named twitter_client

ImportError: No module named 'twitter_client'

Hello,
I know someone else brought up this issue, but I can't tell that is was resolved. I am running the code provided with the book, and continue to get this message when attempting to retrieve tweets from the timeline. I'm using python 3.6. Your assistance is much appreciated. Thank you.

twitter_get_user_timeline code example , encode problem with Araic tweets

hello sir @bonzanini , in all of your scripts , when i deal with arabic tweets i get it encoded, for example, twitter_get_user_timeline to get an arabin user tweets , all arab words , in any entity include ,text or user name , etc .. ,
encoded like this : \u0627\u0644\u0646\u0627\u0633 \u062f\u064a \u0639\u0627\u064a\u0634\u0647 \u0644\u064a\u0647
help me plz thank you in advance its by the way in the most of all the scripts .thanks for all your great work ,
am using python 3 by the way .

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.