Code Monkey home page Code Monkey logo

urlshortener's Introduction

CRAN_Status_Badge

R package for shortening URLs, supporting Bit.ly and is.gd/v.gd

Installing

Either see CRAN badge above or use devtools to install the latest version from Github:

library(devtools)
devtools::install_github("dmpe/urlshorteneR", build_vignettes = FALSE)

What has (🚫t) been implemented for Bit.ly:

FINISHED (with testing)

Organizations DONE Implemented βœ”οΈ
GET https://dev.bitly.com/api-reference/#getOrganization βœ”οΈ
GET https://dev.bitly.com/api-reference/#getOrganizations βœ”οΈ
GET https://dev.bitly.com/api-reference/#getOrganizationShortenCounts βœ”οΈ
GET https://dev.bitly.com/api-reference/#getPlanLimits βœ”οΈ
https://dev.bitly.com/v4/#tag/BSDs DONE Implemented βœ”οΈ
GET https://dev.bitly.com/api-reference/#getBSDs βœ”οΈ
GET https://dev.bitly.com/api-reference/#getOverridesForGroups βœ”οΈ
https://dev.bitly.com/api-reference#getOAuthApp DONE Implemented βœ”οΈ
GET https://api-ssl.bitly.com/v4/apps/{client_id} βœ”οΈ
https://dev.bitly.com/v4/#tag/User DONE Implemented βœ”οΈ
PATCH https://api-ssl.bitly.com/v4/user βœ”οΈ
GET https://api-ssl.bitly.com/v4/user βœ”οΈ
GET https://api-ssl.bitly.com/v4/user/platform_limits βœ”οΈ
https://dev.bitly.com/v4/#tag/Groups DONE Implemented βœ”οΈ
GET https://api-ssl.bitly.com/v4/groups/{group_guid}/preferences βœ”οΈ
PATCH https://api-ssl.bitly.com/v4/groups/{group_guid}/preferences βœ”οΈ
GET https://api-ssl.bitly.com/v4/groups/{group_guid}/bitlinks βœ”οΈ
GET https://api-ssl.bitly.com/v4/groups/{group_guid}/tags βœ”οΈ
GET https://api-ssl.bitly.com/v4/groups/{group_guid}/countries βœ”οΈ
GET https://api-ssl.bitly.com/v4/groups/{group_guid}/cities βœ”οΈ
GET https://api-ssl.bitly.com/v4/groups/{group_guid}/devices βœ”οΈ
GET https://api-ssl.bitly.com/v4/groups/{group_guid}/referring_networks βœ”οΈ
GET https://api-ssl.bitly.com/v4/groups/{group_guid}/shorten_counts βœ”οΈ
GET https://api-ssl.bitly.com/v4/groups βœ”οΈ
GET https://api-ssl.bitly.com/v4/groups/{group_guid}/bitlinks/{sort} βœ”οΈ
PATCH https://api-ssl.bitly.com/v4/groups/{group_guid} βœ”οΈ
GET https://api-ssl.bitly.com/v4/groups/{group_guid} βœ”οΈ
https://dev.bitly.com/v4/#tag/Campaigns DONE Implemented βœ”οΈ/🚫
GET https://api-ssl.bitly.com/v4/campaigns βœ”οΈ
POST https://api-ssl.bitly.com/v4/campaigns βœ”οΈ
GET https://api-ssl.bitly.com/v4/channels βœ”οΈ
GET https://api-ssl.bitly.com/v4/campaigns/{campaign_guid} βœ”οΈ
PATCH https://api-ssl.bitly.com/v4/campaigns/{campaign_guid} βœ”οΈ
GET https://api-ssl.bitly.com/v4/channels/{channel_guid} βœ”οΈ
PATCH https://api-ssl.bitly.com/v4/channels/{channel_guid} βœ”οΈ
https://dev.bitly.com/v4/#tag/Custom-Bitlinks DONE Implemented βœ”οΈ/🚫
GETPOST https://api-ssl.bitly.com/v4/custom_bitlinks βœ”οΈ
GET https://api-ssl.bitly.com/v4/custom_bitlinks/{custom_bitlink}/clicks_by_destination βœ”οΈ
PATCH https://api-ssl.bitly.com/v4/custom_bitlinks/{custom_bitlink} βœ”οΈ
GET https://api-ssl.bitly.com/v4/custom_bitlinks/{custom_bitlink} βœ”οΈ
https//dev.bitly.com/v4/#tag/Bitlinks Implemented βœ”οΈ/🚫
POST https://api-ssl.bitly.com/v4/bitlinks βœ”οΈ
POST https://api-ssl.bitly.com/v4/shorten βœ”οΈ
POST https://api-ssl.bitly.com/v4/expand βœ”οΈ
PATCH https://api-ssl.bitly.com/v4/bitlinks/{bitlink} βœ”οΈ
GET https://api-ssl.bitly.com/v4/bitlinks/{bitlink}/referrers βœ”οΈ
GET https://api-ssl.bitly.com/v4/bitlinks/{bitlink}/clicks/summary βœ”οΈ
GET https://api-ssl.bitly.com/v4/bitlinks/{bitlink}/clicks βœ”οΈ
GET https://api-ssl.bitly.com/v4/bitlinks/{bitlink}/countries βœ”οΈ
GET https://api-ssl.bitly.com/v4/bitlinks/{bitlink} βœ”οΈ
GET https://api-ssl.bitly.com/v4/bitlinks/{bitlink}/referrers_by_domains βœ”οΈ
GET https://api-ssl.bitly.com/v4/bitlinks/{bitlink}/referring_domains βœ”οΈ
GET https://api-ssl.bitly.com/v4/groups/{group_guid}/bitlinks/{sort} βœ”οΈ
GET https://api-ssl.bitly.com/v4/groups/{group_guid}/bitlinks βœ”οΈ

