Created
October 25, 2013 22:48
-
-
Save ruescasd/7162992 to your computer and use it in GitHub Desktop.
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 requests | |
import json | |
url = 'https://127.0.0.1:5000/public_api/election' | |
data = { | |
'session_id': 'vota1', | |
'is_recurring': False, | |
'callback_url': 'https://ec2-54-229-221-33.eu-west-1.compute.amazonaws.com:5000/public_api/receive_election', | |
'extra': [], | |
'title': 'New Directive Board', | |
'url': 'https://example.com/election/url', | |
'description': 'election description', | |
'question_data': { | |
'question': 'Who Should be President?', | |
'tally_type': 'ONE_CHOICE', | |
'answers': ['Alice', 'Bob'], | |
'max': 1, 'min': 0 | |
}, | |
'voting_start_date': '2013-12-06T18:17:14.457000', | |
'voting_end_date': '2013-12-09T18:17:14.457000', | |
'authorities': [ | |
{ | |
'name': 'Auth1', | |
'orchestra_url': 'https://ec2-54-229-221-33.eu-west-1.compute.amazonaws.com:5000/api/queues', | |
'ssl_cert': """-----BEGIN CERTIFICATE----- | |
MIIGLzCCBBegAwIBAgIJAL3xYBS0Jh+sMA0GCSqGSIb3DQEBBQUAMIGtMQswCQYD | |
VQQGEwJFUzEPMA0GA1UECAwGTWFkcmlkMQ8wDQYDVQQHDAZNYWRyaWQxFDASBgNV | |
BAoMC0Fnb3Jhdm90aW5nMR0wGwYDVQQLDBRDb25ncmVzb1RyYW5zcGFyZW50ZTEZ | |
MBcGA1UEAwwQaXAtMTcyLTMxLTI5LTIwMzEsMCoGCSqGSIb3DQEJARYdaW5mb0Bj | |
b25ncmVzb3RyYW5zcGFyZW50ZS5jb20wHhcNMTMxMDI1MDAzODQ5WhcNMTQxMDI1 | |
MDAzODQ5WjCBrTELMAkGA1UEBhMCRVMxDzANBgNVBAgMBk1hZHJpZDEPMA0GA1UE | |
BwwGTWFkcmlkMRQwEgYDVQQKDAtBZ29yYXZvdGluZzEdMBsGA1UECwwUQ29uZ3Jl | |
c29Ucm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QJII62EGHMUMXz7JV8a1g/rr6hL3WF4FvN+5buckvGmqzGjiEQOxM7i2C8DAPj | |
D6GdwfLwqaHLQZurLBFglNPw8F8LFhNAx8GLetSdmHM2PmC4ED92+WXzX/W7kNvU | |
XS5f/i9eEXSqnPYArXw+1lO+0LWXNkhHBmU+TE6BrigzdNH789Cm++HvLkjhqGVc | |
x7QtDpeNtrKcLWdAU7MUoaV4EOQZpyr2JSKbQ9HZyyj9WismgSpq9jsmwCMX8yh/ | |
bcenLEYNCnL//g9vwutMnSqV0cW7ZEcE2bFPgFkXrc80EPZI1HLD9Kf1TowCwlG0 | |
t8+T8kuKCzVhlX4xhu2qhlJ82b7do9m7DhS8U643MbLbrCpM5YkQx5Biy0JypaRb | |
819Q5Qveaa2ReMzHojrb9nQY/zopuHbtuHXCDG9sIqwrMbe/Gk32DgLUdaDhLqHZ | |
QqIu0ds5mfGYgO1ZhTLy0it22jhBe8/3ELAHGVIBoQt3x3mZICSjEABzFV2zyEbk | |
5B444TxFROljbwg5ZPHVNHZP/Jt16ShqgWdjxIOJpX/Bu6pXnZrZWMLthLJSY7To | |
025aYpkqEZgqnH0CG59xa0yvoAKnLimfJF++4ANW3iJZiuuyBTvaZ4bCSzS3aQAX | |
BY4a | |
-----END CERTIFICATE-----""" | |
}, | |
{ | |
'name': 'Auth2', | |
'orchestra_url': 'https://ec2-54-246-135-190.eu-west-1.compute.amazonaws.com:5000/api/queues', | |
'ssl_cert': """-----BEGIN CERTIFICATE----- | |
MIIGLzCCBBegAwIBAgIJAPZK68sVdYmxMA0GCSqGSIb3DQEBBQUAMIGtMQswCQYD | |
VQQGEwJFUzEPMA0GA1UECAwGTWFkcmlkMQ8wDQYDVQQHDAZNYWRyaWQxFDASBgNV | |
BAoMC0Fnb3Jhdm90aW5nMR0wGwYDVQQLDBRDb25ncmVzb1RyYW5zcGFyZW50ZTEZ | |
MBcGA1UEAwwQaXAtMTcyLTMxLTI1LTIwOTEsMCoGCSqGSIb3DQEJARYdaW5m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9rWPBNyv | |
h7LkD+GY2o0CAwEAAaNQME4wHQYDVR0OBBYEFD7uBStZGJvGGzIGEQrAU+oz9bHP | |
MB8GA1UdIwQYMBaAFD7uBStZGJvGGzIGEQrAU+oz9bHPMAwGA1UdEwQFMAMBAf8w | |
DQYJKoZIhvcNAQEFBQADggIBAJtOQ7mrUiNkXvChM1QQhrYm24JF0D/C2DeKvmav | |
gic2Ji2LwmYqDn1IuwdcOzXuNRHIGEDTcFphjog+SFg+gmklXv3d3JuI1Wqc93bD | |
gRUzlWIdk03cr3cU0gFFyZekjDFhXryugPiCuZs2XhsgDLGOEBPLe0iwUz6XbD+s | |
W8hV23KLTGWYPTZeuoqYj+wNXPVjx3g88NJJMxKUDgI+TJHUH3/Jxzu3nFMz2d7f | |
m7q15GyuwcdFk+hJOh9acA31RttwJte8yXNjcbVnsmgCtrj3pXw53YOIh1TAWsnA | |
F/fqOv91eAakMHZ6wNqVKZcfqsO/2ee3BlchdInSVGXO8ZqtF9JJ+Jln6NsxIta6 | |
itmOJZ5hpzJLbW7/+Dxunq/AewzxOgAudoRo+l+GwttpBIq6yizPEBRbwX80Bkqq | |
yX0mDqK4Q2oFvr9jgUwWmI/m1eyiE+u7+4u3jv2fs7e1SW8rzAAZaILAzgV/m/CE | |
4rvDJoihDTUIitUb9Zz0PznkND8rE5O38n9VZ/SR/zqfwAW4C8tm+LOo2KZp9CXl | |
7SZ0bgiwIZ39RtYTAO5lgN2klXb+FCGzjHk1dVz9AjdqUXv7ELd+fJWjdyqUCdDg | |
ryOTiLbuvylkw1ygnHIVD2TxO71HT6apAKbSGo5nDsq7Ua3tdPk/HRSwTwvWIteS | |
3IzB | |
-----END CERTIFICATE-----""" | |
}, | |
{ | |
'name': 'Auth3', | |
'orchestra_url': 'https://agora.hackandalus.net:5000/api/queues', | |
'ssl_cert': """-----BEGIN CERTIFICATE----- | |
MIIGGTCCBAGgAwIBAgIJAI4CcGb4uR1OMA0GCSqGSIb3DQEBBQUAMIGiMQswCQYD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Yq+FwyxrI | |
QiCkRDsPLkjNmORwoQaKFv1qKjAu2hcoBeLDVjiUL4JYJtOESeBb1Nzd87mogYcX | |
Gvhj4KI7FZyJKoj7lQVzfpQVNQLNkfyA+krlcbQ9qJGA/Jdk6unVLqLdX6jK4Jvi | |
s3kFG83gksVSZAYWnxg5z3ynlH8Cwg0ggyWFelk0DG834wIDAQABo1AwTjAdBgNV | |
HQ4EFgQU/ZHMDHpPx2zng0N3lQOveIg5WqowHwYDVR0jBBgwFoAU/ZHMDHpPx2zn | |
g0N3lQOveIg5WqowDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAgEAuTQ9 | |
Oy85Of7akY3cRSNfrYmLgWfoXXp9QrFvWlS64qUTeixT0gch8q1sFgESfE6tS0ki | |
p1J+4bzs3A11vejpODEQsfNeLnZZfC5/0dQJqLKAJO6Bz1chyEHm4yC5BSyXit5o | |
N/eDVElpzzz9g2Y9xdFYCZH5Ov/1RV99MmeXXtC2ehKhEtH52tbKsH7GJnWYjMEN | |
Q3GmULiZrk82NKOf6KdARahf7UyISFbPTjTeiRgNocNOCm02YlGyXJXy6owh5ahC | |
Gqau3I7whr84eNvGqlQn1+fxp4IrifSbu1r9m4Iw2puQaffAZj+/Sru9r3PywdPu | |
FqQnIwDZzIM82iazqEUSnT/1oSbB/15jkEN3NhQdSUGb7tROipUikHhypV+27jZy | |
xrVA9guWTCjgfPNONvmRl787RmY1FV+9zOx42hsIVF5jrs7GRBvlRzsXykGAAu4j | |
oluTlX5uckIdziwn6PwQMaE09Ts0iorrLHzRgGaWQk7QkPV2Kavzedb4BKCHA3mB | |
uf9/1Me3ikximQL7XffheJS8XWVFWgC8f2DKlTes/eoA8cPj8rmm+xUCbPZGpQCX | |
PR3s/W2/5VFqIAwNA7iX4ComRWJe0YIXYR7elBfII2Uy2sirp9gwyT8GDroAyEL7 | |
X2vypd41uY7TP5JCZ/06y38GUhLtpahWV4iO3d0= | |
-----END CERTIFICATE-----""" | |
} | |
] | |
} | |
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'} | |
print(json.dumps(data)) | |
r = requests.post(url, data=json.dumps(data), headers=headers, verify=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment