GithubHelp home page GithubHelp logo

image upload not working about twitter-lite HOT 8 CLOSED

draftbit avatar draftbit commented on August 19, 2024 1
image upload not working

from twitter-lite.

Comments (8)

Djiit avatar Djiit commented on August 19, 2024 4

Might be related to the fact that the media/upload endpoint is on the 'upload' subdomain, not the 'api' one.

from twitter-lite.

insanity54 avatar insanity54 commented on August 19, 2024 3

There's a good example of creating two clients in the test suite, while keeping it DRY. One for api endpoint, one for upload endpoint.

function newClient(subdomain = 'api') {
  return new Twitter({
    subdomain,
    consumer_key: TWITTER_CONSUMER_KEY,
    consumer_secret: TWITTER_CONSUMER_SECRET,
    access_token_key: ACCESS_TOKEN,
    access_token_secret: ACCESS_TOKEN_SECRET,
  });
}

then you can do--

const uploadClient = newClient('upload');
const apiClient = newClient();

from twitter-lite.

Djiit avatar Djiit commented on August 19, 2024 1

No worries, I can't even remember what it was :-). I'm glad you are triaging all this, good luck !

from twitter-lite.

Art3miX avatar Art3miX commented on August 19, 2024 1

I know its not optimal, but to over come this I simply have 2 objects to handle the api and the upload subdomains.

const TWApi     = new twitter({
    consumer_key:        TWITTER.API_KEY,
    consumer_secret:     TWITTER.SECRET,
    access_token_key:    result.token,
    access_token_secret: result.secret,
  }),
  uploadApi = new twitter({
    subdomain:           'upload',
    consumer_key:        TWITTER.API_KEY,
    consumer_secret:     TWITTER.SECRET,
    access_token_key:    result.token,
    access_token_secret: result.secret,
  });

It seems to be that the fix is simple, just to change the subdomain of of the request based on the resource given.

from twitter-lite.

peterpme avatar peterpme commented on August 19, 2024

Hey @Djiit sorry for the delay. Were you able to figure this out?

from twitter-lite.

dylanirlbeck avatar dylanirlbeck commented on August 19, 2024

Hey @Djiit, just checking in --- were you able to figure this out? We'd like to close this issue if so.

from twitter-lite.

linuxandchill avatar linuxandchill commented on August 19, 2024

worth reopening?

from twitter-lite.

peterpme avatar peterpme commented on August 19, 2024

@linuxandchill can ya fix it?

from twitter-lite.

Related Issues (20)

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.