Skip to content

Commit

Permalink
More housekeeping.
Browse files Browse the repository at this point in the history
  • Loading branch information
baphled committed Dec 10, 2008
1 parent 68dd0e9 commit 26606e0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions twitterl.erl
Expand Up @@ -96,6 +96,7 @@ handle_call({Client, Method, Args}, _From, State) ->
handle_call(_, _From, State) -> {noreply, ok, State}.

terminate(_Reason, State) ->
io:format("Shutting down...~n"),
{ok,State}.

code_change(_OldVsn, State, _Extra) ->
Expand Down
10 changes: 5 additions & 5 deletions twitterl_interface.erl
Expand Up @@ -62,7 +62,7 @@ trends() ->
parse_json(?SearchTrendsUrl).

parse_json(Url) ->
case request_url(Url, nil, nil) of
case request_url(get, Url, nil, nil) of
{ok,Body} ->
Json = json_parser:dvm_parser(list_to_binary(Body)),
{ok,{struct,Reply},_} = Json,
Expand Down Expand Up @@ -150,7 +150,7 @@ public_timeline() ->

%% Checks to see if the user can actually log in.
auth_user(Login, Password) ->
case request_url(?VerifyUrl, Login, Password) of
case request_url(get,?VerifyUrl, Login, Password) of
{ok,Body} ->
case Body of
"<authorized>true</authorized>" -> true;
Expand Down Expand Up @@ -216,7 +216,7 @@ get_xml(Url) ->
get_xml(Url, nil, nil).
%% Get the actual XML response.
get_xml(Url,Login,Password) ->
case request_url(Url,Login,Password) of
case request_url(get,Url,Login,Password) of
{ok, Body} ->
{ok, get_body(Body)};
{error, Error} ->
Expand Down Expand Up @@ -318,10 +318,10 @@ format_text(Xml, [Xpath | Tail], Result) ->
format_text(Xml, Tail, Results).

%% Make a request to an URL.
request_url(Url,nil,nil) ->
request_url(get,Url,nil,nil) ->
check_response(http:request(get, {Url, headers(nil, nil)}, [], []));
%% Make an authenticated request to the specified URL.
request_url(Url, Login, Pass) ->
request_url(get,Url, Login, Pass) ->
check_response(http:request(get, {Url, headers(Login, Pass)}, [], [])).

%% Checks out HTTP response, if we get a 200 retrieve
Expand Down

0 comments on commit 26606e0

Please sign in to comment.