This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This example requires Spyne 2.12.2 or higher. | |
# Download from: https://github.com/arskom/spyne/releases/tag/spyne-2.12.2-beta | |
# This example throws a validation error. Remove double quotes | |
# around "567" to make it work. | |
data = b""" | |
{ | |
"data" : { | |
"key_1" : [123, "567"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1000000 loops, best of 3: 0.237 usec per loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "sqla_mixin.py", line 45, in <module> | |
DeclarativeBase.metadata.create_all(engine) | |
File "/home/plq/src/sqlalchemy/lib/sqlalchemy/schema.py", line 2415, in create_all | |
tables=tables) | |
File "/home/plq/src/sqlalchemy/lib/sqlalchemy/engine/base.py", line 2178, in _run_visitor | |
conn._run_visitor(visitorcallable, element, **kwargs) | |
File "/home/plq/src/sqlalchemy/lib/sqlalchemy/engine/base.py", line 1857, in _run_visitor | |
**kwargs).traverse_single(element) | |
File "/home/plq/src/sqlalchemy/lib/sqlalchemy/sql/visitors.py", line 86, in traverse_single |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python -tt | |
# | |
# Migration script from dbmail 2.2.x message store to a maildir message store | |
# with dovecot extensions. | |
# | |
# Tested with dbmail-2.2.17 -> dovecot-2.0.13 on postgresql-9.0.4 | |
# and sqlalchemy-0.7.1. | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is not yet included in main rpclib distribution because | |
# it does a lot of unnecessary copying. However, it's reportedly | |
# working fine, so if you're not caring that much about performance | |
# you can use this. | |
from rpclib.server.wsgi import WsgiApplication | |
from cStringIO import StringIO | |
from django.http import HttpResponse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pytz | |
import email.utils | |
import time | |
from datetime import datetime | |
a = datetime.now(pytz.utc) | |
print email.utils.formatdate(time.mktime(a.timetuple())) | |
print email.utils.formatdate(time.mktime(a.utctimetuple()) - time.timezone + 1e-6 * a.microsecond) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
to get this example running: | |
1) mysql -u root -p < localhost.sql | |
2) edit connection string in main_server.py | |
3) run main_server.py | |
4) run ws_client.py, witness infinite recursion | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from lxml import etree | |
from rpclib.model.primitive import AnyXml | |
from rpclib.model.complex import ComplexModel | |
from rpclib.const import xml_ns as ns | |
from rpclib.util.xml import get_schema_documents | |
class SomeType(ComplexModel): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<wsdl:definitions | |
xmlns="http://schemas.xmlsoap.org/wsdl/" | |
xmlns:calc="http://www.example.com/wsdl/calc/v1.0" | |
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" | |
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" | |
xmlns:xsd="http://www.w3.org/2001/XMLSchema" | |
targetNamespace="http://www.example.com/wsdl/calc/v1.0" | |
name="CalcWebService"> | |
<wsdl:types> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from suds.client import Client | |
client = Client("http://localhost:9753/?wsdl") | |
print client.service.TestService("x") |