Pyjo.UserAgent.Server - Application server¶
from Pyjo.UserAgent.Server import Server
server = Server()
print(server.url())
# Or import the module, as in Google Python Style Guide
import Pyjo.UserAgent.Server
server = Pyjo.UserAgent.Server.new()
print(server.url())
Pyjo.UserAgent.Server is an embedded web server based on
Pyjo.Server.Daemon that processes requests for Pyjo.UserAgent.
The end of a with block closes its servers.
See also¶
Pyjoyment, https://mojolicious.org.
Ported from Mojo::UserAgent::Server of Mojolicious 9.49.
Classes¶
- class Pyjo.UserAgent.Server.Pyjo_UserAgent_Server(*, app: Application | None = None, ioloop: Pyjo_IOLoop | None = None)[source]¶
Pyjo.UserAgent.Serverinherits all methods fromPyjo.Baseand implements the following new ones.- property app: Application | None[source]¶
app = server.app server.app = Pyjoyment.new()
Application this server handles, instance specific applications override the global default, which
app()of the module gives.
- close() None[source]¶
server.close()
Close the servers, as the end of a
withblock does, which start again on new ports when they are used again.
- ioloop: Pyjo_IOLoop¶
loop = server.ioloop server.ioloop = Pyjo.IOLoop.new()
Event loop object to use for I/O operations, defaults to the global
Pyjo.IOLoopsingleton.
- Pyjo.UserAgent.Server.app(value: Application | None = None) Application | None[source]¶
app = Pyjo.UserAgent.Server.app() Pyjo.UserAgent.Server.app(Pyjoyment.new())
The global default application of the servers, as Mojo calls
appon the class.# Change application behavior Pyjo.UserAgent.Server.app().log.level = 'fatal'