Giter VIP home page Giter VIP logo

py3amf's Introduction

Py3AMF

Py3AMF is fork of PyAMF to support Python3

Why Py3AMF

By states of issues and PR in PyAMF, it dosen't seems to be under developing. And another PR that supports Py3 has been discontinued for over two years. This is the only Python AMF Project which trying to support Py3 under developing on GitHub.

State

Pass setup.py test But, adapters were not tested

Warning

This project isn't completed. If you want to make it fast, please send PR.

Install

This was tested on Ubuntu 16.04.2 and macOS 10.12.4

To install, you can use pip3 on your environment.

pip3 install Py3AMF

Or, you can use setup.py to develop.

git clone [email protected]:StdCarrot/Py3AMF.git
cd Py3AMF
# python3 setup.py test
python3 setup.py install

Simple example

Everything is same with PyAMF, but you have to concern str and bytes types.

import pyamf
from pyamf import remoting
from pyamf.flex import messaging
import uuid
import requests

msg = messaging.RemotingMessage(operation='retrieveUser', 
                                destination='so.stdc.flexact.common.User',
                                messageId=str(uuid.uuid4()).upper(),
                                body=['user_id'])
req = remoting.Request(target='UserService', body=[msg])
ev = remoting.Envelope(pyamf.AMF3)        
ev['/0'] = req

# Encode request 
bin_msg = remoting.encode(ev)

# Send request; You can use other channels like RTMP
resp = requests.post('http://example.com/amf', 
                     data=bin_msg.getvalue(), 
                     headers={'Content-Type': 'application/x-amf'})

# Decode response
resp_msg = remoting.decode(resp.content)
print(resp_msg.bodies)

TODO

  • Check adapters

PyAMF provides Action Message Format (AMF) support for Python that is compatible with the Adobe Flash Player. It includes integration with Python web frameworks like Django, Pylons, Twisted, SQLAlchemy, web2py and more.

The Adobe Integrated Runtime and Adobe Flash Player use AMF to communicate between an application and a remote server. AMF encodes remote procedure calls (RPC) into a compact binary representation that can be transferred over HTTP/HTTPS or the RTMP/RTMPS protocol. Objects and data values are serialized into this binary format, which increases performance, allowing applications to load data up to 10 times faster than with text-based formats such as XML or SOAP.

AMF3, the default serialization for ActionScript 3.0, provides various advantages over AMF0, which is used for ActionScript 1.0 and 2.0. AMF3 sends data over the network more efficiently than AMF0. AMF3 supports sending int and uint objects as integers and supports data types that are available only in ActionScript 3.0, such as ByteArray, ArrayCollection, ObjectProxy and IExternalizable.

py3amf's People

Contributors

njoyce avatar thijstriemstra avatar mmiko avatar elmordo avatar arnar avatar stdcarrot avatar feisley avatar frewsxcv avatar imdagger avatar m-src avatar paulopaixaoamaral avatar tml avatar romankharin avatar mexicarne avatar wasw100 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.