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 os | |
| from flask import Flask, request, redirect, url_for | |
| from werkzeug import secure_filename | |
| UPLOAD_FOLDER = '/tmp' | |
| app = Flask(__name__) | |
| app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER | |
| @app.route("/upload", methods=['POST']) |
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 "Weather.h" // Let's import the API client implementation | |
| @interface sample : NSObject | |
| + (void) doSomething; | |
| @end | |
| @implementation sample | |
| + (void) doSomething { |
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 "Weather.h" | |
| @interface sample : NSObject <MashapeDelegate> | |
| - (void) doSomething; | |
| @end |
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 "sample.h" | |
| @implementation sample | |
| -(void)requestCompleted:(MashapeResponse*) response { | |
| // The MashapeResponse has the following properties that you can use | |
| NSLog(@"The HTTP status code is %d", [response code]); | |
| NSLog(@"The HTTP headers are %@", [response headers]); | |
| NSLog(@"The HTTP parsed body is %@", [response body]); | |
| NSLog(@"The HTTP raw body is %@", [response rawBody]); |
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
| // The parsed response body is a NSArray of NSDictionary | |
| NSLog(@"%@", [[[response body] objectAtIndex:0] objectForKey:@"condition"]); |
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
| // Initialize the client object with your Mashape public and private keys. | |
| Weather weatherClient = new Weather("YOUR-MASHAPE-KEY"); | |
| // Invoke the method and get back the MashapeResponse object | |
| MashapeResponse<JSONArray> response = weatherClient.getForecasts("San Francisco"); | |
| // The MashapeResponse has the following properties that you can use | |
| int code = response.getCode(); // The HTTP status code | |
| Map<String, String> headers = response.getHeaders(); // The HTTP response headers | |
| JSONArray body = response.getBody(); // The parsed 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
| // Initialize the client object with your Mashape public and private keys. | |
| Weather weatherClient = new Weather("YOUR-MASHAPE-KEY"); | |
| Thread thread = weatherClient.getForecasts("San Francisco", new MashapeCallback<JSONArray>() { | |
| public void requestCompleted(MashapeResponse<JSONArray> response) { | |
| // The MashapeResponse has the following properties that you can use | |
| int code = response.getCode(); // The HTTP status code | |
| Map<String, String> headers = response.getHeaders(); // The HTTP response headers |
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
| System.out.println(response.getBody().getJSONObject(0).getString("condition")); |
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
| require File.join(File.dirname(__FILE__), "Weather.rb") # Let's import the API client implementation | |
| # Initialize the client object with your Mashape public and private keys. | |
| obj = Weather.new("YOUR-MASHAPE-KEY") | |
| # Invoke the method and get back the response object | |
| response = obj.getForecasts("San Francisco") | |
| # The response object has the following properties that you can use | |
| puts response.code # The HTTP Status code |
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
| require File.join(File.dirname(__FILE__), "Weather.rb") # Let's import the API client implementation | |
| # Initialize the client object with your Mashape public and private keys. | |
| obj = Weather.new("YOUR-MASHAPE-KEY") | |
| # Invoke the method and get back the response object | |
| thread = obj.getForecasts("San Francisco") { |response| | |
| # The response object has the following properties that you can use | |
| puts response.code # The HTTP Status code |