Help needed !!!

  • Testers with the "enterprise" Bit.ly accounts.
  • Testing Ow.ly support (this requires their API key)

Looking for examples and current implementation status ?

Check the vignette in vignettes folder.

How to contribute

See Contribute.md

Credits:

Meta

urlshortener's People

Contributors

andodet avatar dmpe avatar rickpack avatar yogat3ch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

urlshortener's Issues

Checking in

Thanks for adding me to the repo. I assume you saw some earlier work I started but never got around to completing. Happy to help if you need a collaborator. Cheers.

Migrate bit.ly from v3 to v4. Test with others too

I am seeing Code: 500 - MISSING_ARG_ACCESS_TOKEN when I call functions including bitly_UserInfo(). Might this mean I am not properly authorized?

bitly_token is not returning an error and shows:

authorize: https://bitly.com/oauth/authorize access: https://api-ssl.bitly.com/oauth/access_token bitly key: 0f5320d633ef283e8dbc7165c96071033b79e3f3 secret: status_code, data, status_txt ---

A cause of the problem could be my entries in the bit.ly OAUTH APP registration, namely:
APPLICATION LINK: http://localhost:1410/
REDIRECT URIS: http://localhost:1410/

bitly_token$credentials$status_code returns 401, which apparently means UNAUTHORIZED.

Forgive me, I am not very familiar with the web authentication space. A review of https://dev.bitly.com/authentication.html did not help.

Failure with dev version of testthat

