You don't use request, or appname so little point in declaring them
Likewise chat_server is only referenced once so it would be better to do away with that variable.
Similarly with s3, it's only used once.