https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor
17.4.1. #Executor Objects
class #concurrent.futures.Executor
An abstract class that provides methods to execute calls asynchronously. It should not be used directly, but through its concrete subclasses.
submit(fn, *args, **kwargs)
Schedules the callable, fn, to be executed as fn(*args **kwargs) and returns a Future object representing the execution of the callable.
with ThreadPoolExecutor(max_workers=1) as executor:
future = executor.submit(pow, 323, 1235)
print(future.result())
map(func, *iterables, timeout=None, chunksize=1)
Equivalent to #map(func, *iterables) except func is executed asynchronously and several calls to func may be made concurrently. The returned iterator raises a concurrent.futures.TimeoutError if __next__() is called and the result isn’t available after timeout seconds from the original call to #Executor.map(). timeout can be an int or a float. If timeout is not specified or None, there is no limit to the wait time. If a call raises an exception, then that exception will be raised when its value is retrieved from the iterator. When using ProcessPoolExecutor, this method chops iterables into a number of chunks which it submits to the pool as separate tasks. The (approximate) size of these chunks can be specified by setting chunksize to a positive integer. For very long iterables, using a large value for chunksize can significantly improve performance compared to the default size of 1. With ThreadPoolExecutor, chunksize has no effect.
Changed in version 3.5: Added the chunksize argument.
17.4.1. #Executor Objects
class #concurrent.futures.Executor
An abstract class that provides methods to execute calls asynchronously. It should not be used directly, but through its concrete subclasses.
submit(fn, *args, **kwargs)
Schedules the callable, fn, to be executed as fn(*args **kwargs) and returns a Future object representing the execution of the callable.
with ThreadPoolExecutor(max_workers=1) as executor:
future = executor.submit(pow, 323, 1235)
print(future.result())
map(func, *iterables, timeout=None, chunksize=1)
Equivalent to #map(func, *iterables) except func is executed asynchronously and several calls to func may be made concurrently. The returned iterator raises a concurrent.futures.TimeoutError if __next__() is called and the result isn’t available after timeout seconds from the original call to #Executor.map(). timeout can be an int or a float. If timeout is not specified or None, there is no limit to the wait time. If a call raises an exception, then that exception will be raised when its value is retrieved from the iterator. When using ProcessPoolExecutor, this method chops iterables into a number of chunks which it submits to the pool as separate tasks. The (approximate) size of these chunks can be specified by setting chunksize to a positive integer. For very long iterables, using a large value for chunksize can significantly improve performance compared to the default size of 1. With ThreadPoolExecutor, chunksize has no effect.
Changed in version 3.5: Added the chunksize argument.
https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Future
17.4.4. Future Objects
The Future class encapsulates the asynchronous execution of a callable. Future instances are created by Executor.submit().
class concurrent.futures.Future
Encapsulates the asynchronous execution of a callable. Future instances are created by Executor.submit() and should not be created directly except for testing.
17.4.4. Future Objects
The Future class encapsulates the asynchronous execution of a callable. Future instances are created by Executor.submit().
class concurrent.futures.Future
Encapsulates the asynchronous execution of a callable. Future instances are created by Executor.submit() and should not be created directly except for testing.
https://docs.python.org/3/library/asyncio-dev.html#asyncio-coroutine-not-scheduled
18.5.9.6. Detect #coroutine objects never #scheduled
When a coroutine function is called and its result is not passed to ensure_future() or to the BaseEventLoop.create_task() method, the execution of the coroutine object will never be scheduled which is probably a bug. Enable the debug mode of asyncio to log a warning to detect it.
Example with the bug:
import asyncio
@asyncio.coroutine
def test():
print("never scheduled")
test()
Output in debug mode:
Coroutine test() at test.py:3 was never yielded from
Coroutine object created at (most recent call last):
File "test.py", line 7, in <module>
test()
The fix is to call the ensure_future() function or the BaseEventLoop.create_task() method with the coroutine object.
18.5.9.6. Detect #coroutine objects never #scheduled
When a coroutine function is called and its result is not passed to ensure_future() or to the BaseEventLoop.create_task() method, the execution of the coroutine object will never be scheduled which is probably a bug. Enable the debug mode of asyncio to log a warning to detect it.
Example with the bug:
import asyncio
@asyncio.coroutine
def test():
print("never scheduled")
test()
Output in debug mode:
Coroutine test() at test.py:3 was never yielded from
Coroutine object created at (most recent call last):
File "test.py", line 7, in <module>
test()
The fix is to call the ensure_future() function or the BaseEventLoop.create_task() method with the coroutine object.
https://docs.python.org/3/library/asyncio-task.html#asyncio.coroutine
@asyncio.#coroutine
#Decorator to mark #generator-based coroutines. This enables the generator use yield from to call async def coroutines, and also enables the generator to be called by async def coroutines, for instance using an await expression.
There is no need to decorate async def coroutines themselves.
If the generator is not yielded from before it is destroyed, an error message is logged. See Detect coroutines never scheduled.
Note
In this documentation, some methods are documented as coroutines, even if they are plain Python functions returning a Future. This is intentional to have a freedom of tweaking the implementation of these functions in the future. If such a function is needed to be used in a callback-style code, wrap its result with ensure_future().
@asyncio.#coroutine
#Decorator to mark #generator-based coroutines. This enables the generator use yield from to call async def coroutines, and also enables the generator to be called by async def coroutines, for instance using an await expression.
There is no need to decorate async def coroutines themselves.
If the generator is not yielded from before it is destroyed, an error message is logged. See Detect coroutines never scheduled.
Note
In this documentation, some methods are documented as coroutines, even if they are plain Python functions returning a Future. This is intentional to have a freedom of tweaking the implementation of these functions in the future. If such a function is needed to be used in a callback-style code, wrap its result with ensure_future().
https://docs.python.org/3/library/asyncio-task.html#asyncio.coroutine
18.5.3. Tasks and coroutines
18.5.3.1. Coroutines
Coroutines used with asyncio may be implemented using the async def statement, or by using generators. The async def type of coroutine was added in Python 3.5, and is recommended if there is no need to support older Python versions.
Generator-based coroutines should be decorated with @asyncio.coroutine, although this is not strictly enforced. The decorator enables compatibility with async def coroutines, and also serves as documentation. Generator-based coroutines use the yield from syntax introduced in PEP 380, instead of the original yield syntax.
The word “coroutine”, like the word “generator”, is used for two different (though related) concepts:
The function that defines a coroutine (a function definition using async def or decorated with @asyncio.coroutine). If disambiguation is needed we will call this a coroutine function (iscoroutinefunction() returns True).
The object obtained by calling a coroutine function. This object represents a computation or an I/O operation (usually a combination) that will complete eventually. If disambiguation is needed we will call it a coroutine object (iscoroutine() returns True).
Things a coroutine can do:
result = await future or result = yield from future – suspends the coroutine until the future is done, then returns the future’s result, or raises an exception, which will be propagated. (If the future is cancelled, it will raise a CancelledError exception.) Note that tasks are futures, and everything said about futures also applies to tasks.
result = await coroutine or result = yield from coroutine – wait for another coroutine to produce a result (or raise an exception, which will be propagated). The coroutine expression must be a call to another coroutine.
return expression – produce a result to the coroutine that is waiting for this one using await or yield from.
raise exception – raise an exception in the coroutine that is waiting for this one using await or yield from.
18.5.3. Tasks and coroutines
18.5.3.1. Coroutines
Coroutines used with asyncio may be implemented using the async def statement, or by using generators. The async def type of coroutine was added in Python 3.5, and is recommended if there is no need to support older Python versions.
Generator-based coroutines should be decorated with @asyncio.coroutine, although this is not strictly enforced. The decorator enables compatibility with async def coroutines, and also serves as documentation. Generator-based coroutines use the yield from syntax introduced in PEP 380, instead of the original yield syntax.
The word “coroutine”, like the word “generator”, is used for two different (though related) concepts:
The function that defines a coroutine (a function definition using async def or decorated with @asyncio.coroutine). If disambiguation is needed we will call this a coroutine function (iscoroutinefunction() returns True).
The object obtained by calling a coroutine function. This object represents a computation or an I/O operation (usually a combination) that will complete eventually. If disambiguation is needed we will call it a coroutine object (iscoroutine() returns True).
Things a coroutine can do:
result = await future or result = yield from future – suspends the coroutine until the future is done, then returns the future’s result, or raises an exception, which will be propagated. (If the future is cancelled, it will raise a CancelledError exception.) Note that tasks are futures, and everything said about futures also applies to tasks.
result = await coroutine or result = yield from coroutine – wait for another coroutine to produce a result (or raise an exception, which will be propagated). The coroutine expression must be a call to another coroutine.
return expression – produce a result to the coroutine that is waiting for this one using await or yield from.
raise exception – raise an exception in the coroutine that is waiting for this one using await or yield from.
https://docs.python.org/3/library/asyncio-dev.html#asyncio-multithreading
18.5.9.3. #Concurrency and #multithreading
An event loop runs in a thread and executes all callbacks and tasks in the same thread. While a task is running in the event loop, no other task is running in the same thread. But when the task uses yield from, the task is suspended and the event loop executes the next task.
To schedule a callback from a different thread, the BaseEventLoop.call_soon_threadsafe() method should be used. Example:
loop.call_soon_threadsafe(callback, *args)
Most asyncio objects are not thread safe. You should only worry if you access objects outside the event loop. For example, to cancel a future, don’t call directly its Future.cancel() method, but:
loop.call_soon_threadsafe(fut.cancel)
To handle signals and to execute subprocesses, the event loop must be run in the main thread.
To schedule a coroutine object from a different thread, the run_coroutine_threadsafe() function should be used. It returns a concurrent.futures.Future to access the result:
future = asyncio.run_coroutine_threadsafe(coro_func(), loop)
result = future.result(timeout) # Wait for the result with a timeout
The BaseEventLoop.run_in_executor() method can be used with a thread pool executor to execute a callback in different thread to not block the thread of the event loop.
See also
The Synchronization primitives section describes ways to synchronize tasks.
The Subprocess and threads section lists asyncio limitations to run subprocesses from different threads.
18.5.9.3. #Concurrency and #multithreading
An event loop runs in a thread and executes all callbacks and tasks in the same thread. While a task is running in the event loop, no other task is running in the same thread. But when the task uses yield from, the task is suspended and the event loop executes the next task.
To schedule a callback from a different thread, the BaseEventLoop.call_soon_threadsafe() method should be used. Example:
loop.call_soon_threadsafe(callback, *args)
Most asyncio objects are not thread safe. You should only worry if you access objects outside the event loop. For example, to cancel a future, don’t call directly its Future.cancel() method, but:
loop.call_soon_threadsafe(fut.cancel)
To handle signals and to execute subprocesses, the event loop must be run in the main thread.
To schedule a coroutine object from a different thread, the run_coroutine_threadsafe() function should be used. It returns a concurrent.futures.Future to access the result:
future = asyncio.run_coroutine_threadsafe(coro_func(), loop)
result = future.result(timeout) # Wait for the result with a timeout
The BaseEventLoop.run_in_executor() method can be used with a thread pool executor to execute a callback in different thread to not block the thread of the event loop.
See also
The Synchronization primitives section describes ways to synchronize tasks.
The Subprocess and threads section lists asyncio limitations to run subprocesses from different threads.
https://docs.python.org/3/library/asyncio-task.html#asyncio.run_coroutine_threadsafe
#asyncio.run_coroutine_threadsafe(coro, loop)
Submit a coroutine object to a given event loop.
Return a concurrent.futures.Future to access the result.
#asyncio.run_coroutine_threadsafe(coro, loop)
Submit a coroutine object to a given event loop.
Return a concurrent.futures.Future to access the result.
https://docs.python.org/3/library/asyncio-eventloop.html
#Calls
Most #asyncio functions don’t accept keywords. If you want to pass #keywords to your callback, use #functools.partial(). For example, #loop.#call_soon(functools.partial(print, "Hello", flush=True)) will call print("Hello", flush=True).
#Note
functools.partial() is better than lambda functions, because asyncio can inspect functools.partial() object to display parameters in debug mode, whereas lambda functions have a poor representation.
BaseEventLoop.call_soon(callback, *args)
Arrange for a callback to be called as soon as possible. The callback is called after call_soon() returns, when control returns to the event loop.
This operates as a FIFO queue, callbacks are called in the order in which they are registered. Each callback will be called exactly once.
Any positional arguments after the callback will be passed to the callback when it is called.
An instance of asyncio.Handle is returned, which can be used to cancel the callback.
Use functools.partial to pass keywords to the callback.
BaseEventLoop.call_soon_threadsafe(callback, *args)
Like call_soon(), but thread safe.
See the concurrency and multithreading section of the documentation.
#Calls
Most #asyncio functions don’t accept keywords. If you want to pass #keywords to your callback, use #functools.partial(). For example, #loop.#call_soon(functools.partial(print, "Hello", flush=True)) will call print("Hello", flush=True).
#Note
functools.partial() is better than lambda functions, because asyncio can inspect functools.partial() object to display parameters in debug mode, whereas lambda functions have a poor representation.
BaseEventLoop.call_soon(callback, *args)
Arrange for a callback to be called as soon as possible. The callback is called after call_soon() returns, when control returns to the event loop.
This operates as a FIFO queue, callbacks are called in the order in which they are registered. Each callback will be called exactly once.
Any positional arguments after the callback will be passed to the callback when it is called.
An instance of asyncio.Handle is returned, which can be used to cancel the callback.
Use functools.partial to pass keywords to the callback.
BaseEventLoop.call_soon_threadsafe(callback, *args)
Like call_soon(), but thread safe.
See the concurrency and multithreading section of the documentation.
https://docs.python.org/3/library/asyncio.html
#asyncio
#Asynchronous programming is more complex than classical “#sequential” programming: see the Develop with asyncio page which lists common traps and explains how to avoid them. Enable the debug mode during development to detect common issues.
#asyncio
#Asynchronous programming is more complex than classical “#sequential” programming: see the Develop with asyncio page which lists common traps and explains how to avoid them. Enable the debug mode during development to detect common issues.
https://github.com/daleroberts/tv
tv ("#textview") is a small tool to quickly view high-resolution multi-band imagery directly in your terminal. It was designed for working with (very large) #satellite imagery data over a low-bandwidth connection. For example, you can directly visualise a Himawari 8 (11K x 11K pixel) image of the Earth directly from its URL:
It is built upon the wonderful #GDAL library so it is able to load a large variety of image formats (GeoTiff, PNG, Jpeg, NetCDF, ...) and subsample the image as it reads from disk so it can handle very large files quickly. It has the ability to read filenames (or URLs) from stdin and load files directly from URLs without writing locally to disk. Command line options are styled after gdal_translate such as:
-b to specify the bands (and ordering) to use,
-srcwin xoff yoff xsize ysize to view a subset of the image,
-r to specify the subsampling algorithm (nearest, bilinear, cubic, cubicspline, lanczos, average, mode).
tv ("#textview") is a small tool to quickly view high-resolution multi-band imagery directly in your terminal. It was designed for working with (very large) #satellite imagery data over a low-bandwidth connection. For example, you can directly visualise a Himawari 8 (11K x 11K pixel) image of the Earth directly from its URL:
It is built upon the wonderful #GDAL library so it is able to load a large variety of image formats (GeoTiff, PNG, Jpeg, NetCDF, ...) and subsample the image as it reads from disk so it can handle very large files quickly. It has the ability to read filenames (or URLs) from stdin and load files directly from URLs without writing locally to disk. Command line options are styled after gdal_translate such as:
-b to specify the bands (and ordering) to use,
-srcwin xoff yoff xsize ysize to view a subset of the image,
-r to specify the subsampling algorithm (nearest, bilinear, cubic, cubicspline, lanczos, average, mode).
GitHub
GitHub - daleroberts/tv: Quickly view (satellite) imagery directly in your terminal using Unicode 9.0 characters and true color.
Quickly view (satellite) imagery directly in your terminal using Unicode 9.0 characters and true color. - daleroberts/tv
http://robotframework.org/
#Robot #Framework is a generic test #automation framework for acceptance testing and acceptance test-driven development (ATDD). It has easy-to-use tabular test data syntax and it utilizes the keyword-driven testing approach. Its testing capabilities can be extended by test libraries implemented either with Python or Java, and users can create new higher-level keywords from existing ones using the same syntax that is used for creating test cases.
#Robot #Framework is a generic test #automation framework for acceptance testing and acceptance test-driven development (ATDD). It has easy-to-use tabular test data syntax and it utilizes the keyword-driven testing approach. Its testing capabilities can be extended by test libraries implemented either with Python or Java, and users can create new higher-level keywords from existing ones using the same syntax that is used for creating test cases.
#pytest: helps you write better programs
a mature full-featured Python testing tool
runs on Posix/Windows, Python 2.6-3.5, #PyPy and (possibly still) Jython-2.5.1
free and open source software, distributed under the terms of the MIT license
well tested with more than a thousand tests against itself
strict backward compatibility policy for safe pytest upgrades
comprehensive online and PDF documentation
many third party plugins and builtin helpers,
used in many small and large projects and organisations
comes with many tested examples
http://docs.pytest.org/en/latest/
a mature full-featured Python testing tool
runs on Posix/Windows, Python 2.6-3.5, #PyPy and (possibly still) Jython-2.5.1
free and open source software, distributed under the terms of the MIT license
well tested with more than a thousand tests against itself
strict backward compatibility policy for safe pytest upgrades
comprehensive online and PDF documentation
many third party plugins and builtin helpers,
used in many small and large projects and organisations
comes with many tested examples
http://docs.pytest.org/en/latest/
#Django REST #framework is a powerful and flexible toolkit for building #Web APIs.
Some reasons you might want to use REST framework:
The Web browsable #API is a huge usability win for your developers.
Authentication policies including packages for OAuth1a and OAuth2.
Serialization that supports both ORM and non-ORM data sources.
Customizable all the way down - just use regular function-based views if you don't need the more powerful features.
Extensive documentation, and great community support.
Used and trusted by internationally recognised companies including Mozilla, Red Hat, Heroku, and Eventbrite.
http://www.django-rest-framework.org/
Some reasons you might want to use REST framework:
The Web browsable #API is a huge usability win for your developers.
Authentication policies including packages for OAuth1a and OAuth2.
Serialization that supports both ORM and non-ORM data sources.
Customizable all the way down - just use regular function-based views if you don't need the more powerful features.
Extensive documentation, and great community support.
Used and trusted by internationally recognised companies including Mozilla, Red Hat, Heroku, and Eventbrite.
http://www.django-rest-framework.org/
www.django-rest-framework.org
Django REST framework
Django REST framework - Web APIs for Django
2015
"Speaker: David Beazley
There are currently three popular approaches to Python concurrency: threads, event loops, and coroutines. Each is shrouded by various degrees of mystery and peril. In this talk, all three approaches will be deconstructed and explained in a epic ground-up live coding battle.
https://www.youtube.com/watch?v=MCs5OvhV9S4
"Speaker: David Beazley
There are currently three popular approaches to Python concurrency: threads, event loops, and coroutines. Each is shrouded by various degrees of mystery and peril. In this talk, all three approaches will be deconstructed and explained in a epic ground-up live coding battle.
https://www.youtube.com/watch?v=MCs5OvhV9S4
YouTube
David Beazley - Python Concurrency From the Ground Up: LIVE! - PyCon 2015
"Speaker: David Beazley
There are currently three popular approaches to Python concurrency: threads, event loops, and coroutines. Each is shrouded by various degrees of mystery and peril. In this talk, all three approaches will be deconstructed and explained…
There are currently three popular approaches to Python concurrency: threads, event loops, and coroutines. Each is shrouded by various degrees of mystery and peril. In this talk, all three approaches will be deconstructed and explained…
Sphinx is a tool that makes it easy to create intelligent and beautiful documentation, written by Georg Brandl and licensed under the BSD license.
It was originally created for the new Python documentation, and it has excellent facilities for the documentation of Python projects, but C/C++ is already supported as well, and it is planned to add special support for other languages as well. Of course, this site is also created from reStructuredText sources using Sphinx! The following features should be highlighted:
Output formats: HTML (including Windows HTML Help), LaTeX (for printable PDF versions), ePub, Texinfo, manual pages, plain text
Extensive cross-references: semantic markup and automatic links for functions, classes, citations, glossary terms and similar pieces of information
Hierarchical structure: easy definition of a document tree, with automatic links to siblings, parents and children
Automatic indices: general index as well as a language-specific module indices
Code handling: automatic highlighting using the Pygments highlighter
Extensions: automatic testing of code snippets, inclusion of docstrings from Python modules (API docs), and more
Contributed extensions: more than 50 extensions contributed by users in a second repository; most of them installable from PyPI
http://www.sphinx-doc.org/en/stable/
It was originally created for the new Python documentation, and it has excellent facilities for the documentation of Python projects, but C/C++ is already supported as well, and it is planned to add special support for other languages as well. Of course, this site is also created from reStructuredText sources using Sphinx! The following features should be highlighted:
Output formats: HTML (including Windows HTML Help), LaTeX (for printable PDF versions), ePub, Texinfo, manual pages, plain text
Extensive cross-references: semantic markup and automatic links for functions, classes, citations, glossary terms and similar pieces of information
Hierarchical structure: easy definition of a document tree, with automatic links to siblings, parents and children
Automatic indices: general index as well as a language-specific module indices
Code handling: automatic highlighting using the Pygments highlighter
Extensions: automatic testing of code snippets, inclusion of docstrings from Python modules (API docs), and more
Contributed extensions: more than 50 extensions contributed by users in a second repository; most of them installable from PyPI
http://www.sphinx-doc.org/en/stable/
top prev next
#ZeroMQ (also known as ØMQ, 0MQ, or #zmq) looks like an embeddable networking #library but acts like a #concurrency framework. It gives you sockets that carry atomic messages across various transports like in-process, inter-process, TCP, and multicast. You can connect sockets N-to-N with patterns like fan-out, pub-sub, task distribution, and request-reply. It's fast enough to be the fabric for clustered products. Its asynchronous I/O model gives you scalable multicore applications, built as asynchronous message-processing tasks. It has a score of language APIs and runs on most operating systems. ZeroMQ is from iMatix and is LGPLv3 open source.
http://zguide.zeromq.org/page:all
#ZeroMQ (also known as ØMQ, 0MQ, or #zmq) looks like an embeddable networking #library but acts like a #concurrency framework. It gives you sockets that carry atomic messages across various transports like in-process, inter-process, TCP, and multicast. You can connect sockets N-to-N with patterns like fan-out, pub-sub, task distribution, and request-reply. It's fast enough to be the fabric for clustered products. Its asynchronous I/O model gives you scalable multicore applications, built as asynchronous message-processing tasks. It has a score of language APIs and runs on most operating systems. ZeroMQ is from iMatix and is LGPLv3 open source.
http://zguide.zeromq.org/page:all
https://github.com/python/asyncio
The #asyncio #module provides infrastructure for writing #single-threaded concurrent code using #coroutines, #multiplexing #I/O access over sockets and other resources, running network clients and servers, and other related primitives. Here is a more detailed list of the package contents:
a pluggable event loop with various system-specific implementations;
transport and protocol abstractions (similar to those in Twisted);
concrete support for TCP, UDP, SSL, subprocess pipes, delayed calls, and others (some may be system-dependent);
a Future class that mimics the one in the concurrent.futures module, but adapted for use with the event loop;
#coroutines and #tasks based on yield from (PEP 380), to help write concurrent code in a sequential fashion;
cancellation support for Futures and coroutines;
synchronization primitives for use between coroutines in a single thread, mimicking those in the #threading module;
an interface for passing work off to a threadpool, for times when you absolutely, positively have to use a library that makes blocking I/O calls.
Note: The implementation of asyncio was previously called "Tulip".
The #asyncio #module provides infrastructure for writing #single-threaded concurrent code using #coroutines, #multiplexing #I/O access over sockets and other resources, running network clients and servers, and other related primitives. Here is a more detailed list of the package contents:
a pluggable event loop with various system-specific implementations;
transport and protocol abstractions (similar to those in Twisted);
concrete support for TCP, UDP, SSL, subprocess pipes, delayed calls, and others (some may be system-dependent);
a Future class that mimics the one in the concurrent.futures module, but adapted for use with the event loop;
#coroutines and #tasks based on yield from (PEP 380), to help write concurrent code in a sequential fashion;
cancellation support for Futures and coroutines;
synchronization primitives for use between coroutines in a single thread, mimicking those in the #threading module;
an interface for passing work off to a threadpool, for times when you absolutely, positively have to use a library that makes blocking I/O calls.
Note: The implementation of asyncio was previously called "Tulip".
GitHub
GitHub - python/asyncio: asyncio historical repository
asyncio historical repository. Contribute to python/asyncio development by creating an account on GitHub.
https://github.com/benhoff/vexbot
Pluggable #bot
Under heavy development. Not ready for general use outside of driving #chatimusmaximus
Requires python 3.5
Configuring Addresses
#Vexbot uses messaging and subprocesses for different services. This has some advantages/disadvantages of this approach, but the reason it's staying is it allows the developer some decreased congnitive load while developing this project.
The address expected is in the format of tcp://[ADDRESS]:[PORT_NUMBER]. For example tcp://127.0.0.1:5617 is a valid address. 127.0.0.1 is the ADDRESS and 5617 is the PORT_NUMBER.
127.0.0.1 was chosen specifially as an example because for IPV4 it is the "localhost". Localhost is the computer the program is being run on. So if you want the program to connect to a socket on your local computer (you probably do), use 127.0.0.1.
Port numbers range from 0-65536, and can be mostly aribratry chosen. For linux ports 0-1024 are reserved, so best to stay away from those. Port 5555 is usually used as an example port for coding examples, so probably best to stay away from that as well.
The value of the publish_address and subscribe_address at the top of the settings file are likely what you want to copy for the publish_address and subscribe_address under shell, irc, xmpp, youtube, and socket_io if you're running everything locally on one computer. But you don't have to. You could run all the services on one computer and the main #robot on a different computer. You would just need to configure the address and ports correctly, as well as work through any networking/port issues going across the local area network (LAN).
Pluggable #bot
Under heavy development. Not ready for general use outside of driving #chatimusmaximus
Requires python 3.5
Configuring Addresses
#Vexbot uses messaging and subprocesses for different services. This has some advantages/disadvantages of this approach, but the reason it's staying is it allows the developer some decreased congnitive load while developing this project.
The address expected is in the format of tcp://[ADDRESS]:[PORT_NUMBER]. For example tcp://127.0.0.1:5617 is a valid address. 127.0.0.1 is the ADDRESS and 5617 is the PORT_NUMBER.
127.0.0.1 was chosen specifially as an example because for IPV4 it is the "localhost". Localhost is the computer the program is being run on. So if you want the program to connect to a socket on your local computer (you probably do), use 127.0.0.1.
Port numbers range from 0-65536, and can be mostly aribratry chosen. For linux ports 0-1024 are reserved, so best to stay away from those. Port 5555 is usually used as an example port for coding examples, so probably best to stay away from that as well.
The value of the publish_address and subscribe_address at the top of the settings file are likely what you want to copy for the publish_address and subscribe_address under shell, irc, xmpp, youtube, and socket_io if you're running everything locally on one computer. But you don't have to. You could run all the services on one computer and the main #robot on a different computer. You would just need to configure the address and ports correctly, as well as work through any networking/port issues going across the local area network (LAN).
GitHub
benhoff/vexbot
Chat bot featuring multiple services connected to a bot instance using messaging - benhoff/vexbot
https://github.com/sourcesimian/pyTelegramBotAPI
An implementation of the #Telegram #Bot #API messages and some simple #clients.
Used by:
txTelegramBot - An easily customisable bot written in Twisted Python3.
An implementation of the #Telegram #Bot #API messages and some simple #clients.
Used by:
txTelegramBot - An easily customisable bot written in Twisted Python3.
GitHub
GitHub - sourcesimian/pyTelegramBotAPI: Telegram Bot API (unofficial) in Python 3
Telegram Bot API (unofficial) in Python 3. Contribute to sourcesimian/pyTelegramBotAPI development by creating an account on GitHub.
https://docs.mongodb.com/getting-started/python/client/
On this page
Procedure
Additional Information
PyMongo is a Python distribution containing tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
On this page
Procedure
Additional Information
PyMongo is a Python distribution containing tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.