<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>python | rael.io</title><link>https://rael.io/tags/python/</link><atom:link href="https://rael.io/tags/python/index.xml" rel="self" type="application/rss+xml"/><description>python</description><generator>Source Themes Academic (https://sourcethemes.com/academic/)</generator><language>en-us</language><copyright>Fork me on [GitHub](https://github.com/raelga/rael.io)</copyright><lastBuildDate>Tue, 06 Mar 2018 11:23:56 +0200</lastBuildDate><image><url>https://rael.io/img/photos/emma-hello-card.jpg</url><title>python</title><link>https://rael.io/tags/python/</link></image><item><title>Jupyter Image Extractor</title><link>https://rael.io/project/jupyter-image-extractor/</link><pubDate>Tue, 06 Mar 2018 11:23:56 +0200</pubDate><guid>https://rael.io/project/jupyter-image-extractor/</guid><description>
&lt;p&gt;Parses a Jupyter book html and extracts the images.&lt;/p&gt;
&lt;h2 id=&#34;build&#34;&gt;Build&lt;/h2&gt;
&lt;p&gt;Build the container:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;ellie:ws rael$ make docker-build
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Expected output:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;docker build . -t &#39;jupyter-image-extractor&#39;
Sending build context to Docker daemon 12.46MB
Step 1/1 : FROM python:3-onbuild
# Executing 3 build triggers
---&amp;gt; Running in be4957e8a2d2
Collecting beautifulsoup4 (from -r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/9e/d4/10f46e5cfac773e22707237bfcd51bbffeaf0a576b0a847ec7ab15bd7ace/beautifulsoup4-4.6.0-py3-none-any.whl (86kB)
Installing collected packages: beautifulsoup4
Successfully installed beautifulsoup4-4.6.0
Removing intermediate container be4957e8a2d2
---&amp;gt; 2b1181b0bde2
Successfully built 2b1181b0bde2
Successfully tagged jupyter-image-extractor:latest
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;execute&#34;&gt;Execute&lt;/h2&gt;
&lt;p&gt;Run the script with docker:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;ellie:ws rael$ make docker-run
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Expected output:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;docker run -it --rm --name &#39;jupyter-image-extractor&#39; -v &amp;quot;/Users/rael/Documents/Code/python/ws:/code&amp;quot; -w /code &#39;jupyter-image-extractor&#39; python jupyterImageSaver.py Jupyter\ Notebook\ Viewer.html
./Jupyter Notebook Viewer_files/nav_logo.svg
./images/base64-img-1.png
./images/base64-img-2.png
./images/base64-img-3.png
./images/base64-img-4.png
./images/base64-img-5.png
./images/base64-img-6.png
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>PyBot</title><link>https://rael.io/project/pybot/</link><pubDate>Thu, 02 Mar 2017 11:23:56 +0200</pubDate><guid>https://rael.io/project/pybot/</guid><description>
&lt;p&gt;&lt;a href=&#34;https://circleci.com/gh/raelga/pybot/tree/master&#34; target=&#34;_blank&#34;&gt;&lt;img src=&#34;https://circleci.com/gh/raelga/pybot/tree/master.svg?style=svg&#34; alt=&#34;CircleCI&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1 id=&#34;pybot&#34;&gt;pybot&lt;/h1&gt;
&lt;p&gt;Wrapper for &lt;a href=&#34;https://github.com/python-telegram-bot/python-telegram-bot&#34; target=&#34;_blank&#34;&gt;python-telegram-bot&lt;/a&gt; to allow dynamic plug-in architecture, an attempt to make python-telegram-bot more hubottish.&lt;/p&gt;
&lt;h3 id=&#34;execution-flow&#34;&gt;Execution flow&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;bin/pybot&lt;/code&gt; starts the bot with the selected adapter and using the configuration options defined in &lt;code&gt;conf/pybot.conf&lt;/code&gt; or the command-line arguments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The selected adapter receives the message and sends it to the &lt;code&gt;brain.py&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;brain.py&lt;/code&gt; loads in runtime all the &lt;code&gt;.py&lt;/code&gt; files in the &lt;code&gt;./memory&lt;/code&gt; folder each time and try to execute a defined method, for example &lt;code&gt;hear(message.text)&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Each module in &lt;code&gt;./memory&lt;/code&gt; with that method returns a response, the &lt;code&gt;brain.py&lt;/code&gt; sends it to the &lt;code&gt;pybot.py&lt;/code&gt; and it sends the response back to the chat.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;ul&gt;
&lt;li&gt;As the methods are dynamically loaded, you can edit and add the files in &lt;code&gt;./memory&lt;/code&gt; without need to restart &lt;code&gt;pybot.py&lt;/code&gt;, and they will be reloaded on the next message. Overkill but funny.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;makefile-targets&#34;&gt;Makefile targets&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&#34;language-Makefile&#34;&gt;usage: Show this help
setup-venv: Setup virtualenv
lint: Run code linter to check code style
telegram: Run pybot with the telegram adapter
docker-build: Build the docker image for running pybot
docker-telegram: Run with telegram adapter in the docker container
docker-lint: Run pep8 in the docker container
docker-clean: Remove the docker image
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;execution-example&#34;&gt;Execution example&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&#34;language-bash&#34;&gt;make docker-telegram
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;docker run -it --rm --name pybot -v /Users/rael/Code/python/pybot:/usr/src/pybot -w /usr/src/pybot &#39;pybot&#39; bin/pybot telegram
Starting pybot using conf token file. CTRL-C to quit.
2017-04-17 07:35:54,392 - pybot.interfaces.telegram - INFO - Bot raelbot up and ready!
2017-04-17 07:36:39,371 - pybot.brain - INFO - 116133952, Hello world!, 53693428, 2017-04-17 07:36:39,&amp;quot;53693428&amp;quot;;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;contributing&#34;&gt;Contributing&lt;/h3&gt;
&lt;p&gt;Contributions of all sizes are welcome.&lt;/p&gt;
&lt;h3 id=&#34;attributions&#34;&gt;Attributions&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Header image from &lt;a href=&#34;https://python-telegram-bot.org&#34; target=&#34;_blank&#34;&gt;python-telegram-bot.org&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;license&#34;&gt;License&lt;/h3&gt;
&lt;p&gt;You may copy, distribute and modify the software provided that modifications are described and licensed for free under &lt;code&gt;GNU General Public License v3.0&lt;/code&gt;. Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under LGPL-3, but applications that use the library don&amp;rsquo;t have to be.&lt;/p&gt;</description></item><item><title>GTA Crew Exporter</title><link>https://rael.io/project/pygtavcrewexporter/</link><pubDate>Wed, 06 Nov 2013 11:23:56 +0200</pubDate><guid>https://rael.io/project/pygtavcrewexporter/</guid><description>
&lt;h2 id=&#34;overview&#34;&gt;Overview&lt;/h2&gt;
&lt;p&gt;Get information about crew members on Rockstar GTAV social club.&lt;/p&gt;
&lt;h2 id=&#34;prerequisites&#34;&gt;Prerequisites&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;python | &lt;a href=&#34;http://www.python.org/download/&#34; target=&#34;_blank&#34;&gt;http://www.python.org/download/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;selenium for python | &lt;a href=&#34;https://pypi.python.org/pypi/selenium&#34; target=&#34;_blank&#34;&gt;https://pypi.python.org/pypi/selenium&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;firefox | &lt;a href=&#34;http://www.mozilla.org/en-US/firefox/new/&#34; target=&#34;_blank&#34;&gt;http://www.mozilla.org/en-US/firefox/new/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;** Firefox must be in english due to Rockstar Social Club source code, in the final version it will not be necessary. **&lt;/p&gt;
&lt;h2 id=&#34;installation&#34;&gt;Installation&lt;/h2&gt;
&lt;h3 id=&#34;linux&#34;&gt;Linux&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;[327] root@eva:~# aptitude install python-pip
The following NEW packages will be installed:
python-pip python-pkg-resources{a} python-setuptools{a}
0 packages upgraded, 3 newly installed, 0 to remove and 18 not upgraded.
Need to get 648 kB of archives. After unpacking 2,938 kB will be used.
Do you want to continue? [Y/n/?] y
Get: 1 http://ftp.es.debian.org/debian/ jessie/main python-pkg-resources all 0.6.49-2 [62.5 kB]
Get: 2 http://ftp.es.debian.org/debian/ jessie/main python-setuptools all 0.6.49-2 [320 kB
Get: 3 http://ftp.es.debian.org/debian/ jessie/main python-pip all 1.4.1-2 [266 kB
Fetched 648 kB in 2s (223 kB/s)
Selecting previously unselected package python-pkg-resources.
(Reading database ... 156790 files and directories currently installed.)
Unpacking python-pkg-resources (from .../python-pkg-resources_0.6.49-2_all.deb) ...
Selecting previously unselected package python-setuptools.
Unpacking python-setuptools (from .../python-setuptools_0.6.49-2_all.deb) ...
Selecting previously unselected package python-pip.
Unpacking python-pip (from .../python-pip_1.4.1-2_all.deb) ...
Processing triggers for man-db ...
Setting up python-pkg-resources (0.6.49-2) ...
Setting up python-setuptools (0.6.49-2) ...
Setting up python-pip (1.4.1-2) ...
[328] root@eva:~# easy_install selenium
Searching for selenium
Reading http://pypi.python.org/simple/selenium/
Best match: selenium 2.37.2
Downloading https://pypi.python.org/packages/source/s/selenium/selenium-2.37.2.tar.gz#md5=f3fffaae0bc789676c4e2ab285f7b04f
Processing selenium-2.37.2.tar.gz
Writing /tmp/easy_install-shFcgY/selenium-2.37.2/setup.cfg
Running selenium-2.37.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-shFcgY/selenium-2.37.2/egg-dist-tmp-_CdLcZ
Adding selenium 2.37.2 to easy-install.pth file
Installed /usr/local/lib/python2.7/dist-packages/selenium-2.37.2-py2.7.egg
Processing dependencies for selenium
Finished processing dependencies for selenium
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;mac&#34;&gt;Mac&lt;/h3&gt;
&lt;p&gt;Download and install python from &lt;a href=&#34;http://www.python.org/download/&#34; target=&#34;_blank&#34;&gt;python.org&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Then install selenium using pip:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;[502] rael@mbw:~$ sudo pip install selenium
Downloading/unpacking selenium
Downloading selenium-2.37.2.tar.gz (2.6MB): 2.6MB downloaded
Running setup.py egg_info for package selenium
Installing collected packages: selenium
Running setup.py install for selenium
Successfully installed selenium
Cleaning up...
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;windows&#34;&gt;Windows&lt;/h3&gt;
&lt;p&gt;Not tested yet, but I guess similar as in Mac.&lt;/p&gt;
&lt;h2 id=&#34;usage&#34;&gt;Usage&lt;/h2&gt;
&lt;h3 id=&#34;command-interface&#34;&gt;Command interface&lt;/h3&gt;
&lt;pre&gt;&lt;code&gt;./gtav_crew_exporter.py --help
gtav_crew_exporter.py -c &amp;lt;crew_name&amp;gt; [-u &amp;lt;username&amp;gt; -p &amp;lt;password&amp;gt;] [-o &amp;lt;output_file&amp;gt;] [-v]
&lt;/code&gt;&lt;/pre&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Flag&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&amp;ndash;help&lt;/td&gt;
&lt;td&gt;View the basic usage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-c, &amp;ndash;crew&lt;/td&gt;
&lt;td&gt;The name of the crew to export&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-u, &amp;ndash;username=&lt;/td&gt;
&lt;td&gt;The username of your Rockstar social club&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-p, &amp;ndash;password=&lt;/td&gt;
&lt;td&gt;The password of your Rockstar social club&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;-v&lt;/td&gt;
&lt;td&gt;Verbose mode, for debug.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;h3 id=&#34;examples&#34;&gt;Examples&lt;/h3&gt;
&lt;h4 id=&#34;only-members-and-ranks&#34;&gt;Only members and ranks&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;gtav_crew_exporter.py -c elotrolado&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ ./gtav_crew_exporter.py -c elotrolado
Crew: elotrolado
Crew Size: 300 members
!! Without login and password, only username and rank are available:
Crew Members :
leader, nihael, http://socialclub.rockstargames.com/member/nihael
commissioner, FJTR23, http://socialclub.rockstargames.com/member/fjtr23
lieutenant, Racso25, http://socialclub.rockstargames.com/member/racso25
representative, AntonLaveyX, http://socialclub.rockstargames.com/member/antonlaveyx
representative, beerna, http://socialclub.rockstargames.com/member/beerna
representative, lierhoff, http://socialclub.rockstargames.com/member/lierhoff
representative, raelga, http://socialclub.rockstargames.com/member/raelga
representative, rubi7410, http://socialclub.rockstargames.com/member/rubi7410
representative, Sd-Snatcher, http://socialclub.rockstargames.com/member/sd-snatcher
muscle, _XiloX_, http://socialclub.rockstargames.com/member/_xilox_
muscle, 4LUFLiNT, http://socialclub.rockstargames.com/member/4luflint
muscle, A_Rebato, http://socialclub.rockstargames.com/member/a_rebato
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&#34;with-member-information-need-login-and-password&#34;&gt;With member information (need login and password)&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;gtav_crew_exporter.py -c the_pollasos -u raelga -p ***&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ ./gtav_crew_exporter.py -c the_pollasos -u raelga -p ***
Crew: the_pollasos
Crew Size: 9 members
adrianrgvez, Spain, , PS3, the_pollasos, leader, 108, 5D 4H 17M, All ok.
corderius10, Spain, , PS3, the_pollasos, commissioner, 79, 78H 42M 24S, All ok.
oscartc14, Spain, , PS3, the_pollasos, lieutenant, 11, 8H 34M 36S, All ok.
alfi_de_pumarin9, Spain, , PS3, the_pollasos, representative, 24, 17H 23M 9S, All ok.
capableuncle3020, , , , , representative, , , Private profile.
rodri799, Spain, , PS3, the_pollasos, representative, 12, 14H 47M 50S, All ok.
yex_gr, Spain, yex_, PS3, the_pollasos, representative, 21, 24H 50M 26S, All ok.
OrignalBEAST, United Kingdom, ORIGNALBEASSTT, PS3, lossantosdiamondz, muscle, 24, 48H 40M 23S, All ok.
raelga, Spain, raelga, PS3, elotrolado, muscle, 65, 6D 13H 53M, All ok.
&lt;/code&gt;&lt;/pre&gt;
&lt;h4 id=&#34;verbose-mode&#34;&gt;Verbose mode&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;gtav_crew_exporter.py -c the_pollasos -u raelga -p *** -v&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$ ./gtav_crew_exporter.py -v -c the_pollasos -u raelga -p ***
Crew: the_pollasos
DBG : web - starting browser
DBG : web - page fully loaded!
DBG : web - set page in english.
DBG : web - all users visible.
Crew Size: 9 members
DBG : web - page fully loaded!
DBG : web - page fully loaded!
DBG : [adrianrgvez]
DBG : web - page fully loaded!
DBG : [adrianrgvez] main crew: the_pollasos
DBG : [adrianrgvez] PSN ID:
DBG : [adrianrgvez] country: Spain
DBG : web - page fully loaded!
DBG : [adrianrgvez] rank: leader
DBG : [adrianrgvez] playtime: 5D 4H 20M
DBG : [corderius10]
DBG : web - page fully loaded!
DBG : [corderius10] main crew: the_pollasos
DBG : [corderius10] PSN ID:
DBG : [corderius10] country: Spain
DBG : web - page fully loaded!
DBG : [corderius10] rank: commissioner
DBG : [corderius10] playtime: 78H 42M 24S
DBG : [oscartc14]
DBG : web - page fully loaded!
DBG : [oscartc14] main crew: the_pollasos
DBG : [oscartc14] PSN ID:
DBG : [oscartc14] country: Spain
DBG : web - page fully loaded!
DBG : [oscartc14] rank: lieutenant
DBG : [oscartc14] playtime: 8H 34M 36S
DBG : [alfi_de_pumarin9]
DBG : web - page fully loaded!
DBG : [alfi_de_pumarin9] main crew: the_pollasos
DBG : [alfi_de_pumarin9] PSN ID:
DBG : [alfi_de_pumarin9] country: Spain
DBG : web - page fully loaded!
DBG : [alfi_de_pumarin9] rank: representative
DBG : [alfi_de_pumarin9] playtime: 17H 23M 9S
DBG : [capableuncle3020]
DBG : web - page fully loaded!
DBG : [capableuncle3020] Profile is private!
DBG : [rodri799]
DBG : web - page fully loaded!
DBG : [rodri799] main crew: the_pollasos
DBG : [rodri799] PSN ID:
DBG : [rodri799] country: Spain
DBG : web - page fully loaded!
DBG : [rodri799] rank: representative
DBG : [rodri799] playtime: 14H 47M 50S
DBG : [yex_gr]
DBG : web - page fully loaded!
DBG : [yex_gr] main crew: the_pollasos
DBG : [yex_gr] PSN ID: ***
DBG : [yex_gr] country: Spain
DBG : web - page fully loaded!
DBG : [yex_gr] rank: representative
DBG : [yex_gr] playtime: 24H 50M 26S
DBG : [OrignalBEAST]
DBG : web - page fully loaded!
DBG : [OrignalBEAST] main crew: lossantosdiamondz
DBG : [OrignalBEAST] PSN ID: ***
DBG : [OrignalBEAST] country: United Kingdom
DBG : web - page fully loaded!
DBG : [OrignalBEAST] rank: muscle
DBG : [OrignalBEAST] playtime: 48H 40M 23S
DBG : [raelga]
DBG : web - page fully loaded!
DBG : [raelga] main crew: elotrolado
DBG : [raelga] PSN ID: raelga
DBG : [raelga] country: Spain
DBG : web - page fully loaded!
DBG : [raelga] rank: muscle
DBG : [raelga] playtime: 6D 13H 53M
adrianrgvez, Spain, , PS3, the_pollasos, leader, 108, 5D 4H 20M, All ok.
corderius10, Spain, , PS3, the_pollasos, commissioner, 79, 78H 42M 24S, All ok.
oscartc14, Spain, , PS3, the_pollasos, lieutenant, 11, 8H 34M 36S, All ok.
alfi_de_pumarin9, Spain, , PS3, the_pollasos, representative, 24, 17H 23M 9S, All ok.
capableuncle3020, , , , , representative, , , Private profile.
rodri799, Spain, , PS3, the_pollasos, representative, 12, 14H 47M 50S, All ok.
yex_gr, Spain, ****, PS3, the_pollasos, representative, 21, 24H 50M 26S, All ok.
OrignalBEAST, United Kingdom, ****, PS3, lossantosdiamondz, muscle, 24, 48H 40M 23S, All ok.
raelga, Spain, raelga, PS3, elotrolado, muscle, 65, 6D 13H 53M, All ok.
&lt;/code&gt;&lt;/pre&gt;</description></item></channel></rss>