├── GamezServer.Python.pyproj ├── GamezServer.Python.pyproj.user ├── GamezServer.Python.sln ├── GamezServer.db ├── GamezServer.ini ├── GamezServer.py ├── GamezServer ├── Constants.py ├── DAO.py ├── DAO.pyc ├── Searchers.py ├── Searchers.pyc ├── Service.py ├── Service.pyc ├── Task.py ├── Task.pyc ├── UsenetCrawler.py ├── UsenetCrawler.pyc ├── WebServe.py ├── WebServe.pyc ├── __init__.py ├── __init__.pyc ├── __pycache__ │ ├── DAO.cpython-34.pyc │ ├── Searchers.cpython-34.pyc │ ├── Service.cpython-34.pyc │ ├── Task.cpython-34.pyc │ ├── UsenetCrawler.cpython-34.pyc │ ├── WebServe.cpython-34.pyc │ └── __init__.cpython-34.pyc └── static-web │ ├── scripts │ ├── Menu.js │ ├── ajax-mocks.js │ ├── chosen.jquery.js │ ├── dataTables.jqueryui.js │ ├── dataTables.tableTools.js │ ├── jquery-ui.js │ ├── jquery.cascadingdropdown.js │ ├── jquery.dataTables.js │ ├── jquery.js │ ├── jquery.mockjax.js │ └── toastr.js │ └── styles │ ├── Menu.css │ ├── chosen.css │ ├── dataTables.jqueryui.css │ ├── dataTables.tableTools.css │ ├── images │ ├── Sorting icons.psd │ ├── favicon.ico │ ├── sort_asc.png │ ├── sort_asc_disabled.png │ ├── sort_both.png │ ├── sort_desc.png │ ├── sort_desc_disabled.png │ ├── ui-bg_diagonals-small_25_c5ddfc_40x40.png │ ├── ui-bg_diagonals-thick_20_e69700_40x40.png │ ├── ui-bg_diagonals-thick_22_1484e6_40x40.png │ ├── ui-bg_diagonals-thick_26_2293f7_40x40.png │ ├── ui-bg_flat_0_e69700_40x100.png │ ├── ui-bg_flat_0_e6b900_40x100.png │ ├── ui-bg_highlight-soft_100_f9f9f9_1x100.png │ ├── ui-bg_inset-hard_100_eeeeee_1x100.png │ ├── ui-icons_0a82eb_256x240.png │ ├── ui-icons_0b54d5_256x240.png │ ├── ui-icons_5fa5e3_256x240.png │ ├── ui-icons_fcdd4a_256x240.png │ └── ui-icons_ffffff_256x240.png │ ├── jquery-ui.css │ ├── jquery-ui.structure.css │ ├── jquery-ui.theme.css │ ├── jquery.dataTables.css │ ├── jquery.dataTables_themeroller.css │ └── toastr.css ├── Logs ├── IntelGFX.log └── IntelGFXCoin.log ├── OpenSSL ├── RATIONALE ├── __init__.py ├── crypto │ ├── crl.c │ ├── crl.h │ ├── crypto.c │ ├── crypto.h │ ├── netscape_spki.c │ ├── netscape_spki.h │ ├── pkcs12.c │ ├── pkcs12.h │ ├── pkcs7.c │ ├── pkcs7.h │ ├── pkey.c │ ├── pkey.h │ ├── revoked.c │ ├── revoked.h │ ├── x509.c │ ├── x509.h │ ├── x509ext.c │ ├── x509ext.h │ ├── x509name.c │ ├── x509name.h │ ├── x509req.c │ ├── x509req.h │ ├── x509store.c │ └── x509store.h ├── py3k.h ├── pymemcompat.h ├── rand │ └── rand.c ├── ssl │ ├── connection.c │ ├── connection.h │ ├── context.c │ ├── context.h │ ├── ssl.c │ └── ssl.h ├── test │ ├── __init__.py │ ├── test_crypto.py │ ├── test_rand.py │ ├── test_ssl.py │ └── util.py ├── tsafe.py ├── util.c ├── util.h └── version.py ├── README.md ├── cherrypy ├── LICENSE.txt ├── __init__.py ├── __init__.pyc ├── __pycache__ │ ├── __init__.cpython-34.pyc │ ├── _cpchecker.cpython-34.pyc │ ├── _cpcompat.cpython-34.pyc │ ├── _cpconfig.cpython-34.pyc │ ├── _cpdispatch.cpython-34.pyc │ ├── _cperror.cpython-34.pyc │ ├── _cplogging.cpython-34.pyc │ ├── _cpreqbody.cpython-34.pyc │ ├── _cprequest.cpython-34.pyc │ ├── _cpserver.cpython-34.pyc │ ├── _cptools.cpython-34.pyc │ ├── _cptree.cpython-34.pyc │ ├── _cpwsgi.cpython-34.pyc │ └── _cpwsgi_server.cpython-34.pyc ├── _cpchecker.py ├── _cpchecker.pyc ├── _cpcompat.py ├── _cpcompat.pyc ├── _cpcompat_subprocess.py ├── _cpconfig.py ├── _cpconfig.pyc ├── _cpdispatch.py ├── _cpdispatch.pyc ├── _cperror.py ├── _cperror.pyc ├── _cplogging.py ├── _cplogging.pyc ├── _cpmodpy.py ├── _cpnative_server.py ├── _cpreqbody.py ├── _cpreqbody.pyc ├── _cprequest.py ├── _cprequest.pyc ├── _cpserver.py ├── _cpserver.pyc ├── _cpthreadinglocal.py ├── _cptools.py ├── _cptools.pyc ├── _cptree.py ├── _cptree.pyc ├── _cpwsgi.py ├── _cpwsgi.pyc ├── _cpwsgi_server.py ├── _cpwsgi_server.pyc ├── cherryd ├── favicon.ico ├── lib │ ├── __init__.py │ ├── __init__.pyc │ ├── __pycache__ │ │ ├── __init__.cpython-34.pyc │ │ ├── auth.cpython-34.pyc │ │ ├── auth_basic.cpython-34.pyc │ │ ├── auth_digest.cpython-34.pyc │ │ ├── caching.cpython-34.pyc │ │ ├── cptools.cpython-34.pyc │ │ ├── encoding.cpython-34.pyc │ │ ├── httpauth.cpython-34.pyc │ │ ├── httputil.cpython-34.pyc │ │ ├── jsontools.cpython-34.pyc │ │ ├── lockfile.cpython-34.pyc │ │ ├── locking.cpython-34.pyc │ │ ├── reprconf.cpython-34.pyc │ │ ├── sessions.cpython-34.pyc │ │ ├── static.cpython-34.pyc │ │ └── xmlrpcutil.cpython-34.pyc │ ├── auth.py │ ├── auth.pyc │ ├── auth_basic.py │ ├── auth_basic.pyc │ ├── auth_digest.py │ ├── auth_digest.pyc │ ├── caching.py │ ├── caching.pyc │ ├── covercp.py │ ├── cpstats.py │ ├── cptools.py │ ├── cptools.pyc │ ├── encoding.py │ ├── encoding.pyc │ ├── gctools.py │ ├── http.py │ ├── httpauth.py │ ├── httpauth.pyc │ ├── httputil.py │ ├── httputil.pyc │ ├── jsontools.py │ ├── jsontools.pyc │ ├── lockfile.py │ ├── lockfile.pyc │ ├── locking.py │ ├── locking.pyc │ ├── profiler.py │ ├── reprconf.py │ ├── reprconf.pyc │ ├── sessions.py │ ├── sessions.pyc │ ├── static.py │ ├── static.pyc │ ├── xmlrpcutil.py │ └── xmlrpcutil.pyc ├── process │ ├── __init__.py │ ├── __init__.pyc │ ├── __pycache__ │ │ ├── __init__.cpython-34.pyc │ │ ├── plugins.cpython-34.pyc │ │ ├── servers.cpython-34.pyc │ │ ├── win32.cpython-34.pyc │ │ └── wspbus.cpython-34.pyc │ ├── plugins.py │ ├── plugins.pyc │ ├── servers.py │ ├── servers.pyc │ ├── win32.py │ ├── win32.pyc │ ├── wspbus.py │ └── wspbus.pyc ├── scaffold │ ├── __init__.py │ ├── apache-fcgi.conf │ ├── example.conf │ ├── site.conf │ └── static │ │ └── made_with_cherrypy_small.png ├── test │ ├── __init__.py │ ├── _test_decorators.py │ ├── _test_states_demo.py │ ├── benchmark.py │ ├── checkerdemo.py │ ├── helper.py │ ├── logtest.py │ ├── modfastcgi.py │ ├── modfcgid.py │ ├── modpy.py │ ├── modwsgi.py │ ├── sessiondemo.py │ ├── static │ │ ├── 404.html │ │ ├── dirback.jpg │ │ └── index.html │ ├── style.css │ ├── test.pem │ ├── test_auth_basic.py │ ├── test_auth_digest.py │ ├── test_bus.py │ ├── test_caching.py │ ├── test_compat.py │ ├── test_config.py │ ├── test_config_server.py │ ├── test_conn.py │ ├── test_core.py │ ├── test_dynamicobjectmapping.py │ ├── test_encoding.py │ ├── test_etags.py │ ├── test_http.py │ ├── test_httpauth.py │ ├── test_httplib.py │ ├── test_iterator.py │ ├── test_json.py │ ├── test_logging.py │ ├── test_mime.py │ ├── test_misc_tools.py │ ├── test_objectmapping.py │ ├── test_proxy.py │ ├── test_refleaks.py │ ├── test_request_obj.py │ ├── test_routes.py │ ├── test_session.py │ ├── test_sessionauthenticate.py │ ├── test_states.py │ ├── test_static.py │ ├── test_tools.py │ ├── test_tutorials.py │ ├── test_virtualhost.py │ ├── test_wsgi_ns.py │ ├── test_wsgi_vhost.py │ ├── test_wsgiapps.py │ ├── test_xmlrpc.py │ └── webtest.py ├── tutorial │ ├── README.txt │ ├── __init__.py │ ├── custom_error.html │ ├── pdf_file.pdf │ ├── tut01_helloworld.py │ ├── tut02_expose_methods.py │ ├── tut03_get_and_post.py │ ├── tut04_complex_site.py │ ├── tut05_derived_objects.py │ ├── tut06_default_method.py │ ├── tut07_sessions.py │ ├── tut08_generators_and_yield.py │ ├── tut09_files.py │ ├── tut10_http_errors.py │ └── tutorial.conf └── wsgiserver │ ├── __init__.py │ ├── __init__.pyc │ ├── __pycache__ │ ├── __init__.cpython-34.pyc │ └── wsgiserver3.cpython-34.pyc │ ├── ssl_builtin.py │ ├── ssl_pyopenssl.py │ ├── wsgiserver2.py │ ├── wsgiserver2.pyc │ └── wsgiserver3.py ├── dexml ├── __init__.py ├── fields.py └── test.py ├── lxml ├── ElementInclude.py ├── __init__.py ├── __init__.pyc ├── __pycache__ │ └── __init__.cpython-34.pyc ├── _elementpath.py ├── apihelpers.pxi ├── builder.py ├── classlookup.pxi ├── cleanup.pxi ├── cssselect.py ├── cvarargs.pxd ├── debug.pxi ├── docloader.pxi ├── doctestcompare.py ├── dtd.pxi ├── extensions.pxi ├── html │ ├── ElementSoup.py │ ├── __init__.py │ ├── _diffcommand.py │ ├── _html5builder.py │ ├── _setmixin.py │ ├── builder.py │ ├── clean.py │ ├── defs.py │ ├── diff.py │ ├── formfill.py │ ├── html5parser.py │ ├── soupparser.py │ ├── tests │ │ ├── __init__.py │ │ ├── feedparser-data │ │ │ ├── entry_content_applet.data │ │ │ ├── entry_content_blink.data │ │ │ ├── entry_content_crazy.data │ │ │ ├── entry_content_embed.data │ │ │ ├── entry_content_frame.data │ │ │ ├── entry_content_iframe.data │ │ │ ├── entry_content_link.data │ │ │ ├── entry_content_meta.data │ │ │ ├── entry_content_object.data │ │ │ ├── entry_content_onabort.data │ │ │ ├── entry_content_onblur.data │ │ │ ├── entry_content_onchange.data │ │ │ ├── entry_content_onclick.data │ │ │ ├── entry_content_ondblclick.data │ │ │ ├── entry_content_onerror.data │ │ │ ├── entry_content_onfocus.data │ │ │ ├── entry_content_onkeydown.data │ │ │ ├── entry_content_onkeypress.data │ │ │ ├── entry_content_onkeyup.data │ │ │ ├── entry_content_onload.data │ │ │ ├── entry_content_onmousedown.data │ │ │ ├── entry_content_onmouseout.data │ │ │ ├── entry_content_onmouseover.data │ │ │ ├── entry_content_onmouseup.data │ │ │ ├── entry_content_onreset.data │ │ │ ├── entry_content_onresize.data │ │ │ ├── entry_content_onsubmit.data │ │ │ ├── entry_content_onunload.data │ │ │ ├── entry_content_script.data │ │ │ ├── entry_content_script_cdata.data │ │ │ ├── entry_content_script_inline.data │ │ │ └── entry_content_style.data │ │ ├── hackers-org-data │ │ │ ├── background-image-plus.data │ │ │ ├── background-image-with-unicoded.data │ │ │ ├── downlevel-hidden.data │ │ │ ├── html-plus-time.data │ │ │ ├── javascript-link.data │ │ │ ├── style-comment.data │ │ │ ├── style-expression.data │ │ │ ├── style-import.data │ │ │ ├── style-js-tag.data │ │ │ ├── style-url-js.data │ │ │ ├── xml-data-island.data │ │ │ └── xml-embedded-js.data │ │ ├── test_autolink.py │ │ ├── test_autolink.txt │ │ ├── test_basic.py │ │ ├── test_basic.txt │ │ ├── test_clean.py │ │ ├── test_clean.txt │ │ ├── test_clean_embed.txt │ │ ├── test_diff.py │ │ ├── test_diff.txt │ │ ├── test_elementsoup.py │ │ ├── test_feedparser_data.py │ │ ├── test_formfill.py │ │ ├── test_formfill.txt │ │ ├── test_forms.py │ │ ├── test_forms.txt │ │ ├── test_frames.py │ │ ├── test_html5parser.py │ │ ├── test_rewritelinks.py │ │ ├── test_rewritelinks.txt │ │ ├── test_xhtml.py │ │ ├── test_xhtml.txt │ │ └── transform_feedparser_data.py │ └── usedoctest.py ├── includes │ ├── __init__.py │ ├── c14n.pxd │ ├── config.pxd │ ├── dtdvalid.pxd │ ├── etree_defs.h │ ├── etreepublic.pxd │ ├── htmlparser.pxd │ ├── lxml-version.h │ ├── relaxng.pxd │ ├── schematron.pxd │ ├── tree.pxd │ ├── uri.pxd │ ├── xinclude.pxd │ ├── xmlerror.pxd │ ├── xmlparser.pxd │ ├── xmlschema.pxd │ ├── xpath.pxd │ └── xslt.pxd ├── isoschematron │ ├── __init__.py │ └── resources │ │ ├── rng │ │ └── iso-schematron.rng │ │ └── xsl │ │ ├── RNG2Schtrn.xsl │ │ ├── XSD2Schtrn.xsl │ │ └── iso-schematron-xslt1 │ │ ├── iso_abstract_expand.xsl │ │ ├── iso_dsdl_include.xsl │ │ ├── iso_schematron_message.xsl │ │ ├── iso_schematron_skeleton_for_xslt1.xsl │ │ ├── iso_svrl_for_xslt1.xsl │ │ └── readme.txt ├── iterparse.pxi ├── lxml.etree.c ├── lxml.etree.h ├── lxml.etree.pyx ├── lxml.etree_api.h ├── lxml.objectify.c ├── lxml.objectify.pyx ├── lxml_endian.h ├── nsclasses.pxi ├── objectpath.pxi ├── parser.pxi ├── parsertarget.pxi ├── proxy.pxi ├── public-api.pxi ├── pyclasslookup.py ├── python.pxd ├── readonlytree.pxi ├── relaxng.pxi ├── sax.py ├── saxparser.pxi ├── schematron.pxi ├── serializer.pxi ├── tests │ ├── __init__.py │ ├── common_imports.py │ ├── dummy_http_server.py │ ├── include │ │ └── test_xinclude.xml │ ├── shakespeare.html │ ├── test-document.xslt │ ├── test-string.xml │ ├── test.dtd │ ├── test.sch │ ├── test.xml │ ├── test.xsd │ ├── test1.rng │ ├── test1.xslt │ ├── test2.rng │ ├── test2.xslt │ ├── test_broken.xml │ ├── test_builder.py │ ├── test_classlookup.py │ ├── test_css.py │ ├── test_doctestcompare.py │ ├── test_dtd.py │ ├── test_elementpath.py │ ├── test_elementtree.py │ ├── test_errors.py │ ├── test_etree.py │ ├── test_htmlparser.py │ ├── test_http_io.py │ ├── test_import.xsd │ ├── test_inc.xsd │ ├── test_incremental_xmlfile.py │ ├── test_io.py │ ├── test_isoschematron.py │ ├── test_nsclasses.py │ ├── test_objectify.py │ ├── test_pyclasslookup.py │ ├── test_relaxng.py │ ├── test_sax.py │ ├── test_schematron.py │ ├── test_threading.py │ ├── test_unicode.py │ ├── test_xmlschema.py │ ├── test_xpathevaluator.py │ └── test_xslt.py ├── usedoctest.py ├── xinclude.pxi ├── xmlerror.pxi ├── xmlid.pxi ├── xmlschema.pxi ├── xpath.pxi ├── xslt.pxi └── xsltext.pxi └── post-process └── GamezServerPostProcess.py /GamezServer.Python.pyproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ProjectFiles 5 | 6 | -------------------------------------------------------------------------------- /GamezServer.Python.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "GamezServer.Python", "GamezServer.Python.pyproj", "{75B524C3-7F53-40C1-8A04-DD52D92F90BB}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {75B524C3-7F53-40C1-8A04-DD52D92F90BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {75B524C3-7F53-40C1-8A04-DD52D92F90BB}.Release|Any CPU.ActiveCfg = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /GamezServer.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer.db -------------------------------------------------------------------------------- /GamezServer.ini: -------------------------------------------------------------------------------- 1 | [global] 2 | server.socket_host="127.0.0.1" 3 | server.socket_port=8085 4 | -------------------------------------------------------------------------------- /GamezServer.py: -------------------------------------------------------------------------------- 1 | #import cherrypy 2 | from GamezServer.Service import Service 3 | import os 4 | import sys 5 | 6 | 7 | if __name__ == '__main__': 8 | iniPath = os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])),"GamezServer.ini") 9 | service = Service() 10 | service.Start(iniPath) -------------------------------------------------------------------------------- /GamezServer/Constants.py: -------------------------------------------------------------------------------- 1 | VERSION='0.0.0.1' -------------------------------------------------------------------------------- /GamezServer/DAO.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/DAO.pyc -------------------------------------------------------------------------------- /GamezServer/Searchers.py: -------------------------------------------------------------------------------- 1 | import GamezServer 2 | import urllib 3 | import urllib2 4 | from GamezServer.UsenetCrawler import UsenetCrawler 5 | from GamezServer.DAO import DAO 6 | class Searchers(object): 7 | """description of class""" 8 | 9 | 10 | def GetSearcher(self,searcherName,forceNew): 11 | if(searcherName == "usenetCrawler"): 12 | return UsenetCrawler(forceNew) 13 | return None 14 | 15 | def SendToSab(self,sabnzbdBaseUrl,sabnzbdApiKey,nzbLink,nzbTitle, wantedGameId): 16 | dao = DAO() 17 | nzbTitle = "[" + str(wantedGameId) + "] - " + nzbTitle 18 | category = dao.GetSiteMasterData('sabnzbdCategory') 19 | sabUrl = sabnzbdBaseUrl 20 | if(sabUrl.endswith('/') == False): 21 | sabUrl = sabUrl + "/" 22 | sabUrl = sabUrl + "sabnzbd/api" 23 | sabUrl = sabUrl + "?apikey=" + sabnzbdApiKey 24 | sabUrl = sabUrl + "&mode=addurl&name=" + urllib.quote_plus(nzbLink) 25 | sabUrl = sabUrl + "&nzbname=" + urllib.quote_plus(nzbTitle) 26 | if(category != None and category != ""): 27 | sabUrl = sabUrl + "&cat=" + category 28 | sabRequest = urllib2.Request(sabUrl, headers={'User-Agent' : "GamezServer"}) 29 | response = urllib2.urlopen(sabRequest) 30 | sabRespData = response.read() 31 | return sabRespData 32 | -------------------------------------------------------------------------------- /GamezServer/Searchers.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/Searchers.pyc -------------------------------------------------------------------------------- /GamezServer/Service.py: -------------------------------------------------------------------------------- 1 | from GamezServer import WebServe, Task 2 | import cherrypy 3 | import os 4 | from cherrypy.process.plugins import Monitor 5 | import webbrowser 6 | import GamezServer 7 | from GamezServer.DAO import DAO 8 | from GamezServer.Task import Task 9 | DBPATH="" 10 | APPPATH="" 11 | class Service(object): 12 | def Start(self,configPath): 13 | rootPath = os.path.dirname(configPath) 14 | GamezServer.Service.DBPATH = os.path.join(rootPath, "GamezServer.db") 15 | GamezServer.Service.APPPATH = rootPath 16 | dao = DAO() 17 | dao.VerifyStructue() 18 | 19 | staticContentPath = os.path.join(rootPath, os.path.join("GamezServer","static-web")) 20 | appConfig = {'/static': {'tools.staticdir.on': True, 'tools.staticdir.dir': staticContentPath}} 21 | cherrypy.config.update(configPath) 22 | cherrypy.tree.mount(WebServe.WebServe(), '/', appConfig) 23 | 24 | dao.LogMessage("Registering Background Processes", "Info") 25 | Monitor(cherrypy.engine, GamezServer.Task.Task().UpdateMasterPlatforms, frequency=86400).subscribe() 26 | Monitor(cherrypy.engine, GamezServer.Task.Task().UpdateMasterGames, frequency=86400).subscribe() 27 | Monitor(cherrypy.engine, GamezServer.Task.Task().WantedGameSearch, frequency=86400).subscribe() 28 | dao.LogMessage("Starting Service", "Info") 29 | cherrypy.engine.start() 30 | launchBrowser = dao.GetSiteMasterData("launchBrowser") 31 | if(launchBrowser == "true"): 32 | webbrowser.open("http://" + cherrypy.server.socket_host + ":" + str(cherrypy.server.socket_port) + '/') 33 | cherrypy.engine.block() 34 | 35 | -------------------------------------------------------------------------------- /GamezServer/Service.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/Service.pyc -------------------------------------------------------------------------------- /GamezServer/Task.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/Task.pyc -------------------------------------------------------------------------------- /GamezServer/UsenetCrawler.py: -------------------------------------------------------------------------------- 1 | import GamezServer 2 | from GamezServer.DAO import DAO 3 | import urllib 4 | from xml import etree 5 | from xml.etree import ElementTree 6 | import urllib2 7 | import Searchers 8 | class UsenetCrawler(object): 9 | defaultCategory = "1000" 10 | categories = { 11 | 'Nintendo 3DS': '1011', 12 | 'Sega Dreamcast': '1082', 13 | 'Nintendo Gamecube': '1083', 14 | 'Nintendo DS': '1010', 15 | 'Sony Playstation 2': '1081', 16 | 'Sony Playstation 3': '1080', 17 | 'Sony PSP': '1020', 18 | 'Nintendo Wii': '1030,1060', 19 | 'Microsoft Xbox': '1040', 20 | 'Microsoft Xbox 360': '1050,1070' 21 | }; 22 | 23 | def __init__(self,forceNew=False): 24 | self.forceNew = forceNew 25 | 26 | def search(self, platform, title, wantedGameId): 27 | dao = DAO() 28 | usenetCrawlerEnabled = dao.GetSiteMasterData("usenetCrawlerEnabled") 29 | usenetCrawlerApiKey = dao.GetSiteMasterData("usenetCrawlerApiKey") 30 | sabnzbdEnabled = dao.GetSiteMasterData("sabnzbdEnabled") 31 | sabnzbdApiKey = dao.GetSiteMasterData("sabnzbdApiKey") 32 | sabnzbdBaseUrl= dao.GetSiteMasterData("sabnzbdBaseUrl") 33 | if(usenetCrawlerEnabled != None and usenetCrawlerEnabled == "true" and usenetCrawlerApiKey != None and usenetCrawlerApiKey != "" and sabnzbdEnabled != None and sabnzbdEnabled == "true" and sabnzbdApiKey != None and sabnzbdApiKey != "" and sabnzbdBaseUrl != None and sabnzbdBaseUrl != ""): 34 | return self.SearchAndSendToSab(usenetCrawlerApiKey, sabnzbdApiKey, platform, title, wantedGameId,sabnzbdBaseUrl) 35 | else: 36 | return "" 37 | 38 | def SearchAndSendToSab(self,usenetCrawlerApiKey, sabnzbdApiKey, platform, title, wantedGameId,sabnzbdBaseUrl): 39 | cat = self.categories.get(platform, self.defaultCategory) 40 | usenetCrawlerUrl = "https://www.usenet-crawler.com/api?apikey=" + usenetCrawlerApiKey + "&t=search&q="+ urllib.quote_plus(title) + "&sort=posted_desc&cat=" + cat 41 | 42 | webRequest = urllib2.Request(usenetCrawlerUrl, None, {'User-Agent' : "GamezServer"}) 43 | response = urllib2.urlopen(webRequest) 44 | gameData = response.read() 45 | treeData =ElementTree.fromstring(gameData) 46 | for matchedElement in treeData.findall('./channel/item'): 47 | nzbTitle = matchedElement.find('title').text 48 | nzbLink = matchedElement.find('link').text 49 | usenetCrawlerNzbId = matchedElement.find("guid").text.split('/')[len(matchedElement.find("guid").text.split('/'))-1] 50 | if(self.forceNew): 51 | continue 52 | searchers = Searchers.Searchers() 53 | sabRespData = searchers.SendToSab(sabnzbdBaseUrl,sabnzbdApiKey,nzbLink, nzbTitle, wantedGameId) 54 | if(sabRespData == b'ok\n'): 55 | dao = DAO() 56 | dao.LogMessage("Snatched Game" + nzbTitle, "Info") 57 | dao.UpdateWantedGameStatus(wantedGameId, "Snatched") 58 | dao.AddSnatchedHistory("usenetCrawler", usenetCrawlerNzbId) 59 | return "Snatched Game: " + nzbTitle 60 | 61 | 62 | -------------------------------------------------------------------------------- /GamezServer/UsenetCrawler.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/UsenetCrawler.pyc -------------------------------------------------------------------------------- /GamezServer/WebServe.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/WebServe.pyc -------------------------------------------------------------------------------- /GamezServer/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/__init__.py -------------------------------------------------------------------------------- /GamezServer/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/__init__.pyc -------------------------------------------------------------------------------- /GamezServer/__pycache__/DAO.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/__pycache__/DAO.cpython-34.pyc -------------------------------------------------------------------------------- /GamezServer/__pycache__/Searchers.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/__pycache__/Searchers.cpython-34.pyc -------------------------------------------------------------------------------- /GamezServer/__pycache__/Service.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/__pycache__/Service.cpython-34.pyc -------------------------------------------------------------------------------- /GamezServer/__pycache__/Task.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/__pycache__/Task.cpython-34.pyc -------------------------------------------------------------------------------- /GamezServer/__pycache__/UsenetCrawler.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/__pycache__/UsenetCrawler.cpython-34.pyc -------------------------------------------------------------------------------- /GamezServer/__pycache__/WebServe.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/__pycache__/WebServe.cpython-34.pyc -------------------------------------------------------------------------------- /GamezServer/__pycache__/__init__.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/__pycache__/__init__.cpython-34.pyc -------------------------------------------------------------------------------- /GamezServer/static-web/scripts/Menu.js: -------------------------------------------------------------------------------- 1 | ( function( $ ) { 2 | $( document ).ready(function() { 3 | $('#cssmenu').prepend('
'); 4 | var activeElement = $('#cssmenu>ul>li:first'); 5 | 6 | $('#cssmenu>ul>li').each(function() { 7 | if ($(this).hasClass('active')) { 8 | activeElement = $(this); 9 | } 10 | }); 11 | 12 | 13 | var posLeft = activeElement.position().left; 14 | var elementWidth = activeElement.width(); 15 | posLeft = posLeft + elementWidth/2 -6; 16 | if (activeElement.hasClass('has-sub')) { 17 | posLeft -= 6; 18 | } 19 | 20 | $('#cssmenu #pIndicator').css('left', posLeft); 21 | var element, leftPos, indicator = $('#cssmenu pIndicator'); 22 | 23 | $("#cssmenu>ul>li").hover(function() { 24 | element = $(this); 25 | var w = element.width(); 26 | if ($(this).hasClass('has-sub')) 27 | { 28 | leftPos = element.position().left + w/2 - 12; 29 | } 30 | else { 31 | leftPos = element.position().left + w/2 - 6; 32 | } 33 | 34 | $('#cssmenu #pIndicator').css('left', leftPos); 35 | } 36 | , function() { 37 | $('#cssmenu #pIndicator').css('left', posLeft); 38 | }); 39 | 40 | $('#cssmenu>ul').prepend(''); 41 | $( "#menu-button" ).click(function(){ 42 | if ($(this).parent().hasClass('open')) { 43 | $(this).parent().removeClass('open'); 44 | } 45 | else { 46 | $(this).parent().addClass('open'); 47 | } 48 | }); 49 | }); 50 | } )( jQuery ); 51 | -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/Sorting icons.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/Sorting icons.psd -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/favicon.ico -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/sort_asc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/sort_asc.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/sort_asc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/sort_asc_disabled.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/sort_both.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/sort_both.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/sort_desc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/sort_desc.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/sort_desc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/sort_desc_disabled.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/ui-bg_diagonals-small_25_c5ddfc_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/ui-bg_diagonals-small_25_c5ddfc_40x40.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/ui-bg_diagonals-thick_20_e69700_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/ui-bg_diagonals-thick_20_e69700_40x40.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/ui-bg_diagonals-thick_22_1484e6_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/ui-bg_diagonals-thick_22_1484e6_40x40.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/ui-bg_diagonals-thick_26_2293f7_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/ui-bg_diagonals-thick_26_2293f7_40x40.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/ui-bg_flat_0_e69700_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/ui-bg_flat_0_e69700_40x100.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/ui-bg_flat_0_e6b900_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/ui-bg_flat_0_e6b900_40x100.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/ui-bg_highlight-soft_100_f9f9f9_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/ui-bg_highlight-soft_100_f9f9f9_1x100.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/ui-bg_inset-hard_100_eeeeee_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/ui-bg_inset-hard_100_eeeeee_1x100.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/ui-icons_0a82eb_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/ui-icons_0a82eb_256x240.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/ui-icons_0b54d5_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/ui-icons_0b54d5_256x240.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/ui-icons_5fa5e3_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/ui-icons_5fa5e3_256x240.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/ui-icons_fcdd4a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/ui-icons_fcdd4a_256x240.png -------------------------------------------------------------------------------- /GamezServer/static-web/styles/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/GamezServer/static-web/styles/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /OpenSSL/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | # __init__.py 3 | # 4 | # Copyright (C) AB Strakt 2001, All rights reserved 5 | # 6 | # $Id: __init__.py,v 1.4 2004/07/22 12:01:25 martin Exp $ 7 | # 8 | """ 9 | pyOpenSSL - A simple wrapper around the OpenSSL library 10 | """ 11 | 12 | import sys 13 | 14 | try: 15 | orig = sys.getdlopenflags() 16 | except AttributeError: 17 | from OpenSSL import crypto 18 | else: 19 | try: 20 | import DLFCN 21 | except ImportError: 22 | try: 23 | import dl 24 | except ImportError: 25 | try: 26 | import ctypes 27 | except ImportError: 28 | flags = 2 | 256 29 | else: 30 | flags = 2 | ctypes.RTLD_GLOBAL 31 | del ctypes 32 | else: 33 | flags = dl.RTLD_NOW | dl.RTLD_GLOBAL 34 | del dl 35 | else: 36 | flags = DLFCN.RTLD_NOW | DLFCN.RTLD_GLOBAL 37 | del DLFCN 38 | 39 | sys.setdlopenflags(flags) 40 | from OpenSSL import crypto 41 | sys.setdlopenflags(orig) 42 | del orig, flags 43 | del sys 44 | 45 | from OpenSSL import rand, SSL 46 | from OpenSSL.version import __version__ 47 | 48 | __all__ = [ 49 | 'rand', 'crypto', 'SSL', 'tsafe', '__version__'] 50 | -------------------------------------------------------------------------------- /OpenSSL/crypto/crl.h: -------------------------------------------------------------------------------- 1 | #ifndef PyOpenSSL_crypto_CRL_H_ 2 | #define PyOpenSSL_crypto_CRL_H_ 3 | 4 | #include 5 | 6 | extern int init_crypto_crl (PyObject *); 7 | 8 | extern PyTypeObject crypto_CRL_Type; 9 | 10 | #define crypto_CRL_Check(v) ((v)->ob_type == &crypto_CRL_Type) 11 | 12 | typedef struct { 13 | PyObject_HEAD 14 | X509_CRL *crl; 15 | } crypto_CRLObj; 16 | 17 | crypto_CRLObj * crypto_CRL_New(X509_CRL *crl); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /OpenSSL/crypto/netscape_spki.h: -------------------------------------------------------------------------------- 1 | /* 2 | * netscape_spki.h 3 | * 4 | * Copyright (C) Tollef Fog Heen 2003, All rights reserved 5 | * 6 | * Handle Netscape SPKI (challenge response) certificate requests. 7 | * 8 | * 9 | */ 10 | #ifndef PyOpenSSL_crypto_Netscape_SPKI_H_ 11 | #define PyOpenSSL_crypto_Netscape_SPKI_H_ 12 | 13 | #include 14 | #include 15 | 16 | extern int init_crypto_netscape_spki (PyObject *); 17 | 18 | extern PyTypeObject crypto_NetscapeSPKI_Type; 19 | 20 | #define crypto_NetscapeSPKI_Check(v) ((v)->ob_type == &crypto_NetscapeSPKI_Type) 21 | 22 | typedef struct { 23 | PyObject_HEAD 24 | NETSCAPE_SPKI *netscape_spki; 25 | int dealloc; 26 | } crypto_NetscapeSPKIObj; 27 | 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /OpenSSL/crypto/pkcs12.h: -------------------------------------------------------------------------------- 1 | /* 2 | * pkcs12.h 3 | * 4 | * Copyright (C) AB Strakt 2001, All rights reserved 5 | * 6 | * Export PKCS12 functions and data structure. 7 | * 8 | * @(#) $$ 9 | */ 10 | #ifndef PyOpenSSL_crypto_PKCS12_H_ 11 | #define PyOpenSSL_crypto_PKCS12_H_ 12 | 13 | #include 14 | #include 15 | #include 16 | 17 | extern int init_crypto_pkcs12 (PyObject *); 18 | 19 | extern PyTypeObject crypto_PKCS12_Type; 20 | 21 | #define crypto_PKCS12_Check(v) ((v)->ob_type == &crypto_PKCS12_Type) 22 | 23 | typedef struct { 24 | PyObject_HEAD 25 | /* 26 | * These either refer to a PyObject* of the appropriate type, or Py_None if 27 | * they don't have a value. They aren't set to NULL except during 28 | * finalization. 29 | */ 30 | PyObject *cert; 31 | PyObject *key; 32 | PyObject *cacerts; 33 | PyObject *friendlyname; 34 | } crypto_PKCS12Obj; 35 | 36 | crypto_PKCS12Obj * 37 | crypto_PKCS12_New(PKCS12 *p12, char *passphrase); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /OpenSSL/crypto/pkcs7.h: -------------------------------------------------------------------------------- 1 | /* 2 | * pkcs7.h 3 | * 4 | * Copyright (C) AB Strakt 2002, All rights reserved 5 | * 6 | * Export pkcs7 functions and data structure. 7 | * See the file RATIONALE for a short explanation of why this module was written. 8 | * 9 | * @(#) $Id: pkcs7.h,v 1.2 2002/09/04 22:24:59 iko Exp $ 10 | */ 11 | #ifndef PyOpenSSL_crypto_PKCS7_H_ 12 | #define PyOpenSSL_crypto_PKCS7_H_ 13 | 14 | #include 15 | #include 16 | 17 | extern int init_crypto_pkcs7 (PyObject *); 18 | 19 | extern PyTypeObject crypto_PKCS7_Type; 20 | 21 | #define crypto_PKCS7_Check(v) ((v)->ob_type == &crypto_PKCS7_Type) 22 | 23 | typedef struct { 24 | PyObject_HEAD 25 | PKCS7 *pkcs7; 26 | int dealloc; 27 | } crypto_PKCS7Obj; 28 | 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /OpenSSL/crypto/pkey.h: -------------------------------------------------------------------------------- 1 | /* 2 | * pkey.h 3 | * 4 | * Copyright (C) AB Strakt 2001, All rights reserved 5 | * Copyright (C) Jean-Paul Calderone 2008, All rights reserved 6 | * 7 | * Export pkey functions and data structure. 8 | * See the file RATIONALE for a short explanation of why this module was written. 9 | * 10 | * @(#) $Id: pkey.h,v 1.5 2002/09/04 22:24:59 iko Exp $ 11 | */ 12 | #ifndef PyOpenSSL_crypto_PKEY_H_ 13 | #define PyOpenSSL_crypto_PKEY_H_ 14 | 15 | extern int init_crypto_pkey (PyObject *); 16 | 17 | extern PyTypeObject crypto_PKey_Type; 18 | 19 | #define crypto_PKey_Check(v) ((v)->ob_type == &crypto_PKey_Type) 20 | 21 | typedef struct { 22 | PyObject_HEAD 23 | 24 | /* 25 | * A pointer to the underlying OpenSSL structure. 26 | */ 27 | EVP_PKEY *pkey; 28 | 29 | /* 30 | * A flag indicating the underlying pkey object has no private parts (so it 31 | * can't sign, for example). This is a bit of a temporary hack. 32 | * Public-only should be represented as a different type. -exarkun 33 | */ 34 | int only_public; 35 | 36 | /* 37 | * A flag indicating whether the underlying pkey object has no meaningful 38 | * data in it whatsoever. This is a temporary hack. It should be 39 | * impossible to create PKeys in an unusable state. -exarkun 40 | */ 41 | int initialized; 42 | 43 | /* 44 | * A flag indicating whether pkey will be freed when this object is freed. 45 | */ 46 | int dealloc; 47 | } crypto_PKeyObj; 48 | 49 | #define crypto_TYPE_RSA EVP_PKEY_RSA 50 | #define crypto_TYPE_DSA EVP_PKEY_DSA 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /OpenSSL/crypto/revoked.h: -------------------------------------------------------------------------------- 1 | #ifndef PyOpenSSL_crypto_REVOKED_H_ 2 | #define PyOpenSSL_crypto_REVOKED_H_ 3 | 4 | #include 5 | 6 | extern PyTypeObject crypto_Revoked_Type; 7 | 8 | #define crypto_Revoked_Check(v) ((v)->ob_type == &crypto_Revoked_Type) 9 | 10 | typedef struct { 11 | PyObject_HEAD 12 | X509_REVOKED *revoked; 13 | } crypto_RevokedObj; 14 | 15 | extern int init_crypto_revoked (PyObject *); 16 | extern crypto_RevokedObj * crypto_Revoked_New(X509_REVOKED *revoked); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /OpenSSL/crypto/x509.h: -------------------------------------------------------------------------------- 1 | /* 2 | * x509.h 3 | * 4 | * Copyright (C) AB Strakt 2001, All rights reserved 5 | * 6 | * Export x509 functions and data structure. 7 | * See the file RATIONALE for a short explanation of why this module was written. 8 | * 9 | * Reviewed 2001-07-23 10 | * 11 | * @(#) $Id: x509.h,v 1.9 2002/09/04 22:24:59 iko Exp $ 12 | */ 13 | #ifndef PyOpenSSL_crypto_X509_H_ 14 | #define PyOpenSSL_crypto_X509_H_ 15 | 16 | #include 17 | #include 18 | 19 | extern PyTypeObject crypto_X509_Type; 20 | 21 | #define crypto_X509_Check(v) ((v)->ob_type == &crypto_X509_Type) 22 | 23 | typedef struct { 24 | PyObject_HEAD 25 | X509 *x509; 26 | int dealloc; 27 | } crypto_X509Obj; 28 | 29 | PyObject* _set_asn1_time(char *format, ASN1_TIME* timestamp, PyObject *args); 30 | PyObject* _get_asn1_time(char *format, ASN1_TIME* timestamp, PyObject *args); 31 | extern int init_crypto_x509 (PyObject *); 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /OpenSSL/crypto/x509ext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * x509ext.h 3 | * 4 | * Copyright (C) Awanim 2002, All rights reserved 5 | * 6 | * Export X.509 extension functions and data structures. 7 | * See the file RATIONALE for a short explanation of why this module was written. 8 | * 9 | * @(#) $Id: x509ext.h,v 1.2 2002/09/04 22:24:59 iko Exp $ 10 | */ 11 | #ifndef PyOpenSSL_crypto_X509EXTENSION_H_ 12 | #define PyOpenSSL_crypto_X509EXTENSION_H_ 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | extern int init_crypto_x509extension (PyObject *); 19 | 20 | extern PyTypeObject crypto_X509Extension_Type; 21 | 22 | #define crypto_X509Extension_Check(v) ( \ 23 | PyObject_TypeCheck((v), \ 24 | &crypto_X509Extension_Type)) 25 | 26 | typedef struct { 27 | PyObject_HEAD 28 | X509_EXTENSION *x509_extension; 29 | int dealloc; 30 | } crypto_X509ExtensionObj; 31 | 32 | #endif 33 | 34 | -------------------------------------------------------------------------------- /OpenSSL/crypto/x509name.h: -------------------------------------------------------------------------------- 1 | /* 2 | * x509name.h 3 | * 4 | * Copyright (C) AB Strakt 2001, All rights reserved 5 | * 6 | * Export X.509 name functions and data structures. 7 | * See the file RATIONALE for a short explanation of why this module was written. 8 | * 9 | * Reviewed 2001-07-23 10 | * 11 | * @(#) $Id: x509name.h,v 1.8 2002/09/04 22:24:59 iko Exp $ 12 | */ 13 | #ifndef PyOpenSSL_crypto_X509NAME_H_ 14 | #define PyOpenSSL_crypto_X509NAME_H_ 15 | 16 | #include 17 | #include 18 | 19 | extern int init_crypto_x509name (PyObject *); 20 | 21 | extern PyTypeObject crypto_X509Name_Type; 22 | 23 | #define crypto_X509Name_Check(v) ((v)->ob_type == &crypto_X509Name_Type) 24 | 25 | typedef struct { 26 | PyObject_HEAD 27 | X509_NAME *x509_name; 28 | int dealloc; 29 | PyObject *parent_cert; 30 | } crypto_X509NameObj; 31 | 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /OpenSSL/crypto/x509req.h: -------------------------------------------------------------------------------- 1 | /* 2 | * x509req.h 3 | * 4 | * Copyright (C) AB Strakt 2001, All rights reserved 5 | * 6 | * Export X509 request functions and data structures. 7 | * See the file RATIONALE for a short explanation of why this module was written. 8 | * 9 | * @(#) $Id: x509req.h,v 1.6 2002/09/04 22:24:59 iko Exp $ 10 | */ 11 | #ifndef PyOpenSSL_SSL_X509REQ_H_ 12 | #define PyOpenSSL_SSL_X509REQ_H_ 13 | 14 | #include 15 | #include 16 | 17 | extern int init_crypto_x509req (PyObject *); 18 | 19 | extern PyTypeObject crypto_X509Req_Type; 20 | 21 | #define crypto_X509Req_Check(v) ((v)->ob_type == &crypto_X509Req_Type) 22 | 23 | typedef struct { 24 | PyObject_HEAD 25 | X509_REQ *x509_req; 26 | int dealloc; 27 | } crypto_X509ReqObj; 28 | 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /OpenSSL/crypto/x509store.h: -------------------------------------------------------------------------------- 1 | /* 2 | * x509store.h 3 | * 4 | * Copyright (C) AB Strakt 2001, All rights reserved 5 | * 6 | * Export X509 store functions and data structures. 7 | * See the file RATIONALE for a short explanation of why this module was written. 8 | * 9 | * @(#) $Id: x509store.h,v 1.4 2002/09/04 22:24:59 iko Exp $ 10 | */ 11 | #ifndef PyOpenSSL_SSL_X509STORE_H_ 12 | #define PyOpenSSL_SSL_X509STORE_H_ 13 | 14 | #include 15 | #include 16 | 17 | extern int init_crypto_x509store (PyObject *); 18 | 19 | extern PyTypeObject crypto_X509Store_Type; 20 | 21 | #define crypto_X509Store_Check(v) ((v)->ob_type == &crypto_X509Store_Type) 22 | 23 | typedef struct { 24 | PyObject_HEAD 25 | X509_STORE *x509_store; 26 | int dealloc; 27 | } crypto_X509StoreObj; 28 | 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /OpenSSL/py3k.h: -------------------------------------------------------------------------------- 1 | #ifndef PyOpenSSL_PY3K_H_ 2 | #define PyOpenSSL_PY3K_H_ 3 | 4 | #if (PY_VERSION_HEX >= 0x03000000) 5 | 6 | #define PY3 7 | 8 | #define PyOpenSSL_MODINIT(name) \ 9 | PyMODINIT_FUNC \ 10 | PyInit_##name(void) 11 | 12 | #define PyText_CheckExact PyUnicode_CheckExact 13 | #define PyText_FromString PyUnicode_FromString 14 | #define PyText_FromStringAndSize PyUnicode_FromStringAndSize 15 | 16 | #define PyOpenSSL_HEAD_INIT(type, size) PyVarObject_HEAD_INIT(NULL, size) 17 | 18 | #define PyOpenSSL_Integer_Check(o) PyLong_Check(o) 19 | 20 | #define PyOpenSSL_MODRETURN(module) { return module; } 21 | 22 | #define BYTESTRING_FMT "y" 23 | 24 | #else /* (PY_VERSION_HEX >= 0x03000000) */ 25 | 26 | #define PyOpenSSL_MODRETURN(module) { return; } 27 | 28 | #define PyOpenSSL_HEAD_INIT(type, size) PyObject_HEAD_INIT(NULL) 0, 29 | 30 | #define PyBytes_FromStringAndSize PyString_FromStringAndSize 31 | 32 | #define PyOpenSSL_Integer_Check(o) (PyInt_Check(o) || PyLong_Check(o)) 33 | 34 | #define PyBytes_Size PyString_Size 35 | #define PyBytes_Check PyString_Check 36 | #define PyBytes_CheckExact PyString_CheckExact 37 | #define PyBytes_AsString PyString_AsString 38 | #define PyBytes_FromString PyString_FromString 39 | #define PyBytes_FromStringAndSize PyString_FromStringAndSize 40 | #define _PyBytes_Resize _PyString_Resize 41 | 42 | #define PyText_CheckExact PyString_CheckExact 43 | #define PyText_FromString PyString_FromString 44 | #define PyText_FromStringAndSize PyString_FromStringAndSize 45 | 46 | #define PyOpenSSL_MODINIT(name) \ 47 | void \ 48 | init##name(void) 49 | 50 | #define BYTESTRING_FMT "s" 51 | 52 | #endif /* (PY_VERSION_HEX >= 0x03000000) */ 53 | 54 | #endif /* PyOpenSSL_PY3K_H_ */ 55 | 56 | -------------------------------------------------------------------------------- /OpenSSL/ssl/connection.h: -------------------------------------------------------------------------------- 1 | /* 2 | * connection.h 3 | * 4 | * Copyright (C) AB Strakt 2001, All rights reserved 5 | * 6 | * Export SSL Connection data structures and functions. 7 | * See the file RATIONALE for a short explanation of why this module was written. 8 | * 9 | * Reviewed 2001-07-23 10 | * 11 | * @(#) $Id: connection.h,v 1.11 2002/09/04 22:24:59 iko Exp $ 12 | */ 13 | #ifndef PyOpenSSL_SSL_CONNECTION_H_ 14 | #define PyOpenSSL_SSL_CONNECTION_H_ 15 | 16 | #include 17 | #include 18 | 19 | /* shamelessly stolen from socketmodule.c */ 20 | #ifdef MS_WINDOWS 21 | # include 22 | typedef SOCKET SOCKET_T; 23 | # ifdef MS_WIN64 24 | # define SIZEOF_SOCKET_T 8 25 | # else 26 | # define SIZEOF_SOCKET_T 4 27 | # endif 28 | #else 29 | typedef int SOCKET_T; 30 | # define SIZEOF_SOCKET_T SIZEOF_INT 31 | #endif 32 | 33 | 34 | extern int init_ssl_connection (PyObject *); 35 | 36 | extern PyTypeObject ssl_Connection_Type; 37 | 38 | #define ssl_Connection_Check(v) ((v)->ob_type == &ssl_Connection_Type) 39 | 40 | typedef struct { 41 | PyObject_HEAD 42 | SSL *ssl; 43 | ssl_ContextObj *context; 44 | PyObject *socket; 45 | PyThreadState *tstate; /* This field is no longer used. */ 46 | PyObject *app_data; 47 | BIO *into_ssl, *from_ssl; /* for connections without file descriptors */ 48 | } ssl_ConnectionObj; 49 | 50 | 51 | 52 | #endif 53 | 54 | -------------------------------------------------------------------------------- /OpenSSL/ssl/context.h: -------------------------------------------------------------------------------- 1 | /* 2 | * context.h 3 | * 4 | * Copyright (C) AB Strakt 2001, All rights reserved 5 | * 6 | * Export SSL Context object data structures and functions. 7 | * See the file RATIONALE for a short explanation of why this module was written. 8 | * 9 | * Reviewed 2001-07-23 10 | * 11 | * @(#) $Id: context.h,v 1.6 2002/09/04 22:24:59 iko Exp $ 12 | */ 13 | #ifndef PyOpenSSL_SSL_CONTEXT_H_ 14 | #define PyOpenSSL_SSL_CONTEXT_H_ 15 | 16 | #include 17 | #include 18 | 19 | extern int init_ssl_context (PyObject *); 20 | 21 | extern PyTypeObject ssl_Context_Type; 22 | 23 | #define ssl_Context_Check(v) ((v)->ob_type == &ssl_Context_Type) 24 | 25 | typedef struct { 26 | PyObject_HEAD 27 | SSL_CTX *ctx; 28 | PyObject *passphrase_callback, 29 | *passphrase_userdata, 30 | *verify_callback, 31 | *info_callback, 32 | *app_data; 33 | PyThreadState *tstate; 34 | } ssl_ContextObj; 35 | 36 | #define ssl_SSLv2_METHOD (1) 37 | #define ssl_SSLv3_METHOD (2) 38 | #define ssl_SSLv23_METHOD (3) 39 | #define ssl_TLSv1_METHOD (4) 40 | 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /OpenSSL/ssl/ssl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ssl.h 3 | * 4 | * Copyright (C) AB Strakt 2001, All rights reserved 5 | * 6 | * Export functions and exceptions from the SSL sub module. 7 | * See the file RATIONALE for a short explanation of why this module was written. 8 | * 9 | * Reviewed 2001-07-23 10 | * 11 | * @(#) $Id: ssl.h,v 1.6 2002/04/08 19:25:43 martin Exp $ 12 | */ 13 | #ifndef PyOpenSSL_SSL_H_ 14 | #define PyOpenSSL_SSL_H_ 15 | 16 | #include 17 | #include 18 | #include "context.h" 19 | #include "connection.h" 20 | #include "../util.h" 21 | #include "../crypto/crypto.h" 22 | 23 | extern PyObject *ssl_Error, /* Base class */ 24 | *ssl_ZeroReturnError, /* Used with SSL_get_erorr */ 25 | *ssl_WantReadError, /* ... */ 26 | *ssl_WantWriteError, /* ... */ 27 | *ssl_WantX509LookupError, /* ... */ 28 | *ssl_SysCallError; /* Uses (errno,errstr) */ 29 | 30 | #define ssl_Context_New_NUM 0 31 | #define ssl_Context_New_RETURN ssl_ContextObj * 32 | #define ssl_Context_New_PROTO (int method) 33 | 34 | #define ssl_Connection_New_NUM 1 35 | #define ssl_Connection_New_RETURN ssl_ConnectionObj * 36 | #define ssl_Connection_New_PROTO (ssl_ContextObj *ctx, PyObject *sock) 37 | 38 | #define ssl_API_pointers 2 39 | 40 | #ifdef WITH_THREAD 41 | extern int _pyOpenSSL_tstate_key; 42 | #endif /* WITH_THREAD */ 43 | 44 | #ifdef SSL_MODULE 45 | 46 | extern ssl_Context_New_RETURN ssl_Context_New ssl_Context_New_PROTO; 47 | extern ssl_Connection_New_RETURN ssl_Connection_New ssl_Connection_New_PROTO; 48 | 49 | extern crypto_X509Obj* (*new_x509)(X509*, int); 50 | extern crypto_X509NameObj* (*new_x509name)(X509_NAME*, int); 51 | extern crypto_X509StoreObj* (*new_x509store)(X509_STORE*, int); 52 | 53 | #else /* SSL_MODULE */ 54 | 55 | extern void **ssl_API; 56 | 57 | #define ssl_Context_New \ 58 | (*(ssl_Context_New_RETURN (*)ssl_Context_New_PROTO) ssl_API[ssl_Context_New_NUM]) 59 | #define ssl_Connection_New \ 60 | (*(ssl_Connection_New_RETURN (*)ssl_Connection_New_PROTO) ssl_API[ssl_Connection_New_NUM]) 61 | 62 | #define import_SSL() \ 63 | { \ 64 | PyObject *module = PyImport_ImportModule("OpenSSL.SSL"); \ 65 | if (module != NULL) { \ 66 | PyObject *module_dict = PyModule_GetDict(module); \ 67 | PyObject *c_api_object = PyDict_GetItemString(module_dict, "_C_API"); \ 68 | if (PyCObject_Check(c_api_object)) { \ 69 | ssl_API = (void **)PyCObject_AsVoidPtr(c_api_object); \ 70 | } \ 71 | } \ 72 | } 73 | 74 | #endif /* SSL_MODULE */ 75 | 76 | #endif /* PyOpenSSL_SSL_H_ */ 77 | -------------------------------------------------------------------------------- /OpenSSL/test/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) Jean-Paul Calderone 2008, All rights reserved 2 | 3 | """ 4 | Package containing unit tests for L{OpenSSL}. 5 | """ 6 | -------------------------------------------------------------------------------- /OpenSSL/tsafe.py: -------------------------------------------------------------------------------- 1 | from OpenSSL import SSL 2 | _ssl = SSL 3 | del SSL 4 | 5 | import threading 6 | _RLock = threading.RLock 7 | del threading 8 | 9 | class Connection: 10 | def __init__(self, *args): 11 | self._ssl_conn = apply(_ssl.Connection, args) 12 | self._lock = _RLock() 13 | 14 | for f in ('get_context', 'pending', 'send', 'write', 'recv', 'read', 15 | 'renegotiate', 'bind', 'listen', 'connect', 'accept', 16 | 'setblocking', 'fileno', 'shutdown', 'close', 'get_cipher_list', 17 | 'getpeername', 'getsockname', 'getsockopt', 'setsockopt', 18 | 'makefile', 'get_app_data', 'set_app_data', 'state_string', 19 | 'sock_shutdown', 'get_peer_certificate', 'want_read', 20 | 'want_write', 'set_connect_state', 'set_accept_state', 21 | 'connect_ex', 'sendall'): 22 | exec("""def %s(self, *args): 23 | self._lock.acquire() 24 | try: 25 | return self._ssl_conn.%s(*args) 26 | finally: 27 | self._lock.release()\n""" % (f, f)) 28 | 29 | -------------------------------------------------------------------------------- /OpenSSL/util.c: -------------------------------------------------------------------------------- 1 | /* 2 | * util.c 3 | * 4 | * Copyright (C) AB Strakt 2001, All rights reserved 5 | * Copyright (C) Jean-Paul Calderone 2009, All rights reserved 6 | * 7 | * Utility functions. 8 | * See the file RATIONALE for a short explanation of why this module was written. 9 | * 10 | * Reviewed 2001-07-23 11 | */ 12 | #include 13 | #include "util.h" 14 | 15 | /* 16 | * Flush OpenSSL's error queue and return a list of errors (a (library, 17 | * function, reason) string tuple) 18 | * 19 | * Arguments: None 20 | * Returns: A list of errors (new reference) 21 | */ 22 | PyObject * 23 | error_queue_to_list(void) { 24 | PyObject *errlist, *tuple; 25 | long err; 26 | 27 | errlist = PyList_New(0); 28 | 29 | while ((err = ERR_get_error()) != 0) { 30 | tuple = Py_BuildValue("(sss)", ERR_lib_error_string(err), 31 | ERR_func_error_string(err), 32 | ERR_reason_error_string(err)); 33 | PyList_Append(errlist, tuple); 34 | Py_DECREF(tuple); 35 | } 36 | 37 | return errlist; 38 | } 39 | 40 | void exception_from_error_queue(PyObject *the_Error) { 41 | PyObject *errlist = error_queue_to_list(); 42 | PyErr_SetObject(the_Error, errlist); 43 | Py_DECREF(errlist); 44 | } 45 | 46 | /* 47 | * Flush OpenSSL's error queue and ignore the result 48 | * 49 | * Arguments: None 50 | * Returns: None 51 | */ 52 | void 53 | flush_error_queue(void) { 54 | /* 55 | * Make sure to save the errors to a local. Py_DECREF might expand such 56 | * that it evaluates its argument more than once, which would lead to 57 | * very nasty things if we just invoked it with error_queue_to_list(). 58 | */ 59 | PyObject *list = error_queue_to_list(); 60 | Py_DECREF(list); 61 | } 62 | 63 | #if (PY_VERSION_HEX < 0x02600000) 64 | PyObject* PyOpenSSL_LongToHex(PyObject *o) { 65 | PyObject *hex = NULL; 66 | PyObject *format = NULL; 67 | PyObject *format_args = NULL; 68 | 69 | if ((format_args = Py_BuildValue("(O)", o)) == NULL) { 70 | goto err; 71 | } 72 | 73 | if ((format = PyString_FromString("%x")) == NULL) { 74 | goto err; 75 | } 76 | 77 | if ((hex = PyString_Format(format, format_args)) == NULL) { 78 | goto err; 79 | } 80 | 81 | return hex; 82 | 83 | err: 84 | if (format_args) { 85 | Py_DECREF(format_args); 86 | } 87 | if (format) { 88 | Py_DECREF(format); 89 | } 90 | if (hex) { 91 | Py_DECREF(hex); 92 | } 93 | return NULL; 94 | } 95 | #endif 96 | -------------------------------------------------------------------------------- /OpenSSL/version.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) AB Strakt 2001-2004, All rights reserved 2 | # Copyright (C) Jean-Paul Calderone 2008-2010, All rights reserved 3 | 4 | """ 5 | pyOpenSSL - A simple wrapper around the OpenSSL library 6 | """ 7 | 8 | __version__ = '0.11' 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Gamez Server 2 | Gamez Server is currently in pre-release development. The 1.0.0 release is slated for 6/1/2015. There may be bugs and minimal functionality in the application. 3 | 4 | Gamez Server is an automated downloader for video games. The user adds the games they wish to download and Gamez will attempt to find the game and download it. 5 | 6 | Requirements: 7 | * Python 2.7 8 | * Post processing currently only supported on Windows 9 | 10 | Current Functionality: 11 | * Syncs Games from the Game DB 12 | * Supports all platforms on the Game DB 13 | * Add Individual Game 14 | * Add All Games by Platform 15 | * Configurable Header 16 | * Configurable Footer 17 | * Sabnzbd+ Integration 18 | * Usenet-Crawler Search Provider 19 | * Simple Post Processing 20 | * Force Search 21 | * Force Search for new (previously un-snatched) 22 | * Configurable Search Provider Search Order 23 | * Automated Upgrade Search and One-Click Upgrade 24 | * Auto-Searches Game When Added 25 | * Configuration to always try new version 26 | * Configuration to auto-open browser on start 27 | * Status Management 28 | 29 | Future Plans 30 | * Additional Search Providers 31 | * Add Blackhole Torrent Downloader 32 | * Add Notifications 33 | * Add Configuration to limit extensions for files copied during post process 34 | * Add Configuration to delete source folder after post processing is complete 35 | * Add Cover Art 36 | * Add Upcoming Releases Page 37 | -------------------------------------------------------------------------------- /cherrypy/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2011, CherryPy Team (team@cherrypy.org) 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, 5 | are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | * Neither the name of the CherryPy Team nor the names of its contributors 13 | may be used to endorse or promote products derived from this software 14 | without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /cherrypy/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/__init__.pyc -------------------------------------------------------------------------------- /cherrypy/__pycache__/__init__.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/__pycache__/__init__.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/__pycache__/_cpchecker.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/__pycache__/_cpchecker.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/__pycache__/_cpcompat.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/__pycache__/_cpcompat.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/__pycache__/_cpconfig.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/__pycache__/_cpconfig.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/__pycache__/_cpdispatch.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/__pycache__/_cpdispatch.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/__pycache__/_cperror.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/__pycache__/_cperror.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/__pycache__/_cplogging.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/__pycache__/_cplogging.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/__pycache__/_cpreqbody.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/__pycache__/_cpreqbody.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/__pycache__/_cprequest.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/__pycache__/_cprequest.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/__pycache__/_cpserver.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/__pycache__/_cpserver.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/__pycache__/_cptools.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/__pycache__/_cptools.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/__pycache__/_cptree.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/__pycache__/_cptree.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/__pycache__/_cpwsgi.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/__pycache__/_cpwsgi.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/__pycache__/_cpwsgi_server.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/__pycache__/_cpwsgi_server.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/_cpchecker.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/_cpchecker.pyc -------------------------------------------------------------------------------- /cherrypy/_cpcompat.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/_cpcompat.pyc -------------------------------------------------------------------------------- /cherrypy/_cpconfig.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/_cpconfig.pyc -------------------------------------------------------------------------------- /cherrypy/_cpdispatch.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/_cpdispatch.pyc -------------------------------------------------------------------------------- /cherrypy/_cperror.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/_cperror.pyc -------------------------------------------------------------------------------- /cherrypy/_cplogging.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/_cplogging.pyc -------------------------------------------------------------------------------- /cherrypy/_cpreqbody.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/_cpreqbody.pyc -------------------------------------------------------------------------------- /cherrypy/_cprequest.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/_cprequest.pyc -------------------------------------------------------------------------------- /cherrypy/_cpserver.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/_cpserver.pyc -------------------------------------------------------------------------------- /cherrypy/_cptools.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/_cptools.pyc -------------------------------------------------------------------------------- /cherrypy/_cptree.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/_cptree.pyc -------------------------------------------------------------------------------- /cherrypy/_cpwsgi.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/_cpwsgi.pyc -------------------------------------------------------------------------------- /cherrypy/_cpwsgi_server.py: -------------------------------------------------------------------------------- 1 | """WSGI server interface (see PEP 333). This adds some CP-specific bits to 2 | the framework-agnostic wsgiserver package. 3 | """ 4 | import sys 5 | 6 | import cherrypy 7 | from cherrypy import wsgiserver 8 | 9 | 10 | class CPWSGIServer(wsgiserver.CherryPyWSGIServer): 11 | 12 | """Wrapper for wsgiserver.CherryPyWSGIServer. 13 | 14 | wsgiserver has been designed to not reference CherryPy in any way, 15 | so that it can be used in other frameworks and applications. Therefore, 16 | we wrap it here, so we can set our own mount points from cherrypy.tree 17 | and apply some attributes from config -> cherrypy.server -> wsgiserver. 18 | """ 19 | 20 | def __init__(self, server_adapter=cherrypy.server): 21 | self.server_adapter = server_adapter 22 | self.max_request_header_size = ( 23 | self.server_adapter.max_request_header_size or 0 24 | ) 25 | self.max_request_body_size = ( 26 | self.server_adapter.max_request_body_size or 0 27 | ) 28 | 29 | server_name = (self.server_adapter.socket_host or 30 | self.server_adapter.socket_file or 31 | None) 32 | 33 | self.wsgi_version = self.server_adapter.wsgi_version 34 | s = wsgiserver.CherryPyWSGIServer 35 | s.__init__(self, server_adapter.bind_addr, cherrypy.tree, 36 | self.server_adapter.thread_pool, 37 | server_name, 38 | max=self.server_adapter.thread_pool_max, 39 | request_queue_size=self.server_adapter.socket_queue_size, 40 | timeout=self.server_adapter.socket_timeout, 41 | shutdown_timeout=self.server_adapter.shutdown_timeout, 42 | accepted_queue_size=self.server_adapter.accepted_queue_size, 43 | accepted_queue_timeout=self.server_adapter.accepted_queue_timeout, 44 | ) 45 | self.protocol = self.server_adapter.protocol_version 46 | self.nodelay = self.server_adapter.nodelay 47 | 48 | if sys.version_info >= (3, 0): 49 | ssl_module = self.server_adapter.ssl_module or 'builtin' 50 | else: 51 | ssl_module = self.server_adapter.ssl_module or 'pyopenssl' 52 | if self.server_adapter.ssl_context: 53 | adapter_class = wsgiserver.get_ssl_adapter_class(ssl_module) 54 | self.ssl_adapter = adapter_class( 55 | self.server_adapter.ssl_certificate, 56 | self.server_adapter.ssl_private_key, 57 | self.server_adapter.ssl_certificate_chain) 58 | self.ssl_adapter.context = self.server_adapter.ssl_context 59 | elif self.server_adapter.ssl_certificate: 60 | adapter_class = wsgiserver.get_ssl_adapter_class(ssl_module) 61 | self.ssl_adapter = adapter_class( 62 | self.server_adapter.ssl_certificate, 63 | self.server_adapter.ssl_private_key, 64 | self.server_adapter.ssl_certificate_chain) 65 | 66 | self.stats['Enabled'] = getattr( 67 | self.server_adapter, 'statistics', False) 68 | 69 | def error_log(self, msg="", level=20, traceback=False): 70 | cherrypy.engine.log(msg, level, traceback) 71 | -------------------------------------------------------------------------------- /cherrypy/_cpwsgi_server.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/_cpwsgi_server.pyc -------------------------------------------------------------------------------- /cherrypy/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/favicon.ico -------------------------------------------------------------------------------- /cherrypy/lib/__init__.py: -------------------------------------------------------------------------------- 1 | """CherryPy Library""" 2 | 3 | # Deprecated in CherryPy 3.2 -- remove in CherryPy 3.3 4 | from cherrypy.lib.reprconf import unrepr, modules, attributes 5 | 6 | def is_iterator(obj): 7 | '''Returns a boolean indicating if the object provided implements 8 | the iterator protocol (i.e. like a generator). This will return 9 | false for objects which iterable, but not iterators themselves.''' 10 | from types import GeneratorType 11 | if isinstance(obj, GeneratorType): 12 | return True 13 | elif not hasattr(obj, '__iter__'): 14 | return False 15 | else: 16 | # Types which implement the protocol must return themselves when 17 | # invoking 'iter' upon them. 18 | return iter(obj) is obj 19 | 20 | def is_closable_iterator(obj): 21 | 22 | # Not an iterator. 23 | if not is_iterator(obj): 24 | return False 25 | 26 | # A generator - the easiest thing to deal with. 27 | import inspect 28 | if inspect.isgenerator(obj): 29 | return True 30 | 31 | # A custom iterator. Look for a close method... 32 | if not (hasattr(obj, 'close') and callable(obj.close)): 33 | return False 34 | 35 | # ... which doesn't require any arguments. 36 | try: 37 | inspect.getcallargs(obj.close) 38 | except TypeError: 39 | return False 40 | else: 41 | return True 42 | 43 | class file_generator(object): 44 | 45 | """Yield the given input (a file object) in chunks (default 64k). (Core)""" 46 | 47 | def __init__(self, input, chunkSize=65536): 48 | self.input = input 49 | self.chunkSize = chunkSize 50 | 51 | def __iter__(self): 52 | return self 53 | 54 | def __next__(self): 55 | chunk = self.input.read(self.chunkSize) 56 | if chunk: 57 | return chunk 58 | else: 59 | if hasattr(self.input, 'close'): 60 | self.input.close() 61 | raise StopIteration() 62 | next = __next__ 63 | 64 | 65 | def file_generator_limited(fileobj, count, chunk_size=65536): 66 | """Yield the given file object in chunks, stopping after `count` 67 | bytes has been emitted. Default chunk size is 64kB. (Core) 68 | """ 69 | remaining = count 70 | while remaining > 0: 71 | chunk = fileobj.read(min(chunk_size, remaining)) 72 | chunklen = len(chunk) 73 | if chunklen == 0: 74 | return 75 | remaining -= chunklen 76 | yield chunk 77 | 78 | 79 | def set_vary_header(response, header_name): 80 | "Add a Vary header to a response" 81 | varies = response.headers.get("Vary", "") 82 | varies = [x.strip() for x in varies.split(",") if x.strip()] 83 | if header_name not in varies: 84 | varies.append(header_name) 85 | response.headers['Vary'] = ", ".join(varies) 86 | -------------------------------------------------------------------------------- /cherrypy/lib/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__init__.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/__init__.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/__init__.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/auth.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/auth.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/auth_basic.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/auth_basic.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/auth_digest.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/auth_digest.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/caching.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/caching.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/cptools.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/cptools.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/encoding.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/encoding.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/httpauth.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/httpauth.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/httputil.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/httputil.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/jsontools.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/jsontools.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/lockfile.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/lockfile.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/locking.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/locking.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/reprconf.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/reprconf.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/sessions.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/sessions.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/static.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/static.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/__pycache__/xmlrpcutil.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/__pycache__/xmlrpcutil.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/lib/auth.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/auth.pyc -------------------------------------------------------------------------------- /cherrypy/lib/auth_basic.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/auth_basic.pyc -------------------------------------------------------------------------------- /cherrypy/lib/auth_digest.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/auth_digest.pyc -------------------------------------------------------------------------------- /cherrypy/lib/caching.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/caching.pyc -------------------------------------------------------------------------------- /cherrypy/lib/cptools.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/cptools.pyc -------------------------------------------------------------------------------- /cherrypy/lib/encoding.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/encoding.pyc -------------------------------------------------------------------------------- /cherrypy/lib/http.py: -------------------------------------------------------------------------------- 1 | import warnings 2 | warnings.warn('cherrypy.lib.http has been deprecated and will be removed ' 3 | 'in CherryPy 3.3 use cherrypy.lib.httputil instead.', 4 | DeprecationWarning) 5 | 6 | from cherrypy.lib.httputil import * 7 | -------------------------------------------------------------------------------- /cherrypy/lib/httpauth.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/httpauth.pyc -------------------------------------------------------------------------------- /cherrypy/lib/httputil.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/httputil.pyc -------------------------------------------------------------------------------- /cherrypy/lib/jsontools.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/jsontools.pyc -------------------------------------------------------------------------------- /cherrypy/lib/lockfile.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/lockfile.pyc -------------------------------------------------------------------------------- /cherrypy/lib/locking.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | 4 | class NeverExpires(object): 5 | def expired(self): 6 | return False 7 | 8 | 9 | class Timer(object): 10 | """ 11 | A simple timer that will indicate when an expiration time has passed. 12 | """ 13 | def __init__(self, expiration): 14 | "Create a timer that expires at `expiration` (UTC datetime)" 15 | self.expiration = expiration 16 | 17 | @classmethod 18 | def after(cls, elapsed): 19 | """ 20 | Return a timer that will expire after `elapsed` passes. 21 | """ 22 | return cls(datetime.datetime.utcnow() + elapsed) 23 | 24 | def expired(self): 25 | return datetime.datetime.utcnow() >= self.expiration 26 | 27 | 28 | class LockTimeout(Exception): 29 | "An exception when a lock could not be acquired before a timeout period" 30 | 31 | 32 | class LockChecker(object): 33 | """ 34 | Keep track of the time and detect if a timeout has expired 35 | """ 36 | def __init__(self, session_id, timeout): 37 | self.session_id = session_id 38 | if timeout: 39 | self.timer = Timer.after(timeout) 40 | else: 41 | self.timer = NeverExpires() 42 | 43 | def expired(self): 44 | if self.timer.expired(): 45 | raise LockTimeout( 46 | "Timeout acquiring lock for %(session_id)s" % vars(self)) 47 | return False 48 | -------------------------------------------------------------------------------- /cherrypy/lib/locking.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/locking.pyc -------------------------------------------------------------------------------- /cherrypy/lib/reprconf.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/reprconf.pyc -------------------------------------------------------------------------------- /cherrypy/lib/sessions.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/sessions.pyc -------------------------------------------------------------------------------- /cherrypy/lib/static.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/static.pyc -------------------------------------------------------------------------------- /cherrypy/lib/xmlrpcutil.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | import cherrypy 4 | from cherrypy._cpcompat import ntob 5 | 6 | 7 | def get_xmlrpclib(): 8 | try: 9 | import xmlrpc.client as x 10 | except ImportError: 11 | import xmlrpclib as x 12 | return x 13 | 14 | 15 | def process_body(): 16 | """Return (params, method) from request body.""" 17 | try: 18 | return get_xmlrpclib().loads(cherrypy.request.body.read()) 19 | except Exception: 20 | return ('ERROR PARAMS', ), 'ERRORMETHOD' 21 | 22 | 23 | def patched_path(path): 24 | """Return 'path', doctored for RPC.""" 25 | if not path.endswith('/'): 26 | path += '/' 27 | if path.startswith('/RPC2/'): 28 | # strip the first /rpc2 29 | path = path[5:] 30 | return path 31 | 32 | 33 | def _set_response(body): 34 | # The XML-RPC spec (http://www.xmlrpc.com/spec) says: 35 | # "Unless there's a lower-level error, always return 200 OK." 36 | # Since Python's xmlrpclib interprets a non-200 response 37 | # as a "Protocol Error", we'll just return 200 every time. 38 | response = cherrypy.response 39 | response.status = '200 OK' 40 | response.body = ntob(body, 'utf-8') 41 | response.headers['Content-Type'] = 'text/xml' 42 | response.headers['Content-Length'] = len(body) 43 | 44 | 45 | def respond(body, encoding='utf-8', allow_none=0): 46 | xmlrpclib = get_xmlrpclib() 47 | if not isinstance(body, xmlrpclib.Fault): 48 | body = (body,) 49 | _set_response(xmlrpclib.dumps(body, methodresponse=1, 50 | encoding=encoding, 51 | allow_none=allow_none)) 52 | 53 | 54 | def on_error(*args, **kwargs): 55 | body = str(sys.exc_info()[1]) 56 | xmlrpclib = get_xmlrpclib() 57 | _set_response(xmlrpclib.dumps(xmlrpclib.Fault(1, body))) 58 | -------------------------------------------------------------------------------- /cherrypy/lib/xmlrpcutil.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/lib/xmlrpcutil.pyc -------------------------------------------------------------------------------- /cherrypy/process/__init__.py: -------------------------------------------------------------------------------- 1 | """Site container for an HTTP server. 2 | 3 | A Web Site Process Bus object is used to connect applications, servers, 4 | and frameworks with site-wide services such as daemonization, process 5 | reload, signal handling, drop privileges, PID file management, logging 6 | for all of these, and many more. 7 | 8 | The 'plugins' module defines a few abstract and concrete services for 9 | use with the bus. Some use tool-specific channels; see the documentation 10 | for each class. 11 | """ 12 | 13 | from cherrypy.process.wspbus import bus 14 | from cherrypy.process import plugins, servers 15 | -------------------------------------------------------------------------------- /cherrypy/process/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/process/__init__.pyc -------------------------------------------------------------------------------- /cherrypy/process/__pycache__/__init__.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/process/__pycache__/__init__.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/process/__pycache__/plugins.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/process/__pycache__/plugins.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/process/__pycache__/servers.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/process/__pycache__/servers.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/process/__pycache__/win32.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/process/__pycache__/win32.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/process/__pycache__/wspbus.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/process/__pycache__/wspbus.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/process/plugins.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/process/plugins.pyc -------------------------------------------------------------------------------- /cherrypy/process/servers.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/process/servers.pyc -------------------------------------------------------------------------------- /cherrypy/process/win32.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/process/win32.pyc -------------------------------------------------------------------------------- /cherrypy/process/wspbus.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/process/wspbus.pyc -------------------------------------------------------------------------------- /cherrypy/scaffold/__init__.py: -------------------------------------------------------------------------------- 1 | """, a CherryPy application. 2 | 3 | Use this as a base for creating new CherryPy applications. When you want 4 | to make a new app, copy and paste this folder to some other location 5 | (maybe site-packages) and rename it to the name of your project, 6 | then tweak as desired. 7 | 8 | Even before any tweaking, this should serve a few demonstration pages. 9 | Change to this directory and run: 10 | 11 | ../cherryd -c site.conf 12 | 13 | """ 14 | 15 | import cherrypy 16 | from cherrypy import tools, url 17 | 18 | import os 19 | local_dir = os.path.join(os.getcwd(), os.path.dirname(__file__)) 20 | 21 | 22 | class Root: 23 | 24 | _cp_config = {'tools.log_tracebacks.on': True, 25 | } 26 | 27 | def index(self): 28 | return """ 29 | Try some other path, 30 | or a default path.
31 | Or, just look at the pretty picture:
32 | 33 | """ % (url("other"), url("else"), 34 | url("files/made_with_cherrypy_small.png")) 35 | index.exposed = True 36 | 37 | def default(self, *args, **kwargs): 38 | return "args: %s kwargs: %s" % (args, kwargs) 39 | default.exposed = True 40 | 41 | def other(self, a=2, b='bananas', c=None): 42 | cherrypy.response.headers['Content-Type'] = 'text/plain' 43 | if c is None: 44 | return "Have %d %s." % (int(a), b) 45 | else: 46 | return "Have %d %s, %s." % (int(a), b, c) 47 | other.exposed = True 48 | 49 | files = cherrypy.tools.staticdir.handler( 50 | section="/files", 51 | dir=os.path.join(local_dir, "static"), 52 | # Ignore .php files, etc. 53 | match=r'\.(css|gif|html?|ico|jpe?g|js|png|swf|xml)$', 54 | ) 55 | 56 | 57 | root = Root() 58 | 59 | # Uncomment the following to use your own favicon instead of CP's default. 60 | #favicon_path = os.path.join(local_dir, "favicon.ico") 61 | #root.favicon_ico = tools.staticfile.handler(filename=favicon_path) 62 | -------------------------------------------------------------------------------- /cherrypy/scaffold/apache-fcgi.conf: -------------------------------------------------------------------------------- 1 | # Apache2 server conf file for using CherryPy with mod_fcgid. 2 | 3 | # This doesn't have to be "C:/", but it has to be a directory somewhere, and 4 | # MUST match the directory used in the FastCgiExternalServer directive, below. 5 | DocumentRoot "C:/" 6 | 7 | ServerName 127.0.0.1 8 | Listen 80 9 | LoadModule fastcgi_module modules/mod_fastcgi.dll 10 | LoadModule rewrite_module modules/mod_rewrite.so 11 | 12 | Options ExecCGI 13 | SetHandler fastcgi-script 14 | RewriteEngine On 15 | # Send requests for any URI to our fastcgi handler. 16 | RewriteRule ^(.*)$ /fastcgi.pyc [L] 17 | 18 | # The FastCgiExternalServer directive defines filename as an external FastCGI application. 19 | # If filename does not begin with a slash (/) then it is assumed to be relative to the ServerRoot. 20 | # The filename does not have to exist in the local filesystem. URIs that Apache resolves to this 21 | # filename will be handled by this external FastCGI application. 22 | FastCgiExternalServer "C:/fastcgi.pyc" -host 127.0.0.1:8088 -------------------------------------------------------------------------------- /cherrypy/scaffold/example.conf: -------------------------------------------------------------------------------- 1 | [/] 2 | log.error_file: "error.log" 3 | log.access_file: "access.log" -------------------------------------------------------------------------------- /cherrypy/scaffold/site.conf: -------------------------------------------------------------------------------- 1 | [global] 2 | # Uncomment this when you're done developing 3 | #environment: "production" 4 | 5 | server.socket_host: "0.0.0.0" 6 | server.socket_port: 8088 7 | 8 | # Uncomment the following lines to run on HTTPS at the same time 9 | #server.2.socket_host: "0.0.0.0" 10 | #server.2.socket_port: 8433 11 | #server.2.ssl_certificate: '../test/test.pem' 12 | #server.2.ssl_private_key: '../test/test.pem' 13 | 14 | tree.myapp: cherrypy.Application(scaffold.root, "/", "example.conf") 15 | -------------------------------------------------------------------------------- /cherrypy/scaffold/static/made_with_cherrypy_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/scaffold/static/made_with_cherrypy_small.png -------------------------------------------------------------------------------- /cherrypy/test/__init__.py: -------------------------------------------------------------------------------- 1 | """Regression test suite for CherryPy. 2 | 3 | Run 'nosetests -s test/' to exercise all tests. 4 | 5 | The '-s' flag instructs nose to output stdout messages, wihch is crucial to 6 | the 'interactive' mode of webtest.py. If you run these tests without the '-s' 7 | flag, don't be surprised if the test seems to hang: it's waiting for your 8 | interactive input. 9 | """ 10 | 11 | import os 12 | import sys 13 | 14 | 15 | def newexit(): 16 | os._exit(1) 17 | 18 | 19 | def setup(): 20 | # We want to monkey patch sys.exit so that we can get some 21 | # information about where exit is being called. 22 | newexit._old = sys.exit 23 | sys.exit = newexit 24 | 25 | 26 | def teardown(): 27 | try: 28 | sys.exit = sys.exit._old 29 | except AttributeError: 30 | sys.exit = sys._exit 31 | -------------------------------------------------------------------------------- /cherrypy/test/_test_decorators.py: -------------------------------------------------------------------------------- 1 | """Test module for the @-decorator syntax, which is version-specific""" 2 | 3 | from cherrypy import expose, tools 4 | from cherrypy._cpcompat import ntob 5 | 6 | 7 | class ExposeExamples(object): 8 | 9 | @expose 10 | def no_call(self): 11 | return "Mr E. R. Bradshaw" 12 | 13 | @expose() 14 | def call_empty(self): 15 | return "Mrs. B.J. Smegma" 16 | 17 | @expose("call_alias") 18 | def nesbitt(self): 19 | return "Mr Nesbitt" 20 | 21 | @expose(["alias1", "alias2"]) 22 | def andrews(self): 23 | return "Mr Ken Andrews" 24 | 25 | @expose(alias="alias3") 26 | def watson(self): 27 | return "Mr. and Mrs. Watson" 28 | 29 | 30 | class ToolExamples(object): 31 | 32 | @expose 33 | @tools.response_headers(headers=[('Content-Type', 'application/data')]) 34 | def blah(self): 35 | yield ntob("blah") 36 | # This is here to demonstrate that _cp_config = {...} overwrites 37 | # the _cp_config attribute added by the Tool decorator. You have 38 | # to write _cp_config[k] = v or _cp_config.update(...) instead. 39 | blah._cp_config['response.stream'] = True 40 | -------------------------------------------------------------------------------- /cherrypy/test/_test_states_demo.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import time 4 | starttime = time.time() 5 | 6 | import cherrypy 7 | 8 | 9 | class Root: 10 | 11 | def index(self): 12 | return "Hello World" 13 | index.exposed = True 14 | 15 | def mtimes(self): 16 | return repr(cherrypy.engine.publish("Autoreloader", "mtimes")) 17 | mtimes.exposed = True 18 | 19 | def pid(self): 20 | return str(os.getpid()) 21 | pid.exposed = True 22 | 23 | def start(self): 24 | return repr(starttime) 25 | start.exposed = True 26 | 27 | def exit(self): 28 | # This handler might be called before the engine is STARTED if an 29 | # HTTP worker thread handles it before the HTTP server returns 30 | # control to engine.start. We avoid that race condition here 31 | # by waiting for the Bus to be STARTED. 32 | cherrypy.engine.wait(state=cherrypy.engine.states.STARTED) 33 | cherrypy.engine.exit() 34 | exit.exposed = True 35 | 36 | 37 | def unsub_sig(): 38 | cherrypy.log("unsubsig: %s" % cherrypy.config.get('unsubsig', False)) 39 | if cherrypy.config.get('unsubsig', False): 40 | cherrypy.log("Unsubscribing the default cherrypy signal handler") 41 | cherrypy.engine.signal_handler.unsubscribe() 42 | try: 43 | from signal import signal, SIGTERM 44 | except ImportError: 45 | pass 46 | else: 47 | def old_term_handler(signum=None, frame=None): 48 | cherrypy.log("I am an old SIGTERM handler.") 49 | sys.exit(0) 50 | cherrypy.log("Subscribing the new one.") 51 | signal(SIGTERM, old_term_handler) 52 | cherrypy.engine.subscribe('start', unsub_sig, priority=100) 53 | 54 | 55 | def starterror(): 56 | if cherrypy.config.get('starterror', False): 57 | zerodiv = 1 / 0 58 | cherrypy.engine.subscribe('start', starterror, priority=6) 59 | 60 | 61 | def log_test_case_name(): 62 | if cherrypy.config.get('test_case_name', False): 63 | cherrypy.log("STARTED FROM: %s" % 64 | cherrypy.config.get('test_case_name')) 65 | cherrypy.engine.subscribe('start', log_test_case_name, priority=6) 66 | 67 | 68 | cherrypy.tree.mount(Root(), '/', {'/': {}}) 69 | -------------------------------------------------------------------------------- /cherrypy/test/checkerdemo.py: -------------------------------------------------------------------------------- 1 | """Demonstration app for cherrypy.checker. 2 | 3 | This application is intentionally broken and badly designed. 4 | To demonstrate the output of the CherryPy Checker, simply execute 5 | this module. 6 | """ 7 | 8 | import os 9 | import cherrypy 10 | thisdir = os.path.dirname(os.path.abspath(__file__)) 11 | 12 | 13 | class Root: 14 | pass 15 | 16 | if __name__ == '__main__': 17 | conf = {'/base': {'tools.staticdir.root': thisdir, 18 | # Obsolete key. 19 | 'throw_errors': True, 20 | }, 21 | # This entry should be OK. 22 | '/base/static': {'tools.staticdir.on': True, 23 | 'tools.staticdir.dir': 'static'}, 24 | # Warn on missing folder. 25 | '/base/js': {'tools.staticdir.on': True, 26 | 'tools.staticdir.dir': 'js'}, 27 | # Warn on dir with an abs path even though we provide root. 28 | '/base/static2': {'tools.staticdir.on': True, 29 | 'tools.staticdir.dir': '/static'}, 30 | # Warn on dir with a relative path with no root. 31 | '/static3': {'tools.staticdir.on': True, 32 | 'tools.staticdir.dir': 'static'}, 33 | # Warn on unknown namespace 34 | '/unknown': {'toobles.gzip.on': True}, 35 | # Warn special on cherrypy..* 36 | '/cpknown': {'cherrypy.tools.encode.on': True}, 37 | # Warn on mismatched types 38 | '/conftype': {'request.show_tracebacks': 14}, 39 | # Warn on unknown tool. 40 | '/web': {'tools.unknown.on': True}, 41 | # Warn on server.* in app config. 42 | '/app1': {'server.socket_host': '0.0.0.0'}, 43 | # Warn on 'localhost' 44 | 'global': {'server.socket_host': 'localhost'}, 45 | # Warn on '[name]' 46 | '[/extra_brackets]': {}, 47 | } 48 | cherrypy.quickstart(Root(), config=conf) 49 | -------------------------------------------------------------------------------- /cherrypy/test/static/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

I couldn't find that thing you were looking for!

4 | 5 | 6 | -------------------------------------------------------------------------------- /cherrypy/test/static/dirback.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/test/static/dirback.jpg -------------------------------------------------------------------------------- /cherrypy/test/static/index.html: -------------------------------------------------------------------------------- 1 | Hello, world 2 | -------------------------------------------------------------------------------- /cherrypy/test/style.css: -------------------------------------------------------------------------------- 1 | Dummy stylesheet 2 | -------------------------------------------------------------------------------- /cherrypy/test/test.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXAIBAAKBgQDBKo554mzIMY+AByUNpaUOP9bJnQ7ZLQe9XgHwoLJR4VzpyZZZ 3 | R9L4WtImEew05FY3Izerfm3MN3+MC0tJ6yQU9sOiU3vBW6RrLIMlfKsnRwBRZ0Kn 4 | da+O6xldVSosu8Ev3z9VZ94iC/ZgKzrH7Mjj/U8/MQO7RBS/LAqee8bFNQIDAQAB 5 | AoGAWOCF0ZrWxn3XMucWq2LNwPKqlvVGwbIwX3cDmX22zmnM4Fy6arXbYh4XlyCj 6 | 9+ofqRrxIFz5k/7tFriTmZ0xag5+Jdx+Kwg0/twiP7XCNKipFogwe1Hznw8OFAoT 7 | enKBdj2+/n2o0Bvo/tDB59m9L/538d46JGQUmJlzMyqYikECQQDyoq+8CtMNvE18 8 | 8VgHcR/KtApxWAjj4HpaHYL637ATjThetUZkW92mgDgowyplthusxdNqhHWyv7E8 9 | tWNdYErZAkEAy85ShTR0M5aWmrE7o0r0SpWInAkNBH9aXQRRARFYsdBtNfRu6I0i 10 | 0lvU9wiu3eF57FMEC86yViZ5UBnQfTu7vQJAVesj/Zt7pwaCDfdMa740OsxMUlyR 11 | MVhhGx4OLpYdPJ8qUecxGQKq13XZ7R1HGyNEY4bd2X80Smq08UFuATfC6QJAH8UB 12 | yBHtKz2GLIcELOg6PIYizW/7v3+6rlVF60yw7sb2vzpjL40QqIn4IKoR2DSVtOkb 13 | 8FtAIX3N21aq0VrGYQJBAIPiaEc2AZ8Bq2GC4F3wOz/BxJ/izvnkiotR12QK4fh5 14 | yjZMhTjWCas5zwHR5PDjlD88AWGDMsZ1PicD4348xJQ= 15 | -----END RSA PRIVATE KEY----- 16 | -----BEGIN CERTIFICATE----- 17 | MIIDxTCCAy6gAwIBAgIJAI18BD7eQxlGMA0GCSqGSIb3DQEBBAUAMIGeMQswCQYD 18 | VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTESMBAGA1UEBxMJU2FuIERpZWdv 19 | MRkwFwYDVQQKExBDaGVycnlQeSBQcm9qZWN0MREwDwYDVQQLEwhkZXYtdGVzdDEW 20 | MBQGA1UEAxMNQ2hlcnJ5UHkgVGVhbTEgMB4GCSqGSIb3DQEJARYRcmVtaUBjaGVy 21 | cnlweS5vcmcwHhcNMDYwOTA5MTkyMDIwWhcNMzQwMTI0MTkyMDIwWjCBnjELMAkG 22 | A1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExEjAQBgNVBAcTCVNhbiBEaWVn 23 | bzEZMBcGA1UEChMQQ2hlcnJ5UHkgUHJvamVjdDERMA8GA1UECxMIZGV2LXRlc3Qx 24 | FjAUBgNVBAMTDUNoZXJyeVB5IFRlYW0xIDAeBgkqhkiG9w0BCQEWEXJlbWlAY2hl 25 | cnJ5cHkub3JnMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDBKo554mzIMY+A 26 | ByUNpaUOP9bJnQ7ZLQe9XgHwoLJR4VzpyZZZR9L4WtImEew05FY3Izerfm3MN3+M 27 | C0tJ6yQU9sOiU3vBW6RrLIMlfKsnRwBRZ0Knda+O6xldVSosu8Ev3z9VZ94iC/Zg 28 | KzrH7Mjj/U8/MQO7RBS/LAqee8bFNQIDAQABo4IBBzCCAQMwHQYDVR0OBBYEFDIQ 29 | 2feb71tVZCWpU0qJ/Tw+wdtoMIHTBgNVHSMEgcswgciAFDIQ2feb71tVZCWpU0qJ 30 | /Tw+wdtooYGkpIGhMIGeMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5p 31 | YTESMBAGA1UEBxMJU2FuIERpZWdvMRkwFwYDVQQKExBDaGVycnlQeSBQcm9qZWN0 32 | MREwDwYDVQQLEwhkZXYtdGVzdDEWMBQGA1UEAxMNQ2hlcnJ5UHkgVGVhbTEgMB4G 33 | CSqGSIb3DQEJARYRcmVtaUBjaGVycnlweS5vcmeCCQCNfAQ+3kMZRjAMBgNVHRME 34 | BTADAQH/MA0GCSqGSIb3DQEBBAUAA4GBAL7AAQz7IePV48ZTAFHKr88ntPALsL5S 35 | 8vHCZPNMevNkLTj3DYUw2BcnENxMjm1kou2F2BkvheBPNZKIhc6z4hAml3ed1xa2 36 | D7w6e6OTcstdK/+KrPDDHeOP1dhMWNs2JE1bNlfF1LiXzYKSXpe88eCKjCXsCT/T 37 | NluCaWQys3MS 38 | -----END CERTIFICATE----- 39 | -------------------------------------------------------------------------------- /cherrypy/test/test_compat.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import nose 4 | 5 | from cherrypy import _cpcompat as compat 6 | 7 | 8 | class StringTester(unittest.TestCase): 9 | 10 | def test_ntob_non_native(self): 11 | """ 12 | ntob should raise an Exception on unicode. 13 | (Python 2 only) 14 | 15 | See #1132 for discussion. 16 | """ 17 | if compat.py3k: 18 | raise nose.SkipTest("Only useful on Python 2") 19 | self.assertRaises(Exception, compat.ntob, unicode('fight')) 20 | -------------------------------------------------------------------------------- /cherrypy/test/test_httplib.py: -------------------------------------------------------------------------------- 1 | """Tests for cherrypy/lib/httputil.py.""" 2 | 3 | import unittest 4 | from cherrypy.lib import httputil 5 | 6 | 7 | class UtilityTests(unittest.TestCase): 8 | 9 | def test_urljoin(self): 10 | # Test all slash+atom combinations for SCRIPT_NAME and PATH_INFO 11 | self.assertEqual(httputil.urljoin("/sn/", "/pi/"), "/sn/pi/") 12 | self.assertEqual(httputil.urljoin("/sn/", "/pi"), "/sn/pi") 13 | self.assertEqual(httputil.urljoin("/sn/", "/"), "/sn/") 14 | self.assertEqual(httputil.urljoin("/sn/", ""), "/sn/") 15 | self.assertEqual(httputil.urljoin("/sn", "/pi/"), "/sn/pi/") 16 | self.assertEqual(httputil.urljoin("/sn", "/pi"), "/sn/pi") 17 | self.assertEqual(httputil.urljoin("/sn", "/"), "/sn/") 18 | self.assertEqual(httputil.urljoin("/sn", ""), "/sn") 19 | self.assertEqual(httputil.urljoin("/", "/pi/"), "/pi/") 20 | self.assertEqual(httputil.urljoin("/", "/pi"), "/pi") 21 | self.assertEqual(httputil.urljoin("/", "/"), "/") 22 | self.assertEqual(httputil.urljoin("/", ""), "/") 23 | self.assertEqual(httputil.urljoin("", "/pi/"), "/pi/") 24 | self.assertEqual(httputil.urljoin("", "/pi"), "/pi") 25 | self.assertEqual(httputil.urljoin("", "/"), "/") 26 | self.assertEqual(httputil.urljoin("", ""), "/") 27 | 28 | if __name__ == '__main__': 29 | unittest.main() 30 | -------------------------------------------------------------------------------- /cherrypy/test/test_refleaks.py: -------------------------------------------------------------------------------- 1 | """Tests for refleaks.""" 2 | 3 | from cherrypy._cpcompat import HTTPConnection, HTTPSConnection, ntob 4 | import threading 5 | 6 | import cherrypy 7 | 8 | 9 | data = object() 10 | 11 | 12 | from cherrypy.test import helper 13 | 14 | 15 | class ReferenceTests(helper.CPWebCase): 16 | 17 | def setup_server(): 18 | 19 | class Root: 20 | 21 | def index(self, *args, **kwargs): 22 | cherrypy.request.thing = data 23 | return "Hello world!" 24 | index.exposed = True 25 | 26 | cherrypy.tree.mount(Root()) 27 | setup_server = staticmethod(setup_server) 28 | 29 | def test_threadlocal_garbage(self): 30 | success = [] 31 | 32 | def getpage(): 33 | host = '%s:%s' % (self.interface(), self.PORT) 34 | if self.scheme == 'https': 35 | c = HTTPSConnection(host) 36 | else: 37 | c = HTTPConnection(host) 38 | try: 39 | c.putrequest('GET', '/') 40 | c.endheaders() 41 | response = c.getresponse() 42 | body = response.read() 43 | self.assertEqual(response.status, 200) 44 | self.assertEqual(body, ntob("Hello world!")) 45 | finally: 46 | c.close() 47 | success.append(True) 48 | 49 | ITERATIONS = 25 50 | ts = [] 51 | for _ in range(ITERATIONS): 52 | t = threading.Thread(target=getpage) 53 | ts.append(t) 54 | t.start() 55 | 56 | for t in ts: 57 | t.join() 58 | 59 | self.assertEqual(len(success), ITERATIONS) 60 | -------------------------------------------------------------------------------- /cherrypy/test/test_routes.py: -------------------------------------------------------------------------------- 1 | import os 2 | curdir = os.path.join(os.getcwd(), os.path.dirname(__file__)) 3 | 4 | import cherrypy 5 | 6 | from cherrypy.test import helper 7 | import nose 8 | 9 | 10 | class RoutesDispatchTest(helper.CPWebCase): 11 | 12 | def setup_server(): 13 | 14 | try: 15 | import routes 16 | except ImportError: 17 | raise nose.SkipTest('Install routes to test RoutesDispatcher code') 18 | 19 | class Dummy: 20 | 21 | def index(self): 22 | return "I said good day!" 23 | 24 | class City: 25 | 26 | def __init__(self, name): 27 | self.name = name 28 | self.population = 10000 29 | 30 | def index(self, **kwargs): 31 | return "Welcome to %s, pop. %s" % (self.name, self.population) 32 | index._cp_config = { 33 | 'tools.response_headers.on': True, 34 | 'tools.response_headers.headers': [ 35 | ('Content-Language', 'en-GB') 36 | ] 37 | } 38 | 39 | def update(self, **kwargs): 40 | self.population = kwargs['pop'] 41 | return "OK" 42 | 43 | d = cherrypy.dispatch.RoutesDispatcher() 44 | d.connect(action='index', name='hounslow', route='/hounslow', 45 | controller=City('Hounslow')) 46 | d.connect( 47 | name='surbiton', route='/surbiton', controller=City('Surbiton'), 48 | action='index', conditions=dict(method=['GET'])) 49 | d.mapper.connect('/surbiton', controller='surbiton', 50 | action='update', conditions=dict(method=['POST'])) 51 | d.connect('main', ':action', controller=Dummy()) 52 | 53 | conf = {'/': {'request.dispatch': d}} 54 | cherrypy.tree.mount(root=None, config=conf) 55 | setup_server = staticmethod(setup_server) 56 | 57 | def test_Routes_Dispatch(self): 58 | self.getPage("/hounslow") 59 | self.assertStatus("200 OK") 60 | self.assertBody("Welcome to Hounslow, pop. 10000") 61 | 62 | self.getPage("/foo") 63 | self.assertStatus("404 Not Found") 64 | 65 | self.getPage("/surbiton") 66 | self.assertStatus("200 OK") 67 | self.assertBody("Welcome to Surbiton, pop. 10000") 68 | 69 | self.getPage("/surbiton", method="POST", body="pop=1327") 70 | self.assertStatus("200 OK") 71 | self.assertBody("OK") 72 | self.getPage("/surbiton") 73 | self.assertStatus("200 OK") 74 | self.assertHeader("Content-Language", "en-GB") 75 | self.assertBody("Welcome to Surbiton, pop. 1327") 76 | -------------------------------------------------------------------------------- /cherrypy/test/test_sessionauthenticate.py: -------------------------------------------------------------------------------- 1 | import cherrypy 2 | from cherrypy.test import helper 3 | 4 | 5 | class SessionAuthenticateTest(helper.CPWebCase): 6 | 7 | def setup_server(): 8 | 9 | def check(username, password): 10 | # Dummy check_username_and_password function 11 | if username != 'test' or password != 'password': 12 | return 'Wrong login/password' 13 | 14 | def augment_params(): 15 | # A simple tool to add some things to request.params 16 | # This is to check to make sure that session_auth can handle 17 | # request params (ticket #780) 18 | cherrypy.request.params["test"] = "test" 19 | 20 | cherrypy.tools.augment_params = cherrypy.Tool( 21 | 'before_handler', augment_params, None, priority=30) 22 | 23 | class Test: 24 | 25 | _cp_config = { 26 | 'tools.sessions.on': True, 27 | 'tools.session_auth.on': True, 28 | 'tools.session_auth.check_username_and_password': check, 29 | 'tools.augment_params.on': True, 30 | } 31 | 32 | def index(self, **kwargs): 33 | return "Hi %s, you are logged in" % cherrypy.request.login 34 | index.exposed = True 35 | 36 | cherrypy.tree.mount(Test()) 37 | setup_server = staticmethod(setup_server) 38 | 39 | def testSessionAuthenticate(self): 40 | # request a page and check for login form 41 | self.getPage('/') 42 | self.assertInBody('
') 43 | 44 | # setup credentials 45 | login_body = 'username=test&password=password&from_page=/' 46 | 47 | # attempt a login 48 | self.getPage('/do_login', method='POST', body=login_body) 49 | self.assertStatus((302, 303)) 50 | 51 | # get the page now that we are logged in 52 | self.getPage('/', self.cookies) 53 | self.assertBody('Hi test, you are logged in') 54 | 55 | # do a logout 56 | self.getPage('/do_logout', self.cookies, method='POST') 57 | self.assertStatus((302, 303)) 58 | 59 | # verify we are logged out 60 | self.getPage('/', self.cookies) 61 | self.assertInBody('') 62 | -------------------------------------------------------------------------------- /cherrypy/test/test_wsgi_ns.py: -------------------------------------------------------------------------------- 1 | import cherrypy 2 | from cherrypy._cpcompat import ntob 3 | from cherrypy.test import helper 4 | 5 | 6 | class WSGI_Namespace_Test(helper.CPWebCase): 7 | 8 | def setup_server(): 9 | 10 | class WSGIResponse(object): 11 | 12 | def __init__(self, appresults): 13 | self.appresults = appresults 14 | self.iter = iter(appresults) 15 | 16 | def __iter__(self): 17 | return self 18 | 19 | def next(self): 20 | return self.iter.next() 21 | 22 | def __next__(self): 23 | return next(self.iter) 24 | 25 | def close(self): 26 | if hasattr(self.appresults, "close"): 27 | self.appresults.close() 28 | 29 | class ChangeCase(object): 30 | 31 | def __init__(self, app, to=None): 32 | self.app = app 33 | self.to = to 34 | 35 | def __call__(self, environ, start_response): 36 | res = self.app(environ, start_response) 37 | 38 | class CaseResults(WSGIResponse): 39 | 40 | def next(this): 41 | return getattr(this.iter.next(), self.to)() 42 | 43 | def __next__(this): 44 | return getattr(next(this.iter), self.to)() 45 | return CaseResults(res) 46 | 47 | class Replacer(object): 48 | 49 | def __init__(self, app, map={}): 50 | self.app = app 51 | self.map = map 52 | 53 | def __call__(self, environ, start_response): 54 | res = self.app(environ, start_response) 55 | 56 | class ReplaceResults(WSGIResponse): 57 | 58 | def next(this): 59 | line = this.iter.next() 60 | for k, v in self.map.iteritems(): 61 | line = line.replace(k, v) 62 | return line 63 | 64 | def __next__(this): 65 | line = next(this.iter) 66 | for k, v in self.map.items(): 67 | line = line.replace(k, v) 68 | return line 69 | return ReplaceResults(res) 70 | 71 | class Root(object): 72 | 73 | def index(self): 74 | return "HellO WoRlD!" 75 | index.exposed = True 76 | 77 | root_conf = {'wsgi.pipeline': [('replace', Replacer)], 78 | 'wsgi.replace.map': {ntob('L'): ntob('X'), 79 | ntob('l'): ntob('r')}, 80 | } 81 | 82 | app = cherrypy.Application(Root()) 83 | app.wsgiapp.pipeline.append(('changecase', ChangeCase)) 84 | app.wsgiapp.config['changecase'] = {'to': 'upper'} 85 | cherrypy.tree.mount(app, config={'/': root_conf}) 86 | setup_server = staticmethod(setup_server) 87 | 88 | def test_pipeline(self): 89 | if not cherrypy.server.httpserver: 90 | return self.skip() 91 | 92 | self.getPage("/") 93 | # If body is "HEXXO WORXD!", the middleware was applied out of order. 94 | self.assertBody("HERRO WORRD!") 95 | -------------------------------------------------------------------------------- /cherrypy/test/test_wsgi_vhost.py: -------------------------------------------------------------------------------- 1 | import cherrypy 2 | from cherrypy.test import helper 3 | 4 | 5 | class WSGI_VirtualHost_Test(helper.CPWebCase): 6 | 7 | def setup_server(): 8 | 9 | class ClassOfRoot(object): 10 | 11 | def __init__(self, name): 12 | self.name = name 13 | 14 | def index(self): 15 | return "Welcome to the %s website!" % self.name 16 | index.exposed = True 17 | 18 | default = cherrypy.Application(None) 19 | 20 | domains = {} 21 | for year in range(1997, 2008): 22 | app = cherrypy.Application(ClassOfRoot('Class of %s' % year)) 23 | domains['www.classof%s.example' % year] = app 24 | 25 | cherrypy.tree.graft(cherrypy._cpwsgi.VirtualHost(default, domains)) 26 | setup_server = staticmethod(setup_server) 27 | 28 | def test_welcome(self): 29 | if not cherrypy.server.using_wsgi: 30 | return self.skip("skipped (not using WSGI)... ") 31 | 32 | for year in range(1997, 2008): 33 | self.getPage( 34 | "/", headers=[('Host', 'www.classof%s.example' % year)]) 35 | self.assertBody("Welcome to the Class of %s website!" % year) 36 | -------------------------------------------------------------------------------- /cherrypy/tutorial/README.txt: -------------------------------------------------------------------------------- 1 | CherryPy Tutorials 2 | ------------------------------------------------------------------------ 3 | 4 | This is a series of tutorials explaining how to develop dynamic web 5 | applications using CherryPy. A couple of notes: 6 | 7 | - Each of these tutorials builds on the ones before it. If you're 8 | new to CherryPy, we recommend you start with 01_helloworld.py and 9 | work your way upwards. :) 10 | 11 | - In most of these tutorials, you will notice that all output is done 12 | by returning normal Python strings, often using simple Python 13 | variable substitution. In most real-world applications, you will 14 | probably want to use a separate template package (like Cheetah, 15 | CherryTemplate or XML/XSL). 16 | 17 | -------------------------------------------------------------------------------- /cherrypy/tutorial/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | # This is used in test_config to test unrepr of "from A import B" 3 | thing2 = object() 4 | -------------------------------------------------------------------------------- /cherrypy/tutorial/custom_error.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 403 Unauthorized 7 | 8 | 9 |

You can't do that!

10 |

%(message)s

11 |

This is a custom error page that is read from a file.

12 |

%(traceback)s
13 | 14 | 15 | -------------------------------------------------------------------------------- /cherrypy/tutorial/pdf_file.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/tutorial/pdf_file.pdf -------------------------------------------------------------------------------- /cherrypy/tutorial/tut01_helloworld.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tutorial - Hello World 3 | 4 | The most basic (working) CherryPy application possible. 5 | """ 6 | 7 | # Import CherryPy global namespace 8 | import cherrypy 9 | 10 | 11 | class HelloWorld: 12 | 13 | """ Sample request handler class. """ 14 | 15 | def index(self): 16 | # CherryPy will call this method for the root URI ("/") and send 17 | # its return value to the client. Because this is tutorial 18 | # lesson number 01, we'll just send something really simple. 19 | # How about... 20 | return "Hello world!" 21 | 22 | # Expose the index method through the web. CherryPy will never 23 | # publish methods that don't have the exposed attribute set to True. 24 | index.exposed = True 25 | 26 | 27 | import os.path 28 | tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf') 29 | 30 | if __name__ == '__main__': 31 | # CherryPy always starts with app.root when trying to map request URIs 32 | # to objects, so we need to mount a request handler root. A request 33 | # to '/' will be mapped to HelloWorld().index(). 34 | cherrypy.quickstart(HelloWorld(), config=tutconf) 35 | else: 36 | # This branch is for the test suite; you can ignore it. 37 | cherrypy.tree.mount(HelloWorld(), config=tutconf) 38 | -------------------------------------------------------------------------------- /cherrypy/tutorial/tut02_expose_methods.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tutorial - Multiple methods 3 | 4 | This tutorial shows you how to link to other methods of your request 5 | handler. 6 | """ 7 | 8 | import cherrypy 9 | 10 | 11 | class HelloWorld: 12 | 13 | def index(self): 14 | # Let's link to another method here. 15 | return 'We have an important message for you!' 16 | index.exposed = True 17 | 18 | def show_msg(self): 19 | # Here's the important message! 20 | return "Hello world!" 21 | show_msg.exposed = True 22 | 23 | import os.path 24 | tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf') 25 | 26 | if __name__ == '__main__': 27 | # CherryPy always starts with app.root when trying to map request URIs 28 | # to objects, so we need to mount a request handler root. A request 29 | # to '/' will be mapped to HelloWorld().index(). 30 | cherrypy.quickstart(HelloWorld(), config=tutconf) 31 | else: 32 | # This branch is for the test suite; you can ignore it. 33 | cherrypy.tree.mount(HelloWorld(), config=tutconf) 34 | -------------------------------------------------------------------------------- /cherrypy/tutorial/tut03_get_and_post.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tutorial - Passing variables 3 | 4 | This tutorial shows you how to pass GET/POST variables to methods. 5 | """ 6 | 7 | import cherrypy 8 | 9 | 10 | class WelcomePage: 11 | 12 | def index(self): 13 | # Ask for the user's name. 14 | return ''' 15 | 16 | What is your name? 17 | 18 | 19 |
''' 20 | index.exposed = True 21 | 22 | def greetUser(self, name=None): 23 | # CherryPy passes all GET and POST variables as method parameters. 24 | # It doesn't make a difference where the variables come from, how 25 | # large their contents are, and so on. 26 | # 27 | # You can define default parameter values as usual. In this 28 | # example, the "name" parameter defaults to None so we can check 29 | # if a name was actually specified. 30 | 31 | if name: 32 | # Greet the user! 33 | return "Hey %s, what's up?" % name 34 | else: 35 | if name is None: 36 | # No name was specified 37 | return 'Please enter your name here.' 38 | else: 39 | return 'No, really, enter your name here.' 40 | greetUser.exposed = True 41 | 42 | 43 | import os.path 44 | tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf') 45 | 46 | if __name__ == '__main__': 47 | # CherryPy always starts with app.root when trying to map request URIs 48 | # to objects, so we need to mount a request handler root. A request 49 | # to '/' will be mapped to HelloWorld().index(). 50 | cherrypy.quickstart(WelcomePage(), config=tutconf) 51 | else: 52 | # This branch is for the test suite; you can ignore it. 53 | cherrypy.tree.mount(WelcomePage(), config=tutconf) 54 | -------------------------------------------------------------------------------- /cherrypy/tutorial/tut05_derived_objects.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tutorial - Object inheritance 3 | 4 | You are free to derive your request handler classes from any base 5 | class you wish. In most real-world applications, you will probably 6 | want to create a central base class used for all your pages, which takes 7 | care of things like printing a common page header and footer. 8 | """ 9 | 10 | import cherrypy 11 | 12 | 13 | class Page: 14 | # Store the page title in a class attribute 15 | title = 'Untitled Page' 16 | 17 | def header(self): 18 | return ''' 19 | 20 | 21 | %s 22 | 23 | 24 |

