Skip to content

Commit

Permalink
Added some files
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Jun 2, 2015
0 parents commit 25f82a4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
hive_cookies.txt
26 changes: 26 additions & 0 deletions gettemp
@@ -0,0 +1,26 @@
#!/usr/bin/perl

use strict;
use warnings;
use 5.010;

use LWP::Simple;
use HTTP::Cookies;
use HTTP::Request::Common;

my $base_url = 'https://api.hivehome.com/v5/';

my ($user, $pass) = @ARGV;

my $ua = LWP::UserAgent->new;
$ua->cookie_jar(HTTP::Cookies->new(
file => 'hive_cookies.txt',
autosave => 1,
));

my $req = POST "$base_url/login",
[ username => $user, password => $pass ];
say $ua->request($req)->as_string;

$req = GET "$base_url/users/$user";
say $ua->request($req)->as_string;

0 comments on commit 25f82a4

Please sign in to comment.