Demo entry 4128857

test

   

Submitted by anonymous on Mar 22, 2016 at 13:41
Language: Python. Code size: 1.0 kB.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests

url = 'http://parknet.recognize.ru/api/v1/recognize'
token = 'your_token'
filename = 'your.jpg'

img = open(filename, "rb")
files = {'image': img.read()}
payload = {'token': token}
response = requests.post(url, files=files, data=payload)
if response.status_code == 200:
    result = response.json()
    if result['status'] == 0:
        print 'Plates found: %d' % result['count']
        for plate in result['plates']:
            print '\tplate: %s %s at (%d,%d) (%d,%d) size %d' % (
                plate['plate'],
                plate['country'],
                plate['rect']['top'],
                plate['rect']['left'],
                plate['rect']['bottom'],
                plate['rect']['right'],
                plate['typesize'])
        print "\nRaw result: %s" % result
    else:
        if result['code'] == 1:
            print 'Bad auth token'
else:
    print 'Http code: %d' % response.status_code

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).