On a previous post we've talked abut our new REST API and the benefits it provides to our power users. If that was not enough for your satisfaction, we are releasing REST Clients for Python and Ruby to help you use our service without having worry about anything.
| import json | |
| import requests | |
| from oauth_hook import OAuthHook | |
| class NetDNAOAuthHook(OAuthHook): | |
| def __init__(self, consumer_key, consumer_secret, token=None, | |
| token_secret=None, header_auth=True, **kwargs): |
| from unittest import TestCase, main | |
| from netdnarws import NetDNA | |
| class SomeDescritptiveTestName(TestCase): | |
| def setUp(self): | |
| self.api = NetDNA("alias", | |
| "xxx", | |
| "xxx", | |
| "lrws.netdna.com", |
| ex_or = 0 | |
| while True: | |
| num=raw_input('Ingrese el numero 1: ') | |
| num2=raw_input('Ingrese el segundo numero 2: ') | |
| if len(num) == len(num2): | |
| for indice, letra in enumerate(num): | |
| if letra == num2[indice]: |
| from netdnarws import NetDNA | |
| from funkload.FunkLoadTestCase import FunkLoadTestCase | |
| from unittest import main | |
| from test_data import test_data | |
| class BenchmarkTest(FunkLoadTestCase): | |
| def setUp(self): | |
| self.api = NetDNA("cdnintegration", |
On a previous post we've talked abut our new REST API and the benefits it provides to our power users. If that was not enough for your satisfaction, we are releasing REST Clients for Python and Ruby to help you use our service without having to worry about anything.
| <?php | |
| require_once('NetDNA.php'); | |
| $api = new NetDNA("my_alias", "0de95ee2fa4138252c1e431c177ac14904feb56f7", "9553c35f1656f51a0e8940baff71414f"); | |
| $api->post('/zones/pull.json', array('name' => 'my_pullzone', 'url' => 'pull.mydomain.com')); | |
| ?> |
| class Jugador(object): | |
| def __init__(self, nombre, sexo): | |
| self.nombre = nombre | |
| self.sexo = sexo | |
| if __name__ == '__main__': | |
| jugadores = [] | |
| cantidad_jugadores = int(raw_input('Ingrese la cantidad de jugadores: ')) | |
| for x in xrange(cantidad_jugadores): |
Have you ever had problems with %20 vs + spacing encoding when using external HTTP APIs?
We've faced this problem, multiple times. Our own REST API faced this problem. But don't be afraid, there's a reason for it, and there are plenty of solutions out there.
So, what is RFC 3986?
RFC 3986 is the URI (Unified Resource Identifier) Syntax document, in this document you can find with very profound detail everything you will ever want to know about how URIs should be written and how they should be read.
In the last couple of years, modern web browsers have been pushing towards more compact URI schemes. So every modern web browser encodes spaces as + instead of %20, while every other character is still encoded using Percent Encoding.
| require 'netdnarws' | |
| api = NetDNARWS::NetDNA.new("alias", "key", "secret") | |
| certData = File.read('/path/to/ssl/demo.crt') | |
| certKeyData = File.read('/path/to/ssl/demo.key') | |
| api.post("/zones/pull/{zoneid}/ssl.json", {'ssl_crt' => certData,'ssl_key' => certKeyData}) |