%s

25 | ''' % (self.title, self.title) 26 | 27 | def footer(self): 28 | return ''' 29 | 30 | 31 | ''' 32 | 33 | # Note that header and footer don't get their exposed attributes 34 | # set to True. This isn't necessary since the user isn't supposed 35 | # to call header or footer directly; instead, we'll call them from 36 | # within the actually exposed handler methods defined in this 37 | # class' subclasses. 38 | 39 | 40 | class HomePage(Page): 41 | # Different title for this page 42 | title = 'Tutorial 5' 43 | 44 | def __init__(self): 45 | # create a subpage 46 | self.another = AnotherPage() 47 | 48 | def index(self): 49 | # Note that we call the header and footer methods inherited 50 | # from the Page class! 51 | return self.header() + ''' 52 |

53 | Isn't this exciting? There's 54 | another page, too! 55 |

56 | ''' + self.footer() 57 | index.exposed = True 58 | 59 | 60 | class AnotherPage(Page): 61 | title = 'Another Page' 62 | 63 | def index(self): 64 | return self.header() + ''' 65 |

66 | And this is the amazing second page! 67 |

68 | ''' + self.footer() 69 | index.exposed = True 70 | 71 | 72 | import os.path 73 | tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf') 74 | 75 | if __name__ == '__main__': 76 | # CherryPy always starts with app.root when trying to map request URIs 77 | # to objects, so we need to mount a request handler root. A request 78 | # to '/' will be mapped to HelloWorld().index(). 79 | cherrypy.quickstart(HomePage(), config=tutconf) 80 | else: 81 | # This branch is for the test suite; you can ignore it. 82 | cherrypy.tree.mount(HomePage(), config=tutconf) 83 | -------------------------------------------------------------------------------- /cherrypy/tutorial/tut06_default_method.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tutorial - The default method 3 | 4 | Request handler objects can implement a method called "default" that 5 | is called when no other suitable method/object could be found. 6 | Essentially, if CherryPy2 can't find a matching request handler object 7 | for the given request URI, it will use the default method of the object 8 | located deepest on the URI path. 9 | 10 | Using this mechanism you can easily simulate virtual URI structures 11 | by parsing the extra URI string, which you can access through 12 | cherrypy.request.virtualPath. 13 | 14 | The application in this tutorial simulates an URI structure looking 15 | like /users/. Since the bit will not be found (as 16 | there are no matching methods), it is handled by the default method. 17 | """ 18 | 19 | import cherrypy 20 | 21 | 22 | class UsersPage: 23 | 24 | def index(self): 25 | # Since this is just a stupid little example, we'll simply 26 | # display a list of links to random, made-up users. In a real 27 | # application, this could be generated from a database result set. 28 | return ''' 29 | Remi Delon
30 | Hendrik Mans
31 | Lorenzo Lamas
32 | ''' 33 | index.exposed = True 34 | 35 | def default(self, user): 36 | # Here we react depending on the virtualPath -- the part of the 37 | # path that could not be mapped to an object method. In a real 38 | # application, we would probably do some database lookups here 39 | # instead of the silly if/elif/else construct. 40 | if user == 'remi': 41 | out = "Remi Delon, CherryPy lead developer" 42 | elif user == 'hendrik': 43 | out = "Hendrik Mans, CherryPy co-developer & crazy German" 44 | elif user == 'lorenzo': 45 | out = "Lorenzo Lamas, famous actor and singer!" 46 | else: 47 | out = "Unknown user. :-(" 48 | 49 | return '%s (back)' % out 50 | default.exposed = True 51 | 52 | 53 | import os.path 54 | tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf') 55 | 56 | if __name__ == '__main__': 57 | # CherryPy always starts with app.root when trying to map request URIs 58 | # to objects, so we need to mount a request handler root. A request 59 | # to '/' will be mapped to HelloWorld().index(). 60 | cherrypy.quickstart(UsersPage(), config=tutconf) 61 | else: 62 | # This branch is for the test suite; you can ignore it. 63 | cherrypy.tree.mount(UsersPage(), config=tutconf) 64 | -------------------------------------------------------------------------------- /cherrypy/tutorial/tut07_sessions.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tutorial - Sessions 3 | 4 | Storing session data in CherryPy applications is very easy: cherrypy 5 | provides a dictionary called "session" that represents the session 6 | data for the current user. If you use RAM based sessions, you can store 7 | any kind of object into that dictionary; otherwise, you are limited to 8 | objects that can be pickled. 9 | """ 10 | 11 | import cherrypy 12 | 13 | 14 | class HitCounter: 15 | 16 | _cp_config = {'tools.sessions.on': True} 17 | 18 | def index(self): 19 | # Increase the silly hit counter 20 | count = cherrypy.session.get('count', 0) + 1 21 | 22 | # Store the new value in the session dictionary 23 | cherrypy.session['count'] = count 24 | 25 | # And display a silly hit count message! 26 | return ''' 27 | During your current session, you've viewed this 28 | page %s times! Your life is a patio of fun! 29 | ''' % count 30 | index.exposed = True 31 | 32 | 33 | import os.path 34 | tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf') 35 | 36 | if __name__ == '__main__': 37 | # CherryPy always starts with app.root when trying to map request URIs 38 | # to objects, so we need to mount a request handler root. A request 39 | # to '/' will be mapped to HelloWorld().index(). 40 | cherrypy.quickstart(HitCounter(), config=tutconf) 41 | else: 42 | # This branch is for the test suite; you can ignore it. 43 | cherrypy.tree.mount(HitCounter(), config=tutconf) 44 | -------------------------------------------------------------------------------- /cherrypy/tutorial/tut08_generators_and_yield.py: -------------------------------------------------------------------------------- 1 | """ 2 | Bonus Tutorial: Using generators to return result bodies 3 | 4 | Instead of returning a complete result string, you can use the yield 5 | statement to return one result part after another. This may be convenient 6 | in situations where using a template package like CherryPy or Cheetah 7 | would be overkill, and messy string concatenation too uncool. ;-) 8 | """ 9 | 10 | import cherrypy 11 | 12 | 13 | class GeneratorDemo: 14 | 15 | def header(self): 16 | return "

