Skip to content

Instantly share code, notes, and snippets.

View VerizonMediaOwner's full-sized avatar

Verizon Media VerizonMediaOwner

View GitHub Profile
@VerizonMediaOwner
VerizonMediaOwner / weather_ydn_sample.java
Last active August 26, 2019 12:02
Yahoo Weather API Java Example
// Copyright 2019 Oath Inc. Licensed under the terms of the zLib license see https://opensource.org/licenses/Zlib for terms.
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.util.List;
import java.util.ArrayList;
import java.util.Date;
import java.util.Base64;
import java.util.Base64.Encoder;
import java.util.Random;
@VerizonMediaOwner
VerizonMediaOwner / weather_ydn_sample.php
Last active September 19, 2020 10:27
Yahoo Weather API PHP Example
<?php
// Copyright 2019 Oath Inc. Licensed under the terms of the zLib license see https://opensource.org/licenses/Zlib for terms.
function buildBaseString($baseURI, $method, $params) {
$r = array();
ksort($params);
foreach($params as $key => $value) {
$r[] = "$key=" . rawurlencode($value);
}
return $method . "&" . rawurlencode($baseURI) . '&' . rawurlencode(implode('&', $r));
@VerizonMediaOwner
VerizonMediaOwner / weather_ydn_rss.xml
Created January 10, 2019 20:41
Yahoo Weather API XML Response Example
<rss xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0" version="2.0">
<channel>
<yweather:units distance="km" pressure="mbar" speed="km/h" temperature="C" />
<title>Yahoo! Weather - Sunnyvale, CA, US</title>
<link>http://us.rd.yahoo.com/dailynews/rss/weather/Country__Country/*https://weather.yahoo.com/country/state/city-2502265/</link>
<description>Yahoo! Weather for Sunnyvale, CA, US</description>
<language>en-us</language>
<lastBuildDate>Wed, 09 Jan 2019 12:32 PM PST</lastBuildDate>
<ttl>60</ttl>
<yweather:location city="Sunnyvale" country="United States" region=" CA" />
@VerizonMediaOwner
VerizonMediaOwner / weather_ydn_js.json
Last active April 19, 2020 12:38
Yahoo Weather API JSON Response Example
{
"location":{
"woeid": 2502265,
"city":"Sunnyvale",
"region":" CA",
"country":"United States",
"lat":37.371609,
"long":-122.038254,
"timezone_id":"America/Los_Angeles"
},
@VerizonMediaOwner
VerizonMediaOwner / weather_ydn_sample.js
Last active May 12, 2019 12:00
Yahoo Weather API JavaScript Example
// Require node-oauth package: npm install oauth
// Copyright 2019 Oath Inc. Licensed under the terms of the zLib license see https://opensource.org/licenses/Zlib for terms.
var OAuth = require('oauth');
var header = {
"X-Yahoo-App-Id": "your-app-id"
};
var request = new OAuth.OAuth(
null,
null,
@VerizonMediaOwner
VerizonMediaOwner / ViewController.swift
Last active March 4, 2019 22:52
Weather API Swift Example
//
// ViewController.swift
// Weather API Sample Code
//
// Copyright 2019 Oath Inc. Licensed under the terms of the zLib license see https://opensource.org/licenses/Zlib for terms.
//
import UIKit
/*
@VerizonMediaOwner
VerizonMediaOwner / ViewController.m
Last active October 16, 2019 07:29
Yahoo Weather API Objective-C Example
//
// ViewController.m
// weather-api-demo-objc
//
// Copyright 2019 Oath Inc. Licensed under the terms of the zLib license see https://opensource.org/licenses/Zlib for terms.
//
#import "ViewController.h"
#import "YahooWeatherAPI.h"
@VerizonMediaOwner
VerizonMediaOwner / ExampleRequest.java
Last active March 4, 2019 22:53
Yahoo Weather API Android Example
// Copyright 2019 Oath Inc. Licensed under the terms of the zLib license see https://opensource.org/licenses/Zlib for terms.
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Response;
import com.android.volley.toolbox.HttpHeaderParser;
import com.android.volley.toolbox.JsonRequest;
import com.google.gson.JsonSyntaxException;
@VerizonMediaOwner
VerizonMediaOwner / YWSample.cs
Last active March 6, 2022 20:39
Yahoo Weather API C# Example
// Yahoo Weather API C# Sample Code
// Code sample offered under the terms of the CC0 Public Domain designation. See https://creativecommons.org/publicdomain/zero/1.0/legalcode/ for terms.
// Author: Eugene Plotnikov
using System;
using System.Net;
using System.Security.Cryptography;
using System.Text;
@VerizonMediaOwner
VerizonMediaOwner / weather_ydn_sample.py
Last active September 19, 2020 12:02
Yahoo Weather API Python Sample.
"""
Weather API Python sample code
Copyright 2019 Oath Inc. Licensed under the terms of the zLib license see https://opensource.org/licenses/Zlib for terms.
$ python --version
Python 2.7.10
"""
import time, uuid, urllib, urllib2