^data:((?:\w+\/(?:(?!;).)+)?)((?:;[\w\W]*?[^;])*),(.+)$test this pattern on regexr: https://regexr.com/4inht
regex pattern to match RFC 2397 data URL
| import importlib | |
| import os | |
| __pkg_path = os.path.join( | |
| os.path.dirname(os.path.dirname(os.path.dirname(__file__))), | |
| 'Packages', | |
| 'Package Control', | |
| 'package_control' | |
| ) | |
| __file_path = os.path.join(__pkg_path, '__init__.py') |
^data:((?:\w+\/(?:(?!;).)+)?)((?:;[\w\W]*?[^;])*),(.+)$test this pattern on regexr: https://regexr.com/4inht
regex pattern to match RFC 2397 data URL
| #!/usr/bin/env python | |
| ''' | |
| Simple and functional REST server for Python (3.5) using no dependencies beyond the Python standard library. | |
| Ported from original lib for Python 2.7 by Liron (tliron @ github.com) https://gist.github.com/tliron/8e9757180506f25e46d9 | |
| Features: | |
| * Map URI patterns using regular expressions | |
| * Map any/all the HTTP VERBS (GET, PUT, DELETE, POST) | |
| * All responses and payloads are converted to/from JSON for you | |
| * Easily serve static files: a URI can be mapped to a file, in which case just GET is supported |
| #!/usr/bin/env python | |
| # coding=utf-8 | |
| # License: Public domain (CC0) | |
| # Isaac Turner 2016/12/05 | |
| from __future__ import print_function | |
| import difflib | |
| import re |
| #!/usr/bin/env python | |
| ''' | |
| Simple and functional REST server for Python (2.7) using no dependencies beyond the Python standard library. | |
| Features: | |
| * Map URI patterns using regular expressions | |
| * Map any/all the HTTP VERBS (GET, PUT, DELETE, POST) | |
| * All responses and payloads are converted to/from JSON for you |
| #!/usr/bin/env python3 | |
| """Simple HTTP Server With Upload. | |
| This module builds on BaseHTTPServer by implementing the standard GET | |
| and HEAD requests in a fairly straightforward manner. | |
| see: https://gist.github.com/UniIsland/3346170 | |
| """ | |
A minimal HTTP server in python. It sends a JSON Hello World for GET requests, and echoes back JSON for POST requests.
python server.py 8009
Starting httpd on port 8009...
curl http://localhost:8009
{"received": "ok", "hello": "world"}
| // MIT License - Copyright (c) 2016 Can Güney Aksakalli | |
| // https://aksakalli.github.io/2014/02/24/simple-http-server-with-csparp.html | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Text; | |
| using System.Net.Sockets; | |
| using System.Net; | |
| using System.IO; |