Generators rule!

" 17 | 18 | def footer(self): 19 | return "" 20 | 21 | def index(self): 22 | # Let's make up a list of users for presentation purposes 23 | users = ['Remi', 'Carlos', 'Hendrik', 'Lorenzo Lamas'] 24 | 25 | # Every yield line adds one part to the total result body. 26 | yield self.header() 27 | yield "

List of users:

" 28 | 29 | for user in users: 30 | yield "%s
" % user 31 | 32 | yield self.footer() 33 | index.exposed = True 34 | 35 | 36 | import os.path 37 | tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf') 38 | 39 | if __name__ == '__main__': 40 | # CherryPy always starts with app.root when trying to map request URIs 41 | # to objects, so we need to mount a request handler root. A request 42 | # to '/' will be mapped to HelloWorld().index(). 43 | cherrypy.quickstart(GeneratorDemo(), config=tutconf) 44 | else: 45 | # This branch is for the test suite; you can ignore it. 46 | cherrypy.tree.mount(GeneratorDemo(), config=tutconf) 47 | -------------------------------------------------------------------------------- /cherrypy/tutorial/tut10_http_errors.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | Tutorial: HTTP errors 4 | 5 | HTTPError is used to return an error response to the client. 6 | CherryPy has lots of options regarding how such errors are 7 | logged, displayed, and formatted. 8 | 9 | """ 10 | 11 | import os 12 | localDir = os.path.dirname(__file__) 13 | curpath = os.path.normpath(os.path.join(os.getcwd(), localDir)) 14 | 15 | import cherrypy 16 | 17 | 18 | class HTTPErrorDemo(object): 19 | 20 | # Set a custom response for 403 errors. 21 | _cp_config = {'error_page.403': 22 | os.path.join(curpath, "custom_error.html")} 23 | 24 | def index(self): 25 | # display some links that will result in errors 26 | tracebacks = cherrypy.request.show_tracebacks 27 | if tracebacks: 28 | trace = 'off' 29 | else: 30 | trace = 'on' 31 | 32 | return """ 33 | 34 |

