add example script on how to use python-inema

This commit is contained in:
Harald Welte 2016-07-24 12:37:29 +02:00
parent 3a643f54b5
commit d679cc1d3d
1 changed files with 30 additions and 0 deletions

30
examples/example.py Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/python
import logging
from inema import Internetmarke
# you have to fill the below with your 1C4A API access details
PARTNER_ID = "XXXXX"
KEY = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
KEY_PHASE = "1"
# you have to fill the below with your login details for the PORTOKASSE
# payment system
USER = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
PASS = "XXXXXXXXXXX"
logging.basicConfig(level=logging.INFO)
im = Internetmarke(PARTNER_ID, KEY, KEY_PHASE)
im.authenticate(USER, PASS)
sysmo_addr = im.build_addr('Alt-Moabit','93','10559','Berlin','DEU')
sysmo_naddr = im.build_comp_addr('sysmocom - s.f.m.c. GmbH', sysmo_addr)
dest_addr = im.build_addr('Glanzstrasse','11','12437','Berlin','DEU')
dest_naddr = im.build_pers_addr('Harald', 'Welte', dest_addr)
position = im.build_position(1017, sysmo_naddr, dest_naddr)
im.add_position(position)
r = im.checkoutPNG()