Git Product home page Git Product logo

devdocs-lookup's People

Contributors

juergenhoetzel avatar kaushalmodi avatar nnoodle avatar skeeto avatar suonlight avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

devdocs-lookup's Issues

Python lookup fails because of 403 from devdocs.io

The exact emacs Backtrace is

Debugger entered--Lisp error: (json-readtable-error 60)
  signal(json-readtable-error (60))
    debugger-may-continue = t
    inhibit-redisplay = nil
    inhibit-debugger = t
    inhibit-changing-match-data = nil
  json-read()
    [no locals]
  (puthash v (json-read) v)
    [no locals]
  (let* ((v subject) (v devdocs-index)) (puthash v (json-read) v))
    subject = "python"
    callback = nil
    index = nil
    url = "https://docs.devdocs.io/python/index.json"
    v = "python"
    v = #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data ( ...))
  (save-current-buffer (set-buffer (url-retrieve-synchronously url nil t)) (goto-char url-http-end-of-headers) (let* ((v subject) (v devdocs-index)) (puthash v (json-read) v)))
    [no locals]
  (cond ((and index callback) (funcall callback index)) ((and index (not callback)) index) ((and (not index) (not callback)) (save-current-buffer (set-buffer (url-retrieve-synchronously url nil t)) (goto-char url-http-end-of-headers) (let* ((v subject) (v devdocs-index)) (puthash v (json-read) v)))) ((and (not index) callback) (url-retrieve url (function (lambda (_) (goto-char url-http-end-of-headers) (let* ((v subject) (v devdocs-index)) (puthash v (json-read) v)) (funcall callback (gethash subject devdocs-index)))))))
    [no locals]
  (let ((index (gethash subject devdocs-index)) (url (format "%s/%s/index.json" devdocs-base-index-url subject))) (cond ((and index callback) (funcall callback index)) ((and index (not callback)) index) ((and (not index) (not callback)) (save-current-buffer (set-buffer (url-retrieve-synchronously url nil t)) (goto-char url-http-end-of-headers) (let* ((v subject) (v devdocs-index)) (puthash v (json-read) v)))) ((and (not index) callback) (url-retrieve url (function (lambda (_) (goto-char url-http-end-of-headers) (let* (... ...) (puthash v ... v)) (funcall callback (gethash subject devdocs-index))))))))
    subject = "python"
    callback = nil
    index = nil
    url = "https://docs.devdocs.io/python/index.json"
  devdocs-index("python")
    subject = "python"
    callback = nil
  (assoc (quote entries) (devdocs-index subject))
    [no locals]
  (cdr (assoc (quote entries) (devdocs-index subject)))
    [no locals]
  (let* ((--cl-vec-- (cdr (assoc (quote entries) (devdocs-index subject)))) (--cl-idx-- -1) (entry nil) (--cl-var-- nil)) (while (< (setq --cl-idx-- (1+ --cl-idx--)) (length --cl-vec--)) (setq entry (aref --cl-vec-- --cl-idx--)) (setq --cl-var-- (cons (cons (cdr (assoc (quote name) entry)) (cdr (assoc (quote path) entry))) --cl-var--))) (nreverse --cl-var--))
    [no locals]
  devdocs-entries("python")
    subject = "python"
  (mapcar (function car) (devdocs-entries subject))
    [no locals]
  (let* ((names (mapcar (function car) (devdocs-entries subject))) (hist (intern (format "devdocs--hist-%s" subject))) (symbol (symbol-at-point)) (best-match (and symbol (devdocs--best-match (symbol-name symbol) names))) (prompt (if best-match (format "Entry (%s) [%s]: " best-match subject) (format "Entry [%s]: " subject)))) (completing-read prompt names nil :require-match nil hist best-match))
    [no locals]
  devdocs-read-entry("python")
    subject = "python"
  (let* ((case-fold-search t) (major-mode-string (replace-regexp-in-string "-mode$" "" (symbol-name major-mode))) (subject-dwim (car (cdr (cl-assoc major-mode-string devdocs-subjects :test (function string-match-p))))) (subject (if current-prefix-arg (devdocs-read-subject) (or devdocs--default-subject subject-dwim (devdocs-read-subject)))) (entry (devdocs-read-entry subject))) (if subject (progn (setq devdocs--default-subject subject))) (list subject entry))
    case-fold-search = t
    major-mode-string = "python"
    subject-dwim = "python"
    subject = "python"
  call-interactively(devdocs-lookup nil nil)
    [no locals]
  command-execute(devdocs-lookup)
    [no locals]

When I try to fetch https://docs.devdocs.io/python/index.json via curl or wget, I receive a 403.

There's a closed issue at freeCodeCamp/devdocs#124 which hints that devdocs.io issues 403s if the resource is not present (instead of 404, surprise!).

When I look at the network tab in chromium while browsing devdocs.io I see urls that look like the following:

https://devdocs.io/docs/python~2.7/index.json?1490461005
https://devdocs.io/docs/python~3.5/index.json?1490460934

As a workaround it helps to extend my use-package stanza with the following config form so I can at least lookup Python 3.5 on devdocs:

(use-package devdocs-lookup
  :bind (("C-c d" . devdocs-lookup))
  :config (setf devdocs-base-index-url "https://devdocs.io/docs/"
                (cadr (assoc "Python" devdocs-subjects)) "python~3.5"))

(Of course it just occured to me that I should probably define a prefix map, because I frequently have to lookup django and other things, so the automatic guessing doesn't really help a lot. It's similar with javascript, I guess, for node, d3, angular, etc...)

Package Status

Is this still maintained? Any plans to publish to melpa?

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.