Toggle tracebacks %s

35 |

Click me; I'm a broken link!

36 |

37 | 38 | Use a custom error page from a file. 39 | 40 |

41 |

These errors are explicitly raised by the application:

42 | 48 |

You can also set the response body 49 | when you raise an error.

50 | 51 | """ % trace 52 | index.exposed = True 53 | 54 | def toggleTracebacks(self): 55 | # simple function to toggle tracebacks on and off 56 | tracebacks = cherrypy.request.show_tracebacks 57 | cherrypy.config.update({'request.show_tracebacks': not tracebacks}) 58 | 59 | # redirect back to the index 60 | raise cherrypy.HTTPRedirect('/') 61 | toggleTracebacks.exposed = True 62 | 63 | def error(self, code): 64 | # raise an error based on the get query 65 | raise cherrypy.HTTPError(status=code) 66 | error.exposed = True 67 | 68 | def messageArg(self): 69 | message = ("If you construct an HTTPError with a 'message' " 70 | "argument, it wil be placed on the error page " 71 | "(underneath the status line by default).") 72 | raise cherrypy.HTTPError(500, message=message) 73 | messageArg.exposed = True 74 | 75 | 76 | import os.path 77 | tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf') 78 | 79 | if __name__ == '__main__': 80 | # CherryPy always starts with app.root when trying to map request URIs 81 | # to objects, so we need to mount a request handler root. A request 82 | # to '/' will be mapped to HelloWorld().index(). 83 | cherrypy.quickstart(HTTPErrorDemo(), config=tutconf) 84 | else: 85 | # This branch is for the test suite; you can ignore it. 86 | cherrypy.tree.mount(HTTPErrorDemo(), config=tutconf) 87 | -------------------------------------------------------------------------------- /cherrypy/tutorial/tutorial.conf: -------------------------------------------------------------------------------- 1 | [global] 2 | server.socket_host = "127.0.0.1" 3 | server.socket_port = 8080 4 | server.thread_pool = 10 5 | -------------------------------------------------------------------------------- /cherrypy/wsgiserver/__init__.py: -------------------------------------------------------------------------------- 1 | __all__ = ['HTTPRequest', 'HTTPConnection', 'HTTPServer', 2 | 'SizeCheckWrapper', 'KnownLengthRFile', 'ChunkedRFile', 3 | 'MaxSizeExceeded', 'NoSSLError', 'FatalSSLAlert', 4 | 'WorkerThread', 'ThreadPool', 'SSLAdapter', 5 | 'CherryPyWSGIServer', 6 | 'Gateway', 'WSGIGateway', 'WSGIGateway_10', 'WSGIGateway_u0', 7 | 'WSGIPathInfoDispatcher', 'get_ssl_adapter_class'] 8 | 9 | import sys 10 | if sys.version_info < (3, 0): 11 | from wsgiserver2 import * 12 | else: 13 | # Le sigh. Boo for backward-incompatible syntax. 14 | exec('from .wsgiserver3 import *') 15 | -------------------------------------------------------------------------------- /cherrypy/wsgiserver/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/wsgiserver/__init__.pyc -------------------------------------------------------------------------------- /cherrypy/wsgiserver/__pycache__/__init__.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/wsgiserver/__pycache__/__init__.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/wsgiserver/__pycache__/wsgiserver3.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/wsgiserver/__pycache__/wsgiserver3.cpython-34.pyc -------------------------------------------------------------------------------- /cherrypy/wsgiserver/wsgiserver2.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/cherrypy/wsgiserver/wsgiserver2.pyc -------------------------------------------------------------------------------- /lxml/__init__.py: -------------------------------------------------------------------------------- 1 | # this is a package 2 | 3 | def get_include(): 4 | """ 5 | Returns a list of header include paths (for lxml itself, libxml2 6 | and libxslt) needed to compile C code against lxml if it was built 7 | with statically linked libraries. 8 | """ 9 | import os 10 | lxml_path = __path__[0] 11 | include_path = os.path.join(lxml_path, 'includes') 12 | includes = [include_path, lxml_path] 13 | 14 | for name in os.listdir(include_path): 15 | path = os.path.join(include_path, name) 16 | if os.path.isdir(path): 17 | includes.append(path) 18 | 19 | return includes 20 | 21 | -------------------------------------------------------------------------------- /lxml/__init__.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/lxml/__init__.pyc -------------------------------------------------------------------------------- /lxml/__pycache__/__init__.cpython-34.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/lxml/__pycache__/__init__.cpython-34.pyc -------------------------------------------------------------------------------- /lxml/cvarargs.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "stdarg.h": 2 | ctypedef void *va_list 3 | void va_start(va_list ap, void *last) nogil 4 | void va_end(va_list ap) nogil 5 | 6 | cdef extern from "etree_defs.h": 7 | cdef int va_int(va_list ap) nogil 8 | cdef char *va_charptr(va_list ap) nogil 9 | -------------------------------------------------------------------------------- /lxml/html/ElementSoup.py: -------------------------------------------------------------------------------- 1 | __doc__ = """Legacy interface to the BeautifulSoup HTML parser. 2 | """ 3 | 4 | __all__ = ["parse", "convert_tree"] 5 | 6 | from soupparser import convert_tree, parse as _parse 7 | 8 | def parse(file, beautifulsoup=None, makeelement=None): 9 | root = _parse(file, beautifulsoup=beautifulsoup, makeelement=makeelement) 10 | return root.getroot() 11 | -------------------------------------------------------------------------------- /lxml/html/_diffcommand.py: -------------------------------------------------------------------------------- 1 | import optparse 2 | import sys 3 | import re 4 | import os 5 | from lxml.html.diff import htmldiff 6 | 7 | description = """\ 8 | """ 9 | 10 | parser = optparse.OptionParser( 11 | usage="%prog [OPTIONS] FILE1 FILE2\n" 12 | "%prog --annotate [OPTIONS] INFO1 FILE1 INFO2 FILE2 ...", 13 | description=description, 14 | ) 15 | 16 | parser.add_option( 17 | '-o', '--output', 18 | metavar="FILE", 19 | dest="output", 20 | default="-", 21 | help="File to write the difference to", 22 | ) 23 | 24 | parser.add_option( 25 | '-a', '--annotation', 26 | action="store_true", 27 | dest="annotation", 28 | help="Do an annotation") 29 | 30 | def main(args=None): 31 | if args is None: 32 | args = sys.argv[1:] 33 | options, args = parser.parse_args(args) 34 | if options.annotation: 35 | return annotate(options, args) 36 | if len(args) != 2: 37 | print('Error: you must give two files') 38 | parser.print_help() 39 | sys.exit(1) 40 | file1, file2 = args 41 | input1 = read_file(file1) 42 | input2 = read_file(file2) 43 | body1 = split_body(input1)[1] 44 | pre, body2, post = split_body(input2) 45 | result = htmldiff(body1, body2) 46 | result = pre + result + post 47 | if options.output == '-': 48 | if not result.endswith('\n'): 49 | result += '\n' 50 | sys.stdout.write(result) 51 | else: 52 | f = open(options.output, 'wb') 53 | f.write(result) 54 | f.close() 55 | 56 | def read_file(filename): 57 | if filename == '-': 58 | c = sys.stdin.read() 59 | elif not os.path.exists(filename): 60 | raise OSError( 61 | "Input file %s does not exist" % filename) 62 | else: 63 | f = open(filename, 'rb') 64 | c = f.read() 65 | f.close() 66 | return c 67 | 68 | body_start_re = re.compile( 69 | r"", re.I|re.S) 70 | body_end_re = re.compile( 71 | r"", re.I|re.S) 72 | 73 | def split_body(html): 74 | match = body_start_re.search(html) 75 | if match: 76 | pre = html[:match.end()] 77 | html = html[match.end():] 78 | match = body_end_re.search(html) 79 | if match: 80 | post = html[match.start():] 81 | html = html[:match.start()] 82 | return pre, html, post 83 | 84 | def annotate(options, args): 85 | print("Not yet implemented") 86 | sys.exit(1) 87 | 88 | -------------------------------------------------------------------------------- /lxml/html/_setmixin.py: -------------------------------------------------------------------------------- 1 | class SetMixin(object): 2 | 3 | """ 4 | Mix-in for sets. You must define __iter__, add, remove 5 | """ 6 | 7 | def __len__(self): 8 | length = 0 9 | for item in self: 10 | length += 1 11 | return length 12 | 13 | def __contains__(self, item): 14 | for has_item in self: 15 | if item == has_item: 16 | return True 17 | return False 18 | 19 | def issubset(self, other): 20 | for item in other: 21 | if item not in self: 22 | return False 23 | return True 24 | 25 | __le__ = issubset 26 | 27 | def issuperset(self, other): 28 | for item in self: 29 | if item not in other: 30 | return False 31 | return True 32 | 33 | __ge__ = issuperset 34 | 35 | def union(self, other): 36 | return self | other 37 | 38 | def __or__(self, other): 39 | new = self.copy() 40 | new |= other 41 | return new 42 | 43 | def intersection(self, other): 44 | return self & other 45 | 46 | def __and__(self, other): 47 | new = self.copy() 48 | new &= other 49 | return new 50 | 51 | def difference(self, other): 52 | return self - other 53 | 54 | def __sub__(self, other): 55 | new = self.copy() 56 | new -= other 57 | return new 58 | 59 | def symmetric_difference(self, other): 60 | return self ^ other 61 | 62 | def __xor__(self, other): 63 | new = self.copy() 64 | new ^= other 65 | return new 66 | 67 | def copy(self): 68 | return set(self) 69 | 70 | def update(self, other): 71 | for item in other: 72 | self.add(item) 73 | 74 | def __ior__(self, other): 75 | self.update(other) 76 | return self 77 | 78 | def intersection_update(self, other): 79 | for item in self: 80 | if item not in other: 81 | self.remove(item) 82 | 83 | def __iand__(self, other): 84 | self.intersection_update(other) 85 | return self 86 | 87 | def difference_update(self, other): 88 | for item in other: 89 | if item in self: 90 | self.remove(item) 91 | 92 | def __isub__(self, other): 93 | self.difference_update(other) 94 | return self 95 | 96 | def symmetric_difference_update(self, other): 97 | for item in other: 98 | if item in self: 99 | self.remove(item) 100 | else: 101 | self.add(item) 102 | 103 | def __ixor__(self, other): 104 | self.symmetric_difference_update(other) 105 | return self 106 | 107 | def discard(self, item): 108 | try: 109 | self.remove(item) 110 | except KeyError: 111 | pass 112 | 113 | def clear(self): 114 | for item in list(self): 115 | self.remove(item) 116 | -------------------------------------------------------------------------------- /lxml/html/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # 2 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_applet.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains applet 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'safe description' 3 | Options: 4 | 5 |
safe description
6 | ---------- 7 |
safe description
-------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_blink.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains embed 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'safe description' 3 | Options: 4 | Notes:
wrapper 5 | 6 |
safe description
7 | ---------- 8 |
safe description
-------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_crazy.data: -------------------------------------------------------------------------------- 1 | Description: entry content is crazy 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'Crazy HTML -' + u'- Can Your Regex Parse This?\n\n\n\n -' + u'->\n\n \n-' + u'->\n\n\n\nfunction executeMe()\n{\n\n\n\n\n/* \n

Did The Javascript Execute?

\n
\nI will execute here, too, if you mouse over me\n
' 3 | Options: -page_structure 4 | Notes: for some reason the comments in the expected field are acting weird 5 | 6 | 7 | 8 | 9 | 10 | 11 | Crazy HTML -- Can Your Regex Parse This? 12 | 13 | 14 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 61 |

Did The Javascript Execute?

62 |
66 | I will execute here, too, if you mouse over me 67 |
68 | 69 | 70 | 71 | 72 | 73 | ---------- 74 | 75 | 76 | Crazy HTML -- Can Your Regex Parse This? 77 | 78 | 79 |

Did The Javascript Execute?

80 |
81 | I will execute here, too, if you mouse over me 82 |
83 | 84 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_embed.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains embed 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'safe description' 3 | Options: 4 | Notes:
wrapper, close tag (not closing it lost the tag) 5 | 6 |
safe description
7 | ---------- 8 |
safe description
9 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_frame.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains frameset 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'safe description' 3 | Options: 4 | 5 |
safe description
6 | ---------- 7 |
safe description
8 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_iframe.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains iframe 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'safe description' 3 | Options: 4 | Notes: div wrapper, close description
7 | ---------- 8 |
safe description
-------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_link.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains link 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'safe description' 3 | Options: 4 | 5 |
safe description
6 | ---------- 7 |
safe description
8 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_meta.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains meta 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'safe description' 3 | Options: 4 | 5 |
safe description
6 | ---------- 7 |
safe description
-------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_object.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains object 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'safe description' 3 | Options: 4 | Notes: div wrapper, close 5 | 6 |
safe description
7 | ---------- 8 |
safe description
-------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onabort.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onabort 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onblur.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onblur 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onchange.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onchange 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onclick.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onclick 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_ondblclick.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains ondblclick 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: javascript 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onerror.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onerror 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onfocus.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onfocus 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onkeydown.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onkeydown 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onkeypress.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onkeypress 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onkeyup.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onkeyup 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onload.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onload 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onmousedown.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onmousedown 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onmouseout.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onmouseout 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onmouseover.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onmouseover 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onmouseup.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onmouseup 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onreset.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onreset 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onresize.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onresize 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onsubmit.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onsubmit 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_onunload.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains onunload 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'' 3 | Options: 4 | 5 | 6 | ---------- 7 | -------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_script.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains script 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'safe description' 3 | Options: 4 | 5 |
safe description
6 | ---------- 7 |
safe description
-------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_script_cdata.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains script (cdata) 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'safe description' 3 | Options: 4 | Notes: div wrapper. Currently not working because of how HTML() is parsing the CDATA (not in a useful way) 5 | The resulting code is safe, it just includes crap from the description]]> 11 | 12 | ---------- 13 |
safe description
-------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_script_inline.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains script (inline) 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'
safe description
' 3 | Options: 4 | 5 |
safe description
6 | ---------- 7 |
safe description
-------------------------------------------------------------------------------- /lxml/html/tests/feedparser-data/entry_content_style.data: -------------------------------------------------------------------------------- 1 | Description: entry content contains style 2 | Expect: not bozo and entries[0]['content'][0]['value'] == u'never trust your upstream platypus' 3 | Options: style 4 | 5 | never trust your upstream platypus 6 | ---------- 7 | never trust your upstream platypus -------------------------------------------------------------------------------- /lxml/html/tests/hackers-org-data/background-image-plus.data: -------------------------------------------------------------------------------- 1 | Description: I built a quick XSS fuzzer to detect any erroneous characters that are allowed after the open parenthesis but before the JavaScript directive in IE and Netscape 8.1 in secure site mode. These are in decimal but you can include hex and add padding of course. (Any of the following chars can be used: 1-32, 34, 39, 160, 8192-8.13, 12288, 65279) 2 | http://ha.ckers.org/xss.html#XSS_DIV_background-image_plus 3 | Options: -safe_attrs_only 4 | Notes: As you see, the CSS gets corrupted, but I don't really care that much. 5 | 6 |
text
7 | ---------- 8 |
text
9 | -------------------------------------------------------------------------------- /lxml/html/tests/hackers-org-data/background-image-with-unicoded.data: -------------------------------------------------------------------------------- 1 | Description: exploit (this has been modified slightly to obfuscate the url parameter). The original vulnerability was found by Renaud Lifchitz as a vulnerability in Hotmail. 2 | http://ha.ckers.org/xss.html#XSS_DIV_background_image_unicode 3 | Options: -safe_attrs_only 4 | Ignore: true 5 | Notes: I don't understand how this exploit works. It seems like the description actually refers to 6 | the unicode you'd import, but why that matters I don't know. 7 | 8 |
text
9 | ---------- 10 |
text
11 | -------------------------------------------------------------------------------- /lxml/html/tests/hackers-org-data/downlevel-hidden.data: -------------------------------------------------------------------------------- 1 | Description: Downlevel-Hidden-Hidden block (only works in IE5.0 and later and Netscape 8.1 in IE rendering engine mode). Some websites consider anything inside a comment block to be safe and therefore does not need to be removed, which allows our Cross Site Scripting vector. Or the system could add comment tags around something to attempt to render it harmless. As we can see, that probably wouldn't do the job 2 | http://ha.ckers.org/xss.html#XSS_Downlevel-Hidden 3 | Options: -comments, -processing_instructions 4 | 5 |
8 | ---------- 9 |
10 | -------------------------------------------------------------------------------- /lxml/html/tests/hackers-org-data/html-plus-time.data: -------------------------------------------------------------------------------- 1 | Description: HTML+TIME in XML. This is how Grey Magic hacked Hotmail and Yahoo!. This only works in Internet Explorer and Netscape 8.1 in IE rendering engine mode and remember that you need to be between HTML and BODY tags for this to work 2 | http://ha.ckers.org/xss.html#XSS_HTML_plus_time 3 | Ignore: true 4 | Notes: I don't understand the vector here, or how this is supposed to work. 5 | 6 |
7 | 8 |
9 | ---------- 10 |
11 | 12 | x
13 | -------------------------------------------------------------------------------- /lxml/html/tests/hackers-org-data/javascript-link.data: -------------------------------------------------------------------------------- 1 | Description: javascript: in many forms 2 | 3 |
4 | x 6 | x 7 | x 9 |
10 | ---------- 11 |
12 | x 13 | x 14 | x 15 |
16 | -------------------------------------------------------------------------------- /lxml/html/tests/hackers-org-data/style-comment.data: -------------------------------------------------------------------------------- 1 | Description: to break up expression (Thanks to Roman Ivanov for this one) 2 | http://ha.ckers.org/xss.html#XSS_STYLE_comment 3 | Options: -safe_attrs_only 4 | Notes: Because of the suspicious stuff in there, the style is removed entirely 5 | 6 | 7 | ---------- 8 | 9 | -------------------------------------------------------------------------------- /lxml/html/tests/hackers-org-data/style-expression.data: -------------------------------------------------------------------------------- 1 | Description: (this is really a hybrid of the above XSS vectors, but it really does show how hard STYLE tags can be to parse apart, like above this can send IE into a loop) 2 | http://ha.ckers.org/xss.html#XSS_IMG_STYLE_expression 3 | Options: -safe_attrs_only 4 | Notes: Modified to avoid a parsing in libxml2 that ruins the XSS (the " marks). 5 | Also there seemed to be an extra "p" in exppression 6 | 7 |
9 | ---------- 10 |
11 | -------------------------------------------------------------------------------- /lxml/html/tests/hackers-org-data/style-import.data: -------------------------------------------------------------------------------- 1 | Description: tags with broken up JavaScript for XSS (this XSS at times sends IE into an infinite loop of alerts) 2 | http://ha.ckers.org/xss.html#XSS_STYLE 3 | Options: -safe_attrs_only 4 | 5 |
6 | ---------- 7 |
8 | 9 | -------------------------------------------------------------------------------- /lxml/html/tests/hackers-org-data/style-js-tag.data: -------------------------------------------------------------------------------- 1 | Description: (Older versions of Netscape only) 2 | http://ha.ckers.org/xss.html#XSS_STYLE_tag 3 | Options: -safe_attrs_only 4 | 5 |
6 | ---------- 7 |
8 | -------------------------------------------------------------------------------- /lxml/html/tests/hackers-org-data/style-url-js.data: -------------------------------------------------------------------------------- 1 | Description: http://ha.ckers.org/xss.html#XSS_STYLE_background-image 2 | Options: -style, -safe_attrs_only 3 | Notes: The CSS is messed up here, but so it goes 4 | 5 |
6 | ---------- 7 |
8 | 9 | -------------------------------------------------------------------------------- /lxml/html/tests/hackers-org-data/xml-data-island.data: -------------------------------------------------------------------------------- 1 | Description: XML data island with comment obfuscation (this is another take on the same exploit that doesn't use CDATA fields, but rather uses comments to break up the javascript directive) 2 | http://ha.ckers.org/xss.html#XSS_XML_data_island_comment 3 | Ignore: true 4 | Notes: I don't understand the vector here. Maybe datasrc should be filtered? 5 | 6 |
<IMG SRC="javascript:alert('XSS')"> 7 |
8 | ---------- 9 |
<IMG SRC="javascript:alert('XSS')"> 10 | x
11 | -------------------------------------------------------------------------------- /lxml/html/tests/hackers-org-data/xml-embedded-js.data: -------------------------------------------------------------------------------- 1 | Description: Locally hosted XML with embedded JavaScript#XSS_Local_XML that is generated using an XML data island. This is the same as above but instead referrs to a locally hosted (must be on the same server) XML file that contains your cross site scripting vector. You can see the result here 2 | http://ha.ckers.org/xss.html#XSS_Local_XML 3 | 4 |
5 |
6 | ---------- 7 |
8 | 9 |
10 | -------------------------------------------------------------------------------- /lxml/html/tests/test_autolink.py: -------------------------------------------------------------------------------- 1 | import unittest, sys 2 | from lxml.tests.common_imports import make_doctest 3 | 4 | def test_suite(): 5 | suite = unittest.TestSuite() 6 | if sys.version_info >= (2,4): 7 | suite.addTests([make_doctest('test_autolink.txt')]) 8 | return suite 9 | 10 | if __name__ == '__main__': 11 | unittest.main() 12 | -------------------------------------------------------------------------------- /lxml/html/tests/test_basic.py: -------------------------------------------------------------------------------- 1 | import unittest, sys 2 | from lxml.tests.common_imports import make_doctest, doctest 3 | import lxml.html 4 | 5 | def test_suite(): 6 | suite = unittest.TestSuite() 7 | if sys.version_info >= (2,4): 8 | suite.addTests([make_doctest('test_basic.txt')]) 9 | suite.addTests([doctest.DocTestSuite(lxml.html)]) 10 | return suite 11 | 12 | if __name__ == '__main__': 13 | unittest.main() 14 | -------------------------------------------------------------------------------- /lxml/html/tests/test_clean.py: -------------------------------------------------------------------------------- 1 | import unittest, sys 2 | from lxml.tests.common_imports import make_doctest 3 | from lxml.etree import LIBXML_VERSION 4 | 5 | import lxml.html 6 | from lxml.html.clean import Cleaner, clean_html 7 | 8 | 9 | class CleanerTest(unittest.TestCase): 10 | def test_allow_tags(self): 11 | html = """ 12 | 13 | 14 | 15 | 16 |