checking tests ... ERROR
Running the tests in β€˜tests/testthat.R’ failed.
Last 13 lines of output:

      View

  1. Failure (at test-UserMetrics.R#18): Returns the aggregate number of clicks on all of the authenticated user's Bitlinks. 
  umc not equal to 6
  7 - 6 == 1

  testthat results ================================================================
  OK: 29 SKIPPED: 0 FAILED: 1
  1. Failure (at test-UserMetrics.R#18): Returns the aggregate number of clicks on all of the authenticated user's Bitlinks. 

  Error: testthat unit tests failed
  Execution halted
DONE
Status: 1 ERROR

I'm going to submit to CRAN later today, so you may want to prepare a new release soon. Not sure why this didn't come up in the previous checks, although given the test text, it may be a problem on your end.

Prepare DEBUG url to show

Meaninig that url which is requested from server, when it has been build through (GET, param = list())

Trying to run a simple example, cannot authenticate

library(urlshorteneR)

bitly_auth() ## OK
x <- bitly_retrieve_bitlink()

Error in gzfile(file, "rb") : cannot open the connection
In addition: Warning message:
In gzfile(file, "rb") :
  cannot open compressed file 'tests/bitly_local_token.rds', probable reason 'No such file or directory'

[Wont happen] Onboarding process rOpenSci

Prepare for filing an issue https://github.com/ropensci/onboarding/issues

  • Tested on Linux Ubuntu 14.04 and Win.10 with R PRO (now $MSFT)
  • Naming convections should now be OK
  • tests, travis, docs - are all added.

Bugs:

bitly returns "Status 200" even if the "longUrl" argument is missing

Hello,

first of all - I'm not an expert with APIs.... 😏
I struggled a little bit trying to figure out, how to catch the response of bitly_LinksShorten if I call the function with an empty longUrl argument

bitly_LinksShorten("")
Dataframe mit 0 Spalten und 1 Zeile

To catch this, I have to do something like is(ncol == 0), or to check the input before of course. But it seems that the 'problem' is bitly itself. Here I'm using the GET-request from your code and set longUrl to "".

query <- list(access_token = bitly_token$credentials$access_token, longUrl = "")
return_request <- httr::GET("https://api-ssl.bitly.com/v3/shorten", query = query, httr::config(token = bitly_token))

> return_request
Response [https://api-ssl.bitly.com/v3/shorten?access_token=207b9e68ff2d50a113b21bc5af78280f4550cc41&longUrl=]
  Date: 2016-02-02 16:46
  Status: 200
  Content-Type: application/json; charset=utf-8
  Size: 68 B

I would not expect a "Status 200" here and if I call the content object I get a Status 500 with a proper text message.

> httr::content(return_request)
$data
list()

$status_code
[1] 500

$status_txt
[1] "MISSING_ARG_URI"

Maybe you could add a check somewhere around here and return NA if the status is not 200.
https://github.com/dmpe/urlshorteneR/blob/master/R/ApiKey.R#L92

And yes, if you want, I could try to write a pull request.

Thank you for the package!
Ciao
Patrick

lexical error

Hi and thank you for your package!

Ive been using it a while and saw today that i get an error when i tried to run it.

The function I use is: isgd_LinksShorten(longUrl = long_url, showRequestURL = FALSE)

And the error I get is: Error: lexical error: invalid char in json text.
<!--[if lt IE 7
(right here) ------^

I havent updated any packages lately. Ive tried various urls, i keep getting the same error.

Thanks

Regards
Jan

authentication first use

on first use the failure behavior could be a bit better

bitly_LinksShorten(longUrl = "http://www.opencoesione.gov.it/progetti/1si366/")
#> Error in bitly_LinksShorten(longUrl = "http://www.opencoesione.gov.it/progetti/1si366/") : 
#>   object 'bitly_token' not found

maybe a meaningful message about what to do to authenicate

😸

Add capacity to load saved tokens & check for token before re-auth

Hi folks!
Thanks for putting urlshorteneR together!
I was using it today and noticed some difficulties trying to use it non-interactively.

I forked it and added some needed capacities for working non-interactively with the package in #19

Hope ya'll find the modifications helpful!

Problem with timeout

problem in corporate environment where a web browser (chrome) can get to is.gd shortener but when I run it from urlshortener I get timeout. It is of 10 seconds which should be default httr timeout. is.gd is reached via various browsers in 2 to 3 seconds.

> isgd_LinksShorten("http://neverssl.org")
Error in curl::curl_fetch_memory(url, handle = handle) : 
  Failed to connect to is.gd port 80: Timed out

Initially I thought to try increasing timeout, but that does not seem to be an issue. How does one go about troubleshooting this kind of scenario? Many thanks, Roberts

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.