This file contains hidden or 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 com.sun.jersey.api.client.Client; | |
| import com.sun.jersey.api.client.ClientResponse; | |
| import com.sun.jersey.api.client.WebResource; | |
| import com.sun.jersey.api.client.config.ClientConfig; | |
| import com.sun.jersey.api.client.config.DefaultClientConfig; | |
| import com.sun.jersey.api.json.JSONConfiguration; | |
| import org.codehaus.jackson.annotate.JsonCreator; | |
| import org.codehaus.jackson.annotate.JsonIgnoreProperties; | |
| import org.codehaus.jackson.annotate.JsonProperty; |
This file contains hidden or 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 org.apache.http.HttpResponse; | |
| import org.apache.http.client.methods.HttpGet; | |
| import org.apache.http.impl.client.CloseableHttpClient; | |
| import org.apache.http.impl.client.HttpClientBuilder; | |
| import org.json.JSONArray; | |
| import java.io.BufferedReader; | |
| import java.io.IOException; | |
| import java.io.InputStreamReader; |
This file contains hidden or 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
| const https = require('https'); | |
| const opts = { | |
| protocol: 'https:', | |
| host: 'api.github.com', | |
| path: '/repos/twilio/twilio-node/contributors', | |
| headers: {'user-agent': 'My App'} | |
| }; | |
| https.get(opts, (res) => { |
This file contains hidden or 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
| // install the dependency > npm install request | |
| const request = require('request'); | |
| const opts = { | |
| uri: 'https://api.github.com/repos/twilio/twilio-node/contributors', | |
| headers: {'user-agent': 'My App'} | |
| }; | |
| request(opts, (error, response, body) => { |
This file contains hidden or 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
| // Remember to install the dependency> npm install unirest | |
| const unirest = require('unirest'); | |
| unirest.get('https://api.github.com/repos/twilio/twilio-node/contributors') | |
| .headers({'user-agent': 'My App'}) | |
| .end((response) => { | |
| console.log(response.body); | |
| }); |
This file contains hidden or 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 http.client | |
| conn = http.client.HTTPSConnection("api.github.com") | |
| conn.request(method="GET", url="/repos/twilio/twilio-python/contributors", | |
| headers={'user-agent': 'My App'}) | |
| r1 = conn.getresponse() | |
| data1 = r1.read() | |
| print(data1) | |
| conn.close() |
This file contains hidden or 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
| # Remember to add the dependency > pip install unirest | |
| from tornado.httpclient import HTTPClient | |
| from tornado.httpclient import AsyncHTTPClient | |
| import tornado.ioloop | |
| url = 'https://api.github.com/repos/twilio/twilio-node/contributors' | |
| headers = {'user-agent': 'my app'} | |
| # Synchronous | |
| http_client = HTTPClient() |
This file contains hidden or 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 urllib.request | |
| url = 'https://api.github.com/repos/twilio/twilio-python/contributors' | |
| response = urllib.request.urlopen(url).read() | |
| print(response) |
This file contains hidden or 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
| # remember to add the dependency > pip install requests | |
| import requests | |
| url = 'https://api.github.com/repos/twilio/twilio-python/contributors' | |
| print(requests.get(url).json()) |
This file contains hidden or 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
| <?php | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_HTTPHEADER, array("user-agent: my app")); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
| curl_setopt($ch, CURLOPT_URL, "https://api.github.com/repos/twilio/twilio-php/contributors"); | |
| $result = curl_exec($ch); | |
| curl_close($ch); |