some text

17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
helloworld
helloworld
25 | 26 | 27 | 28 | """ 29 | 30 | html_root = lxml.html.document_fromstring(html) 31 | cleaner = Cleaner( 32 | remove_unknown_tags = False, 33 | allow_tags = ['table', 'tr', 'td']) 34 | result = cleaner.clean_html(html_root) 35 | 36 | self.assertEqual(12-5+1, len(list(result.iter()))) 37 | 38 | def test_safe_attrs_included(self): 39 | html = """

Cyan

""" 40 | 41 | safe_attrs=set(lxml.html.defs.safe_attrs) 42 | safe_attrs.add('style') 43 | 44 | cleaner = Cleaner( 45 | safe_attrs_only=True, 46 | safe_attrs=safe_attrs) 47 | result = cleaner.clean_html(html) 48 | 49 | self.assertEqual(html, result) 50 | 51 | def test_safe_attrs_excluded(self): 52 | html = """

Cyan

""" 53 | expected = """

Cyan

""" 54 | 55 | safe_attrs=set() 56 | 57 | cleaner = Cleaner( 58 | safe_attrs_only=True, 59 | safe_attrs=safe_attrs) 60 | result = cleaner.clean_html(html) 61 | 62 | self.assertEqual(expected, result) 63 | 64 | def test_clean_invalid_root_tag(self): 65 | # only testing that cleaning with invalid root tags works at all 66 | s = lxml.html.fromstring('parent child') 67 | self.assertEqual('parent child', clean_html(s).text_content()) 68 | 69 | s = lxml.html.fromstring('child') 70 | self.assertEqual('child', clean_html(s).text_content()) 71 | 72 | 73 | def test_suite(): 74 | suite = unittest.TestSuite() 75 | if sys.version_info >= (2,4): 76 | suite.addTests([make_doctest('test_clean.txt')]) 77 | if LIBXML_VERSION >= (2,6,31): 78 | suite.addTests([make_doctest('test_clean_embed.txt')]) 79 | suite.addTests(unittest.makeSuite(CleanerTest)) 80 | return suite 81 | -------------------------------------------------------------------------------- /lxml/html/tests/test_clean_embed.txt: -------------------------------------------------------------------------------- 1 | THIS FAILS IN libxml2 2.6.29 AND 2.6.30 !! 2 | 3 | 4 | >>> from lxml.html import fromstring, tostring 5 | >>> from lxml.html.clean import clean, clean_html, Cleaner 6 | >>> from lxml.html import usedoctest 7 | 8 | >>> def tostring(el): # work-around for Py3 'bytes' type 9 | ... from lxml.html import tostring 10 | ... s = tostring(el) 11 | ... if not isinstance(s, str): 12 | ... s = s.decode('UTF-8') 13 | ... return s 14 | 15 | >>> doc_embed = '''
16 | ... 17 | ... 18 | ... 19 | ... 20 | ...
''' 21 | >>> print(tostring(fromstring(doc_embed))) 22 |
23 | 24 | 25 | 26 | 27 |
28 | >>> print(Cleaner().clean_html(doc_embed)) 29 |
30 |
31 | >>> print(Cleaner(host_whitelist=['www.youtube.com']).clean_html(doc_embed)) 32 |
33 | 34 |
35 | >>> print(Cleaner(host_whitelist=['www.youtube.com'], whitelist_tags=None).clean_html(doc_embed)) 36 |
37 | 38 | 39 |
40 | -------------------------------------------------------------------------------- /lxml/html/tests/test_diff.py: -------------------------------------------------------------------------------- 1 | import unittest, sys 2 | from lxml.tests.common_imports import make_doctest, doctest 3 | 4 | from lxml.html import diff 5 | 6 | def test_suite(): 7 | suite = unittest.TestSuite() 8 | if sys.version_info >= (2,4): 9 | suite.addTests([make_doctest('test_diff.txt'), 10 | doctest.DocTestSuite(diff)]) 11 | return suite 12 | 13 | if __name__ == '__main__': 14 | unittest.main() 15 | -------------------------------------------------------------------------------- /lxml/html/tests/test_elementsoup.py: -------------------------------------------------------------------------------- 1 | import unittest, sys 2 | from lxml.tests.common_imports import make_doctest, HelperTestCase 3 | 4 | try: 5 | import BeautifulSoup 6 | BS_INSTALLED = True 7 | except ImportError: 8 | BS_INSTALLED = False 9 | 10 | if BS_INSTALLED: 11 | class SoupParserTestCase(HelperTestCase): 12 | from lxml.html import soupparser 13 | 14 | def test_broken_attribute(self): 15 | html = """\ 16 | 17 |
18 | 19 | """ 20 | root = self.soupparser.fromstring(html) 21 | self.assertTrue(root.find('.//input').get('disabled') is not None) 22 | 23 | 24 | def test_suite(): 25 | suite = unittest.TestSuite() 26 | if BS_INSTALLED: 27 | suite.addTests([unittest.makeSuite(SoupParserTestCase)]) 28 | if sys.version_info[0] < 3: 29 | suite.addTests([make_doctest('../../../../doc/elementsoup.txt')]) 30 | return suite 31 | 32 | if __name__ == '__main__': 33 | unittest.main() 34 | -------------------------------------------------------------------------------- /lxml/html/tests/test_formfill.py: -------------------------------------------------------------------------------- 1 | import unittest, sys 2 | from lxml.tests.common_imports import make_doctest 3 | 4 | def test_suite(): 5 | suite = unittest.TestSuite() 6 | if sys.version_info >= (2,4): 7 | suite.addTests([make_doctest('test_formfill.txt')]) 8 | return suite 9 | -------------------------------------------------------------------------------- /lxml/html/tests/test_forms.py: -------------------------------------------------------------------------------- 1 | import unittest, sys 2 | from lxml.tests.common_imports import make_doctest 3 | 4 | def test_suite(): 5 | suite = unittest.TestSuite() 6 | if sys.version_info >= (2,4): 7 | suite.addTests([make_doctest('test_forms.txt')]) 8 | return suite 9 | 10 | if __name__ == '__main__': 11 | unittest.main() 12 | -------------------------------------------------------------------------------- /lxml/html/tests/test_frames.py: -------------------------------------------------------------------------------- 1 | import unittest, sys 2 | from lxml.tests.common_imports import make_doctest, doctest 3 | import lxml.html 4 | from lxml.html import html_parser, XHTML_NAMESPACE 5 | 6 | class FrameTest(unittest.TestCase): 7 | 8 | def test_parse_fragments_fromstring(self): 9 | parser = lxml.html.HTMLParser(encoding='utf-8', remove_comments=True) 10 | html = """ 11 | 12 | """ 13 | etree_document = lxml.html.fragments_fromstring(html, parser=parser) 14 | self.assertEqual(len(etree_document), 1) 15 | root = etree_document[0] 16 | self.assertEqual(root.tag, "frameset") 17 | frame_element = root[0] 18 | self.assertEqual(frame_element.tag, 'frame') 19 | 20 | def test_parse_fromstring(self): 21 | parser = lxml.html.HTMLParser(encoding='utf-8', remove_comments=True) 22 | html = """ 23 | 24 | """ 25 | etree_document = lxml.html.fromstring(html, parser=parser) 26 | self.assertEqual(etree_document.tag, 'html') 27 | self.assertEqual(len(etree_document), 1) 28 | frameset_element = etree_document[0] 29 | self.assertEqual(len(frameset_element), 1) 30 | frame_element = frameset_element[0] 31 | self.assertEqual(frame_element.tag, 'frame') 32 | 33 | 34 | def test_suite(): 35 | loader = unittest.TestLoader() 36 | return loader.loadTestsFromModule(sys.modules[__name__]) -------------------------------------------------------------------------------- /lxml/html/tests/test_rewritelinks.py: -------------------------------------------------------------------------------- 1 | import unittest, sys 2 | from lxml.tests.common_imports import make_doctest 3 | 4 | def test_suite(): 5 | suite = unittest.TestSuite() 6 | if sys.version_info >= (2,4): 7 | suite.addTests([make_doctest('test_rewritelinks.txt')]) 8 | return suite 9 | 10 | if __name__ == '__main__': 11 | unittest.main() 12 | -------------------------------------------------------------------------------- /lxml/html/tests/test_xhtml.py: -------------------------------------------------------------------------------- 1 | import unittest, sys 2 | from lxml.tests.common_imports import make_doctest 3 | import lxml.html 4 | 5 | def test_suite(): 6 | suite = unittest.TestSuite() 7 | suite.addTests([make_doctest('test_xhtml.txt')]) 8 | return suite 9 | 10 | if __name__ == '__main__': 11 | unittest.main() 12 | -------------------------------------------------------------------------------- /lxml/html/tests/test_xhtml.txt: -------------------------------------------------------------------------------- 1 | >>> from lxml.html import document_fromstring, fragment_fromstring, tostring 2 | 3 | lxml.html has two parsers, one for HTML, one for XHTML: 4 | 5 | >>> from lxml.html import HTMLParser, XHTMLParser 6 | >>> html = "

Hi!

" 7 | 8 | >>> root = document_fromstring(html, parser=HTMLParser()) 9 | >>> print(root.tag) 10 | html 11 | 12 | >>> root = document_fromstring(html, parser=XHTMLParser()) 13 | >>> print(root.tag) 14 | html 15 | 16 | There are two functions for converting between HTML and XHTML: 17 | 18 | >>> from lxml.html import xhtml_to_html, html_to_xhtml 19 | 20 | >>> doc = document_fromstring(html, parser=HTMLParser()) 21 | >>> tostring(doc) 22 | b'

Hi!

' 23 | 24 | >>> html_to_xhtml(doc) 25 | >>> tostring(doc) 26 | b'Hi!' 27 | 28 | >>> xhtml_to_html(doc) 29 | >>> tostring(doc) 30 | b'

Hi!

' 31 | -------------------------------------------------------------------------------- /lxml/html/tests/transform_feedparser_data.py: -------------------------------------------------------------------------------- 1 | """ 2 | This takes the feedparser tests from here: 3 | 4 | http://feedparser.org/tests/wellformed/sanitize/ 5 | 6 | and rewrites them to be easier to handle (not using the internal model 7 | of feedparser). The input format is:: 8 | 9 | 13 | ... 14 | {content} 15 | ... 16 | 17 | The Expect expression is checked for 18 | ``entries[0]['content'][0]['value'] == {data}``. 19 | 20 | The output format is:: 21 | 22 | Description: {description} 23 | Expect: {expression} (if data couldn't be parsed) 24 | Options: 25 | 26 | {content, unescaped} 27 | ---------- 28 | {data, unescaped, if found} 29 | 30 | """ 31 | 32 | import re 33 | import os 34 | import traceback 35 | 36 | _desc_re = re.compile(r'\s*Description:\s*(.*)') 37 | _expect_re = re.compile(r'\s*Expect:\s*(.*)') 38 | _data_expect_re = re.compile(r"entries\[0\]\['[^']+'\](?:\[0\]\['value'\])?\s*==\s*(.*)") 39 | _feed_data_expect_re = re.compile(r"feed\['[^']+'\]\s*==\s*(.*)") 40 | 41 | def parse_content(content): 42 | match = _desc_re.search(content) 43 | desc = match.group(1) 44 | match = _expect_re.search(content) 45 | expect = match.group(1) 46 | data = None 47 | for regex in [_data_expect_re, _feed_data_expect_re]: 48 | match = regex.search(expect) 49 | if match: 50 | # Icky, but I'll trust it 51 | data = eval(match.group(1).strip()) 52 | break 53 | c = None 54 | for tag in ['content', 'summary', 'title', 'copyright', 'tagline', 'info', 'subtitle', 'fullitem', 'body', 'description', 'content:encoded']: 55 | regex = re.compile(r"<%s.*?>(.*)" % (tag, tag), re.S) 56 | match = regex.search(content) 57 | if match: 58 | c = match.group(1) 59 | break 60 | assert c is not None 61 | # Seems like body isn't quoted 62 | if tag != 'body': 63 | c = c.replace('<', '<') 64 | c = c.replace('&', '&') 65 | # FIXME: I should really do more unescaping... 66 | return { 67 | 'Description': desc, 68 | 'Expect': expect, 69 | 'data': data, 70 | 'content': c} 71 | 72 | def serialize_content(d): 73 | s = '''\ 74 | Description: %(Description)s 75 | Expect: %(Expect)s 76 | Options: 77 | 78 | %(content)s 79 | ''' % d 80 | if d.get('data') is not None: 81 | s += '----------\n%s' % d['data'] 82 | return s 83 | 84 | def translate_file(filename): 85 | f = open(filename, 'rb') 86 | c = f.read() 87 | f.close() 88 | try: 89 | output = serialize_content(parse_content(c)) 90 | except: 91 | print('Bad data in %s:' % filename) 92 | print(c) 93 | traceback.print_exc() 94 | print('-'*60) 95 | return 96 | new = os.path.splitext(filename)[0] + '.data' 97 | f = open(new, 'wb') 98 | f.write(output) 99 | f.close() 100 | 101 | def translate_all(dir): 102 | for fn in os.listdir(dir): 103 | fn = os.path.join(dir, fn) 104 | if fn.endswith('.xml'): 105 | translate_file(fn) 106 | 107 | if __name__ == '__main__': 108 | import sys 109 | translate_all(os.path.join(os.path.dirname(__file__), 'feedparser-data')) 110 | 111 | -------------------------------------------------------------------------------- /lxml/html/usedoctest.py: -------------------------------------------------------------------------------- 1 | """Doctest module for HTML comparison. 2 | 3 | Usage:: 4 | 5 | >>> import lxml.html.usedoctest 6 | >>> # now do your HTML doctests ... 7 | 8 | See `lxml.doctestcompare`. 9 | """ 10 | 11 | from lxml import doctestcompare 12 | 13 | doctestcompare.temp_install(html=True, del_module=__name__) 14 | -------------------------------------------------------------------------------- /lxml/includes/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/05sonicblue/GamezServer/9634af9bd046f8135a387046a3c0c5f226eb93d0/lxml/includes/__init__.py -------------------------------------------------------------------------------- /lxml/includes/c14n.pxd: -------------------------------------------------------------------------------- 1 | from lxml.includes.tree cimport xmlDoc, xmlOutputBuffer, xmlChar 2 | from lxml.includes.xpath cimport xmlNodeSet 3 | 4 | cdef extern from "libxml/c14n.h": 5 | cdef int xmlC14NDocDumpMemory(xmlDoc* doc, 6 | xmlNodeSet* nodes, 7 | int exclusive, 8 | xmlChar** inclusive_ns_prefixes, 9 | int with_comments, 10 | xmlChar** doc_txt_ptr) nogil 11 | 12 | cdef int xmlC14NDocSave(xmlDoc* doc, 13 | xmlNodeSet* nodes, 14 | int exclusive, 15 | xmlChar** inclusive_ns_prefixes, 16 | int with_comments, 17 | char* filename, 18 | int compression) nogil 19 | 20 | cdef int xmlC14NDocSaveTo(xmlDoc* doc, 21 | xmlNodeSet* nodes, 22 | int exclusive, 23 | xmlChar** inclusive_ns_prefixes, 24 | int with_comments, 25 | xmlOutputBuffer* buffer) nogil 26 | 27 | -------------------------------------------------------------------------------- /lxml/includes/config.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "etree_defs.h": 2 | cdef bint ENABLE_THREADING 3 | cdef bint ENABLE_SCHEMATRON 4 | -------------------------------------------------------------------------------- /lxml/includes/dtdvalid.pxd: -------------------------------------------------------------------------------- 1 | from lxml.includes cimport tree 2 | from lxml.includes.tree cimport xmlDoc, xmlDtd 3 | 4 | cdef extern from "libxml/valid.h" nogil: 5 | ctypedef void (*xmlValidityErrorFunc)(void * ctx, const char * msg, ...) 6 | ctypedef void (*xmlValidityWarningFunc)(void * ctx, const char * msg, ...) 7 | 8 | ctypedef struct xmlValidCtxt: 9 | void *userData 10 | xmlValidityErrorFunc error 11 | xmlValidityWarningFunc warning 12 | 13 | cdef xmlValidCtxt* xmlNewValidCtxt() 14 | cdef void xmlFreeValidCtxt(xmlValidCtxt* cur) 15 | 16 | cdef int xmlValidateDtd(xmlValidCtxt* ctxt, xmlDoc* doc, xmlDtd* dtd) 17 | cdef tree.xmlElement* xmlGetDtdElementDesc( 18 | xmlDtd* dtd, tree.const_xmlChar* name) 19 | -------------------------------------------------------------------------------- /lxml/includes/htmlparser.pxd: -------------------------------------------------------------------------------- 1 | from libc.string cimport const_char 2 | 3 | from lxml.includes.tree cimport xmlDoc 4 | from lxml.includes.tree cimport xmlInputReadCallback, xmlInputCloseCallback 5 | from lxml.includes.xmlparser cimport xmlParserCtxt, xmlSAXHandler, xmlSAXHandlerV1 6 | 7 | cdef extern from "libxml/HTMLparser.h": 8 | ctypedef enum htmlParserOption: 9 | HTML_PARSE_NOERROR # suppress error reports 10 | HTML_PARSE_NOWARNING # suppress warning reports 11 | HTML_PARSE_PEDANTIC # pedantic error reporting 12 | HTML_PARSE_NOBLANKS # remove blank nodes 13 | HTML_PARSE_NONET # Forbid network access 14 | # libxml2 2.6.21+ only: 15 | HTML_PARSE_RECOVER # Relaxed parsing 16 | HTML_PARSE_COMPACT # compact small text nodes 17 | # libxml2 2.7.7+ only: 18 | HTML_PARSE_NOIMPLIED # Do not add implied html/body... elements 19 | # libxml2 2.7.8+ only: 20 | HTML_PARSE_NODEFDTD # do not default a doctype if not found 21 | # libxml2 2.8.0+ only: 22 | XML_PARSE_IGNORE_ENC # ignore internal document encoding hint 23 | 24 | xmlSAXHandlerV1 htmlDefaultSAXHandler 25 | 26 | cdef xmlParserCtxt* htmlCreateMemoryParserCtxt( 27 | char* buffer, int size) nogil 28 | cdef xmlParserCtxt* htmlCreateFileParserCtxt( 29 | char* filename, char* encoding) nogil 30 | cdef xmlParserCtxt* htmlCreatePushParserCtxt(xmlSAXHandler* sax, 31 | void* user_data, 32 | char* chunk, int size, 33 | char* filename, int enc) nogil 34 | cdef void htmlFreeParserCtxt(xmlParserCtxt* ctxt) nogil 35 | cdef void htmlCtxtReset(xmlParserCtxt* ctxt) nogil 36 | cdef int htmlCtxtUseOptions(xmlParserCtxt* ctxt, int options) nogil 37 | cdef int htmlParseDocument(xmlParserCtxt* ctxt) nogil 38 | cdef int htmlParseChunk(xmlParserCtxt* ctxt, 39 | char* chunk, int size, int terminate) nogil 40 | 41 | cdef xmlDoc* htmlCtxtReadFile(xmlParserCtxt* ctxt, 42 | char* filename, const_char* encoding, 43 | int options) nogil 44 | cdef xmlDoc* htmlCtxtReadDoc(xmlParserCtxt* ctxt, 45 | char* buffer, char* URL, const_char* encoding, 46 | int options) nogil 47 | cdef xmlDoc* htmlCtxtReadIO(xmlParserCtxt* ctxt, 48 | xmlInputReadCallback ioread, 49 | xmlInputCloseCallback ioclose, 50 | void* ioctx, 51 | char* URL, const_char* encoding, 52 | int options) nogil 53 | cdef xmlDoc* htmlCtxtReadMemory(xmlParserCtxt* ctxt, 54 | char* buffer, int size, 55 | char* filename, const_char* encoding, 56 | int options) nogil 57 | -------------------------------------------------------------------------------- /lxml/includes/lxml-version.h: -------------------------------------------------------------------------------- 1 | #ifndef LXML_VERSION_STRING 2 | #define LXML_VERSION_STRING "3.4.3" 3 | #endif 4 | -------------------------------------------------------------------------------- /lxml/includes/relaxng.pxd: -------------------------------------------------------------------------------- 1 | from lxml.includes.tree cimport xmlDoc 2 | from lxml.includes.xmlerror cimport xmlStructuredErrorFunc 3 | 4 | cdef extern from "libxml/relaxng.h": 5 | ctypedef struct xmlRelaxNG 6 | ctypedef struct xmlRelaxNGParserCtxt 7 | 8 | ctypedef struct xmlRelaxNGValidCtxt 9 | 10 | ctypedef enum xmlRelaxNGValidErr: 11 | XML_RELAXNG_OK = 0 12 | XML_RELAXNG_ERR_MEMORY = 1 13 | XML_RELAXNG_ERR_TYPE = 2 14 | XML_RELAXNG_ERR_TYPEVAL = 3 15 | XML_RELAXNG_ERR_DUPID = 4 16 | XML_RELAXNG_ERR_TYPECMP = 5 17 | XML_RELAXNG_ERR_NOSTATE = 6 18 | XML_RELAXNG_ERR_NODEFINE = 7 19 | XML_RELAXNG_ERR_LISTEXTRA = 8 20 | XML_RELAXNG_ERR_LISTEMPTY = 9 21 | XML_RELAXNG_ERR_INTERNODATA = 10 22 | XML_RELAXNG_ERR_INTERSEQ = 11 23 | XML_RELAXNG_ERR_INTEREXTRA = 12 24 | XML_RELAXNG_ERR_ELEMNAME = 13 25 | XML_RELAXNG_ERR_ATTRNAME = 14 26 | XML_RELAXNG_ERR_ELEMNONS = 15 27 | XML_RELAXNG_ERR_ATTRNONS = 16 28 | XML_RELAXNG_ERR_ELEMWRONGNS = 17 29 | XML_RELAXNG_ERR_ATTRWRONGNS = 18 30 | XML_RELAXNG_ERR_ELEMEXTRANS = 19 31 | XML_RELAXNG_ERR_ATTREXTRANS = 20 32 | XML_RELAXNG_ERR_ELEMNOTEMPTY = 21 33 | XML_RELAXNG_ERR_NOELEM = 22 34 | XML_RELAXNG_ERR_NOTELEM = 23 35 | XML_RELAXNG_ERR_ATTRVALID = 24 36 | XML_RELAXNG_ERR_CONTENTVALID = 25 37 | XML_RELAXNG_ERR_EXTRACONTENT = 26 38 | XML_RELAXNG_ERR_INVALIDATTR = 27 39 | XML_RELAXNG_ERR_DATAELEM = 28 40 | XML_RELAXNG_ERR_VALELEM = 29 41 | XML_RELAXNG_ERR_LISTELEM = 30 42 | XML_RELAXNG_ERR_DATATYPE = 31 43 | XML_RELAXNG_ERR_VALUE = 32 44 | XML_RELAXNG_ERR_LIST = 33 45 | XML_RELAXNG_ERR_NOGRAMMAR = 34 46 | XML_RELAXNG_ERR_EXTRADATA = 35 47 | XML_RELAXNG_ERR_LACKDATA = 36 48 | XML_RELAXNG_ERR_INTERNAL = 37 49 | XML_RELAXNG_ERR_ELEMWRONG = 38 50 | XML_RELAXNG_ERR_TEXTWRONG = 39 51 | 52 | cdef xmlRelaxNGValidCtxt* xmlRelaxNGNewValidCtxt(xmlRelaxNG* schema) nogil 53 | cdef int xmlRelaxNGValidateDoc(xmlRelaxNGValidCtxt* ctxt, xmlDoc* doc) nogil 54 | cdef xmlRelaxNG* xmlRelaxNGParse(xmlRelaxNGParserCtxt* ctxt) nogil 55 | cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewParserCtxt(char* URL) nogil 56 | cdef xmlRelaxNGParserCtxt* xmlRelaxNGNewDocParserCtxt(xmlDoc* doc) nogil 57 | cdef void xmlRelaxNGFree(xmlRelaxNG* schema) nogil 58 | cdef void xmlRelaxNGFreeParserCtxt(xmlRelaxNGParserCtxt* ctxt) nogil 59 | cdef void xmlRelaxNGFreeValidCtxt(xmlRelaxNGValidCtxt* ctxt) nogil 60 | 61 | cdef void xmlRelaxNGSetValidStructuredErrors( 62 | xmlRelaxNGValidCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) nogil 63 | cdef void xmlRelaxNGSetParserStructuredErrors( 64 | xmlRelaxNGParserCtxt* ctxt, xmlStructuredErrorFunc serror, void *ctx) nogil 65 | -------------------------------------------------------------------------------- /lxml/includes/schematron.pxd: -------------------------------------------------------------------------------- 1 | from lxml.includes cimport xmlerror 2 | from lxml.includes.tree cimport xmlDoc 3 | 4 | cdef extern from "libxml/schematron.h": 5 | ctypedef struct xmlSchematron 6 | ctypedef struct xmlSchematronParserCtxt 7 | ctypedef struct xmlSchematronValidCtxt 8 | 9 | ctypedef enum xmlSchematronValidOptions: 10 | XML_SCHEMATRON_OUT_QUIET = 1 # quiet no report 11 | XML_SCHEMATRON_OUT_TEXT = 2 # build a textual report 12 | XML_SCHEMATRON_OUT_XML = 4 # output SVRL 13 | XML_SCHEMATRON_OUT_ERROR = 8 # output via xmlStructuredErrorFunc 14 | XML_SCHEMATRON_OUT_FILE = 256 # output to a file descriptor 15 | XML_SCHEMATRON_OUT_BUFFER = 512 # output to a buffer 16 | XML_SCHEMATRON_OUT_IO = 1024 # output to I/O mechanism 17 | 18 | cdef xmlSchematronParserCtxt* xmlSchematronNewDocParserCtxt( 19 | xmlDoc* doc) nogil 20 | cdef xmlSchematronParserCtxt* xmlSchematronNewParserCtxt( 21 | char* filename) nogil 22 | cdef xmlSchematronValidCtxt* xmlSchematronNewValidCtxt( 23 | xmlSchematron* schema, int options) nogil 24 | 25 | cdef xmlSchematron* xmlSchematronParse(xmlSchematronParserCtxt* ctxt) nogil 26 | cdef int xmlSchematronValidateDoc(xmlSchematronValidCtxt* ctxt, 27 | xmlDoc* instance) nogil 28 | 29 | cdef void xmlSchematronFreeParserCtxt(xmlSchematronParserCtxt* ctxt) nogil 30 | cdef void xmlSchematronFreeValidCtxt(xmlSchematronValidCtxt* ctxt) nogil 31 | cdef void xmlSchematronFree(xmlSchematron* schema) nogil 32 | cdef void xmlSchematronSetValidStructuredErrors( 33 | xmlSchematronValidCtxt* ctxt, 34 | xmlerror.xmlStructuredErrorFunc error_func, void *data) 35 | -------------------------------------------------------------------------------- /lxml/includes/uri.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "libxml/uri.h": 2 | ctypedef struct xmlURI 3 | 4 | cdef xmlURI* xmlParseURI(char* str) 5 | cdef void xmlFreeURI(xmlURI* uri) 6 | -------------------------------------------------------------------------------- /lxml/includes/xinclude.pxd: -------------------------------------------------------------------------------- 1 | from lxml.includes.tree cimport xmlDoc, xmlNode 2 | 3 | cdef extern from "libxml/xinclude.h": 4 | 5 | ctypedef struct xmlXIncludeCtxt 6 | 7 | cdef int xmlXIncludeProcess(xmlDoc* doc) nogil 8 | cdef int xmlXIncludeProcessFlags(xmlDoc* doc, int parser_opts) nogil 9 | cdef int xmlXIncludeProcessTree(xmlNode* doc) nogil 10 | cdef int xmlXIncludeProcessTreeFlags(xmlNode* doc, int parser_opts) nogil 11 | 12 | # libxml2 >= 2.7.4 13 | cdef int xmlXIncludeProcessTreeFlagsData( 14 | xmlNode* doc, int parser_opts, void* data) nogil 15 | 16 | cdef xmlXIncludeCtxt* xmlXIncludeNewContext(xmlDoc* doc) nogil 17 | cdef int xmlXIncludeProcessNode(xmlXIncludeCtxt* ctxt, xmlNode* node) nogil 18 | cdef int xmlXIncludeSetFlags(xmlXIncludeCtxt* ctxt, int flags) nogil 19 | 20 | # libxml2 >= 2.6.27 21 | cdef int xmlXIncludeProcessFlagsData( 22 | xmlDoc* doc, int flags, void* data) nogil 23 | -------------------------------------------------------------------------------- /lxml/includes/xmlschema.pxd: -------------------------------------------------------------------------------- 1 | from lxml.includes.tree cimport xmlDoc 2 | from lxml.includes.xmlparser cimport xmlSAXHandler 3 | from lxml.includes.xmlerror cimport xmlStructuredErrorFunc 4 | 5 | cdef extern from "libxml/xmlschemas.h": 6 | ctypedef struct xmlSchema 7 | ctypedef struct xmlSchemaParserCtxt 8 | 9 | ctypedef struct xmlSchemaSAXPlugStruct 10 | ctypedef struct xmlSchemaValidCtxt 11 | 12 | ctypedef enum xmlSchemaValidOption: 13 | XML_SCHEMA_VAL_VC_I_CREATE = 1 14 | 15 | cdef xmlSchemaValidCtxt* xmlSchemaNewValidCtxt(xmlSchema* schema) nogil 16 | cdef void xmlSchemaSetParserStructuredErrors(xmlSchemaParserCtxt* ctxt, 17 | xmlStructuredErrorFunc serror, void *ctx) 18 | cdef void xmlSchemaSetValidStructuredErrors(xmlSchemaValidCtxt* ctxt, 19 | xmlStructuredErrorFunc serror, void *ctx) 20 | 21 | cdef int xmlSchemaValidateDoc(xmlSchemaValidCtxt* ctxt, xmlDoc* doc) nogil 22 | cdef xmlSchema* xmlSchemaParse(xmlSchemaParserCtxt* ctxt) nogil 23 | cdef xmlSchemaParserCtxt* xmlSchemaNewParserCtxt(char* URL) nogil 24 | cdef xmlSchemaParserCtxt* xmlSchemaNewDocParserCtxt(xmlDoc* doc) nogil 25 | cdef void xmlSchemaFree(xmlSchema* schema) nogil 26 | cdef void xmlSchemaFreeParserCtxt(xmlSchemaParserCtxt* ctxt) nogil 27 | cdef void xmlSchemaFreeValidCtxt(xmlSchemaValidCtxt* ctxt) nogil 28 | cdef int xmlSchemaSetValidOptions(xmlSchemaValidCtxt* ctxt, 29 | int options) nogil 30 | 31 | cdef xmlSchemaSAXPlugStruct* xmlSchemaSAXPlug(xmlSchemaValidCtxt* ctxt, 32 | xmlSAXHandler** sax, 33 | void** data) nogil 34 | cdef int xmlSchemaSAXUnplug(xmlSchemaSAXPlugStruct* sax_plug) 35 | cdef int xmlSchemaIsValid(xmlSchemaValidCtxt* ctxt) 36 | -------------------------------------------------------------------------------- /lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl: -------------------------------------------------------------------------------- 1 | 2 | 25 | 26 | 27 | 28 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | 45 | 46 | 47 | 48 | 49 | ( 51 | / 52 | ) 53 | 54 | 55 | -------------------------------------------------------------------------------- /lxml/lxml_endian.h: -------------------------------------------------------------------------------- 1 | #ifndef PY_BIG_ENDIAN 2 | 3 | #ifdef _MSC_VER 4 | typedef unsigned __int32 uint32_t; 5 | #else 6 | #include 7 | #endif 8 | 9 | static CYTHON_INLINE int _lx__is_big_endian(void) { 10 | union {uint32_t i; char c[4];} x = {0x01020304}; 11 | return x.c[0] == 1; 12 | } 13 | #define PY_BIG_ENDIAN _lx__is_big_endian() 14 | #endif 15 | -------------------------------------------------------------------------------- /lxml/pyclasslookup.py: -------------------------------------------------------------------------------- 1 | # dummy module for backwards compatibility 2 | 3 | from lxml.etree import PythonElementClassLookup 4 | -------------------------------------------------------------------------------- /lxml/tests/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | The lxml test suite for lxml, ElementTree and cElementTree. 3 | """ 4 | 5 | -------------------------------------------------------------------------------- /lxml/tests/dummy_http_server.py: -------------------------------------------------------------------------------- 1 | """ 2 | Simple HTTP request dumper for tests in Python 2.5+. 3 | """ 4 | 5 | import sys 6 | from contextlib import contextmanager 7 | 8 | try: 9 | import urlparse 10 | except ImportError: 11 | # Python 3 12 | import urllib.parse as urlparse 13 | 14 | 15 | @contextmanager 16 | def webserver(app, port=0, host=None): 17 | """Context manager entry point for the 'with' statement. 18 | 19 | Pass 0 as port number to dynamically allocate a free port. 20 | 21 | Usage: 22 | 23 | with webserver(wsgi_app_function, 8080) as host_url: 24 | do_ws_calls(host_url) 25 | """ 26 | server = build_web_server(app, port, host or '127.0.0.1') 27 | host, port = server.socket.getsockname() 28 | 29 | import threading 30 | thread = threading.Thread(target=server.serve_forever, 31 | kwargs={'poll_interval': 0.5}) 32 | thread.setDaemon(True) 33 | thread.start() 34 | try: 35 | yield 'http://%s:%s/' % (host, port) # yield control to 'with' body 36 | finally: 37 | server.shutdown() 38 | server.server_close() 39 | 40 | 41 | try: 42 | from SocketServer import ThreadingMixIn 43 | except ImportError: 44 | # Python 3 45 | from socketserver import ThreadingMixIn 46 | 47 | import wsgiref.simple_server as wsgiserver 48 | class WebServer(wsgiserver.WSGIServer, ThreadingMixIn): 49 | """A web server that starts a new thread for each request. 50 | """ 51 | 52 | 53 | class _RequestHandler(wsgiserver.WSGIRequestHandler): 54 | def get_stderr(self): 55 | # don't write to stderr 56 | return sys.stdout 57 | 58 | def log_message(self, format, *args): 59 | # message = "wsmock(%s) %s" % (self.address_string(), format % args) 60 | pass # don't log messages 61 | 62 | 63 | def build_web_server(app, port, host=None): 64 | server = wsgiserver.make_server( 65 | host or '', port, app, 66 | server_class=WebServer, 67 | handler_class=_RequestHandler) 68 | return server 69 | 70 | 71 | class HTTPRequestCollector(object): 72 | def __init__(self, response_data, response_code=200, headers=()): 73 | self.requests = [] 74 | self.response_code = response_code 75 | self.response_data = response_data 76 | self.headers = list(headers or ()) 77 | 78 | def __call__(self, environ, start_response): 79 | self.requests.append(( 80 | environ.get('PATH_INFO'), 81 | urlparse.parse_qsl(environ.get('QUERY_STRING')))) 82 | start_response('%s OK' % self.response_code, self.headers) 83 | return [self.response_data] 84 | -------------------------------------------------------------------------------- /lxml/tests/include/test_xinclude.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /lxml/tests/test-document.xslt: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /lxml/tests/test-string.xml: -------------------------------------------------------------------------------- 1 | 2 | Søk på nettet 3 | -------------------------------------------------------------------------------- /lxml/tests/test.dtd: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /lxml/tests/test.sch: -------------------------------------------------------------------------------- 1 | 2 | 3 | mandatory number_of_entries tests 4 | 5 | [ERROR] number_of_entries () must equal the number of entries/entry elements () 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lxml/tests/test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /lxml/tests/test.xsd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lxml/tests/test1.rng: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /lxml/tests/test1.xslt: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 |

Foo

7 |
8 | 9 |
10 | -------------------------------------------------------------------------------- /lxml/tests/test2.rng: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /lxml/tests/test2.xslt: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 |

hello

6 |
7 | 8 |
9 | -------------------------------------------------------------------------------- /lxml/tests/test_broken.xml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lxml/tests/test_builder.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import unittest 3 | 4 | """ 5 | Tests that ElementMaker works properly. 6 | """ 7 | 8 | import sys, os.path 9 | from lxml import etree 10 | from lxml.builder import E 11 | 12 | this_dir = os.path.dirname(__file__) 13 | if this_dir not in sys.path: 14 | sys.path.insert(0, this_dir) # needed for Py3 15 | 16 | from common_imports import HelperTestCase, BytesIO, _bytes 17 | 18 | 19 | class BuilderTestCase(HelperTestCase): 20 | etree = etree 21 | 22 | def test_build_from_xpath_result(self): 23 | class StringSubclass(str): pass 24 | wrapped = E.b(StringSubclass('Hello')) 25 | self.assertEqual(_bytes('Hello'), etree.tostring(wrapped)) 26 | 27 | def test_unknown_type_raises(self): 28 | class UnknownType(object): 29 | pass 30 | self.assertRaises(TypeError, E.b, UnknownType()) 31 | 32 | def test_cdata(self): 33 | wrapped = E.b(etree.CDATA('Hello')) 34 | self.assertEqual(_bytes(''), etree.tostring(wrapped)) 35 | 36 | def test_cdata_solo(self): 37 | self.assertRaises(ValueError, E.b, 'Hello', etree.CDATA('World')) 38 | 39 | 40 | def test_suite(): 41 | suite = unittest.TestSuite() 42 | suite.addTests([unittest.makeSuite(BuilderTestCase)]) 43 | return suite 44 | 45 | if __name__ == '__main__': 46 | print('to test use test.py %s' % __file__) 47 | -------------------------------------------------------------------------------- /lxml/tests/test_css.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | import lxml.html 4 | 5 | from lxml.tests.common_imports import doctest, HelperTestCase, skipif 6 | 7 | try: 8 | import cssselect 9 | except ImportError: 10 | cssselect = None 11 | 12 | 13 | HTML = ''' 14 |
15 | link 16 | anchor 17 |
18 | ''' 19 | 20 | 21 | class CSSTestCase(HelperTestCase): 22 | 23 | pytestmark = skipif('cssselect is None') 24 | 25 | def test_cssselect(self): 26 | div, = lxml.html.fromstring(HTML).xpath('//div') 27 | 28 | def count(selector, expected_count, **kwargs): 29 | result = div.cssselect(selector, **kwargs) 30 | self.assertEqual(len(result), expected_count) 31 | 32 | count('div', 1) 33 | count('a', 2) 34 | count('em', 0) 35 | # Element names are case-insensitive in HTML 36 | count('DIV', 1) 37 | # ... but not in XHTML or XML 38 | count('DIV', 0, translator='xhtml') 39 | count('DIV', 0, translator='xml') 40 | 41 | # :contains() is case-insensitive in lxml 42 | count(':contains("link")', 2) # div, a 43 | count(':contains("LInk")', 2) 44 | # Whatever the document language 45 | count(':contains("LInk")', 2, translator='xhtml') 46 | count(':contains("LInk")', 2, translator='xml') 47 | # ... but not in upstream cssselect 48 | import cssselect 49 | count(':contains("link")', 2, translator=cssselect.HTMLTranslator()) 50 | count(':contains("LInk")', 0, translator=cssselect.HTMLTranslator()) 51 | 52 | 53 | def test_suite(): 54 | suite = unittest.TestSuite() 55 | try: 56 | import cssselect 57 | except ImportError: 58 | # no 'cssselect' installed 59 | print("Skipping tests in lxml.cssselect - external cssselect package is not installed") 60 | return suite 61 | 62 | import lxml.cssselect 63 | suite.addTests(doctest.DocTestSuite(lxml.cssselect)) 64 | suite.addTests([unittest.makeSuite(CSSTestCase)]) 65 | return suite 66 | -------------------------------------------------------------------------------- /lxml/tests/test_doctestcompare.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import unittest 3 | 4 | from lxml import etree 5 | from lxml.tests.common_imports import HelperTestCase 6 | from lxml.doctestcompare import LXMLOutputChecker, PARSE_HTML, PARSE_XML 7 | 8 | 9 | class DummyInput: 10 | def __init__(self, **kw): 11 | for name, value in kw.items(): 12 | setattr(self, name, value) 13 | 14 | 15 | def indent(elem, level=0): 16 | i = "\n" + level*" " 17 | if len(elem): 18 | if not elem.text or not elem.text.strip(): 19 | elem.text = i + " " 20 | if not elem.tail or not elem.tail.strip(): 21 | elem.tail = i 22 | for elem in elem: 23 | indent(elem, level+1) 24 | if not elem.tail or not elem.tail.strip(): 25 | elem.tail = i 26 | else: 27 | if level and (not elem.tail or not elem.tail.strip()): 28 | elem.tail = i 29 | 30 | 31 | class DoctestCompareTest(HelperTestCase): 32 | _checker = LXMLOutputChecker() 33 | 34 | def compare(self, want, got, html=False): 35 | if html: 36 | options = PARSE_HTML 37 | else: 38 | options = PARSE_XML 39 | 40 | parse = self._checker.get_parser(want, got, options) 41 | want_doc = parse(want) 42 | got_doc = parse(got) 43 | return self._checker.collect_diff( 44 | want_doc, got_doc, html, indent=0).lstrip() 45 | 46 | def assert_diff(self, want, got, diff, html=False): 47 | self.assertEqual(self.compare(want, got, html), diff) 48 | 49 | def assert_nodiff(self, want, got, html=False): 50 | root = etree.fromstring(want) 51 | root.tail = '\n' 52 | indent(root) 53 | diff = etree.tostring( 54 | root, encoding='unicode', method=html and 'html' or 'xml') 55 | self.assert_diff(want, got, diff, html=html) 56 | 57 | def test_equal_input(self): 58 | self.assert_nodiff( 59 | '

Expected

', 60 | '

Expected

') 61 | 62 | def test_differing_tags(self): 63 | self.assert_diff( 64 | '

Expected

', 65 | 'Expected', 66 | '

Expected

\n') 67 | 68 | def test_tags_upper_lower_case(self): 69 | self.assert_diff( 70 | '

Expected

', 71 | '

Expected

', 72 | '

Expected

\n') 73 | 74 | def test_tags_upper_lower_case_html(self): 75 | self.assert_nodiff( 76 | '

Expected

', 77 | '

Expected

', 78 | html=True) 79 | 80 | def test_differing_attributes(self): 81 | self.assert_diff( 82 | '

Expected

', 83 | '

Actual

', 84 | '

Expected (got: Actual)

\n') 85 | 86 | 87 | def test_suite(): 88 | suite = unittest.TestSuite() 89 | if sys.version_info >= (2,4): 90 | suite.addTests([unittest.makeSuite(DoctestCompareTest)]) 91 | return suite 92 | 93 | 94 | if __name__ == '__main__': 95 | unittest.main() 96 | -------------------------------------------------------------------------------- /lxml/tests/test_elementpath.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | Tests for the ElementPath implementation. 5 | """ 6 | 7 | from __future__ import absolute_import 8 | 9 | import unittest 10 | from .common_imports import etree, HelperTestCase 11 | 12 | 13 | class EtreeElementPathTestCase(HelperTestCase): 14 | etree = etree 15 | from lxml import _elementpath 16 | 17 | def test_cache(self): 18 | self._elementpath._cache.clear() 19 | el = self.etree.XML(b'') 20 | self.assertFalse(self._elementpath._cache) 21 | 22 | self.assertTrue(el.findall('b/c')) 23 | self.assertEqual(1, len(self._elementpath._cache)) 24 | self.assertTrue(el.findall('b/c')) 25 | self.assertEqual(1, len(self._elementpath._cache)) 26 | self.assertFalse(el.findall('xxx')) 27 | self.assertEqual(2, len(self._elementpath._cache)) 28 | self.assertFalse(el.findall('xxx')) 29 | self.assertEqual(2, len(self._elementpath._cache)) 30 | self.assertTrue(el.findall('b/c')) 31 | self.assertEqual(2, len(self._elementpath._cache)) 32 | 33 | 34 | class ElementTreeElementPathTestCase(EtreeElementPathTestCase): 35 | import xml.etree.ElementTree as etree 36 | import xml.etree.ElementPath as _elementpath 37 | 38 | 39 | def test_suite(): 40 | suite = unittest.TestSuite() 41 | suite.addTests([unittest.makeSuite(ElementTreeElementPathTestCase)]) 42 | suite.addTests([unittest.makeSuite(EtreeElementPathTestCase)]) 43 | return suite 44 | 45 | 46 | if __name__ == '__main__': 47 | print('to test use test.py %s' % __file__) 48 | -------------------------------------------------------------------------------- /lxml/tests/test_errors.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | import unittest, doctest 3 | 4 | # These tests check that error handling in the Pyrex code is 5 | # complete. 6 | # It is likely that if there are errors, instead of failing the code 7 | # will simply crash. 8 | 9 | import sys, gc, os.path 10 | from lxml import etree 11 | 12 | this_dir = os.path.dirname(__file__) 13 | if this_dir not in sys.path: 14 | sys.path.insert(0, this_dir) # needed for Py3 15 | 16 | from common_imports import HelperTestCase 17 | 18 | class ErrorTestCase(HelperTestCase): 19 | etree = etree 20 | 21 | def test_bad_element(self): 22 | # attrib argument of Element() should be a dictionary, so if 23 | # we pass a string we should get an error. 24 | self.assertRaises(TypeError, self.etree.Element, 'a', 'b') 25 | 26 | def test_empty_parse(self): 27 | self.assertRaises(etree.XMLSyntaxError, etree.fromstring, '') 28 | 29 | def test_element_cyclic_gc_none(self): 30 | # test if cyclic reference can crash etree 31 | Element = self.etree.Element 32 | gc.collect() 33 | 34 | count = sys.getrefcount(None) 35 | 36 | l = [Element('name'), Element('name')] 37 | l.append(l) 38 | 39 | del l 40 | gc.collect() 41 | 42 | self.assertEqual(sys.getrefcount(None), count) 43 | 44 | def test_suite(): 45 | suite = unittest.TestSuite() 46 | suite.addTests([unittest.makeSuite(ErrorTestCase)]) 47 | return suite 48 | 49 | if __name__ == '__main__': 50 | print('to test use test.py %s' % __file__) 51 | -------------------------------------------------------------------------------- /lxml/tests/test_import.xsd: -------------------------------------------------------------------------------- 1 | 5 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /lxml/tests/test_inc.xsd: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /lxml/tests/test_schematron.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | """ 4 | Test cases related to Schematron parsing and validation 5 | """ 6 | 7 | import unittest, sys, os.path 8 | 9 | this_dir = os.path.dirname(__file__) 10 | if this_dir not in sys.path: 11 | sys.path.insert(0, this_dir) # needed for Py3 12 | 13 | from common_imports import etree, HelperTestCase, fileInTestDir 14 | from common_imports import doctest, make_doctest 15 | 16 | class ETreeSchematronTestCase(HelperTestCase): 17 | def test_schematron(self): 18 | tree_valid = self.parse('') 19 | tree_invalid = self.parse('') 20 | schema = self.parse('''\ 21 | 22 | 23 | 24 | BBB element is not present 25 | CCC element is not present 26 | 27 | 28 | 29 | 30 | BBB element is not present 31 | CCC element is not present 32 | There is an extra element 33 | 34 | 35 | 36 | ''') 37 | schema = etree.Schematron(schema) 38 | self.assertTrue(schema.validate(tree_valid)) 39 | self.assertFalse(schema.error_log.filter_from_errors()) 40 | 41 | self.assertFalse(schema.validate(tree_invalid)) 42 | self.assertTrue(schema.error_log.filter_from_errors()) 43 | 44 | self.assertTrue(schema.validate(tree_valid)) # repeat valid 45 | self.assertFalse(schema.error_log.filter_from_errors()) # repeat valid 46 | 47 | def test_schematron_elementtree_error(self): 48 | self.assertRaises(ValueError, etree.Schematron, etree.ElementTree()) 49 | 50 | def test_schematron_invalid_schema(self): 51 | schema = self.parse('''\ 52 | 53 | 54 | 55 | 56 | ''') 57 | self.assertRaises(etree.SchematronParseError, 58 | etree.Schematron, schema) 59 | 60 | def test_schematron_invalid_schema_empty(self): 61 | schema = self.parse('''\ 62 | 63 | ''') 64 | self.assertRaises(etree.SchematronParseError, 65 | etree.Schematron, schema) 66 | 67 | def test_schematron_invalid_schema_namespace(self): 68 | # segfault 69 | schema = self.parse('''\ 70 | 71 | ''') 72 | self.assertRaises(etree.SchematronParseError, 73 | etree.Schematron, schema) 74 | 75 | 76 | def test_suite(): 77 | suite = unittest.TestSuite() 78 | suite.addTests([unittest.makeSuite(ETreeSchematronTestCase)]) 79 | suite.addTests( 80 | [make_doctest('../../../doc/validation.txt')]) 81 | return suite 82 | 83 | if __name__ == '__main__': 84 | print('to test use test.py %s' % __file__) 85 | -------------------------------------------------------------------------------- /lxml/usedoctest.py: -------------------------------------------------------------------------------- 1 | """Doctest module for XML comparison. 2 | 3 | Usage:: 4 | 5 | >>> import lxml.usedoctest 6 | >>> # now do your XML doctests ... 7 | 8 | See `lxml.doctestcompare` 9 | """ 10 | 11 | from lxml import doctestcompare 12 | 13 | doctestcompare.temp_install(del_module=__name__) 14 | -------------------------------------------------------------------------------- /lxml/xinclude.pxi: -------------------------------------------------------------------------------- 1 | # XInclude processing 2 | 3 | from lxml.includes cimport xinclude 4 | 5 | class XIncludeError(LxmlError): 6 | u"""Error during XInclude processing. 7 | """ 8 | pass 9 | 10 | cdef class XInclude: 11 | u"""XInclude(self) 12 | XInclude processor. 13 | 14 | Create an instance and call it on an Element to run XInclude 15 | processing. 16 | """ 17 | cdef _ErrorLog _error_log 18 | def __init__(self): 19 | self._error_log = _ErrorLog() 20 | 21 | property error_log: 22 | def __get__(self): 23 | assert self._error_log is not None, "XInclude instance not initialised" 24 | return self._error_log.copy() 25 | 26 | def __call__(self, _Element node not None): 27 | u"__call__(self, node)" 28 | # We cannot pass the XML_PARSE_NOXINCNODE option as this would free 29 | # the XInclude nodes - there may still be Python references to them! 30 | # Therefore, we allow XInclude nodes to be converted to 31 | # XML_XINCLUDE_START nodes. XML_XINCLUDE_END nodes are added as 32 | # siblings. Tree traversal will simply ignore them as they are not 33 | # typed as elements. The included fragment is added between the two, 34 | # i.e. as a sibling, which does not conflict with traversal. 35 | cdef int result 36 | _assertValidNode(node) 37 | assert self._error_log is not None, "XInclude processor not initialised" 38 | if node._doc._parser is not None: 39 | parse_options = node._doc._parser._parse_options 40 | context = node._doc._parser._getParserContext() 41 | c_context = context 42 | else: 43 | parse_options = 0 44 | context = None 45 | c_context = NULL 46 | 47 | self._error_log.connect() 48 | if tree.LIBXML_VERSION < 20704 or not c_context: 49 | __GLOBAL_PARSER_CONTEXT.pushImpliedContext(context) 50 | with nogil: 51 | if c_context: 52 | result = xinclude.xmlXIncludeProcessTreeFlagsData( 53 | node._c_node, parse_options, c_context) 54 | else: 55 | result = xinclude.xmlXIncludeProcessTree(node._c_node) 56 | if tree.LIBXML_VERSION < 20704 or not c_context: 57 | __GLOBAL_PARSER_CONTEXT.popImpliedContext() 58 | self._error_log.disconnect() 59 | 60 | if result == -1: 61 | raise XIncludeError( 62 | self._error_log._buildExceptionMessage( 63 | u"XInclude processing failed"), 64 | self._error_log) 65 | -------------------------------------------------------------------------------- /post-process/GamezServerPostProcess.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import urllib 3 | import urllib2 4 | import re 5 | try: 6 | nzbName = sys.argv[3] 7 | regMatch = re.search(r"\[([A-Za-z0-9_]+)\]", nzbName) 8 | gameId = regMatch.group(1) 9 | if(gameId == None): 10 | print('Unable to parse game ID') 11 | sys.exit(1) 12 | sourceFolder = sys.argv[1] 13 | webRequest = urllib2.Request('http://127.0.0.1:8085/PostProcess?gameId=' + str(gameId) + '&processDir=' + urllib.quote_plus(sourceFolder), headers={'User-Agent' : "GamezServer"}) 14 | response = urllib2.urlopen(webRequest) 15 | responseData = response.read() 16 | print(responseData) 17 | except Exception,e: 18 | print("Unable to post process: " + str(e)) 19 | sys.exit(1) --------------------------------------------------------------------------------