mozilla/agithub

how to use full URL as string

mithom opened this issue · 3 comments

in many api's, github returns full URL's to the client.
Am i able to use these URL's without having to strip the whole http://api.github.com part?

i would like for my code to not break at the slightest change github makes.
any ideas on how i can accomplish this?

agithub just provides an agnostic library to access REST endpoints so things like how to parse and process the content within the JSON payload coming back from an endpoint would be outside the domain of the tool.

I'd recommend contacting GitHub support for guidance on how best to use the payloads from their API responses.

If I've misunderstood what you were asking about and it is actually something that relates to the agithub library do let me know and I'll endeavor to better understand what the issue is.

the part of the question that would apply to the tool is the part where i can use the URL.
The URL is of the format https://api.github.com/some/endpoint
my question is if there is a way to use URL's of this format, or should i parse them to get the endpoint part of the URL out of there?

seeing your previous answer i suppose i can't use it directly.

@mithom I think I understand. The sequence you want to follow is something like

  1. Query GitHub using agithub method
  2. Get JSON response from GitHub
  3. Use the URLs embedded in the JSON response to make a second query to GitHub

Ya, agithub doesn't natively have any support for a workflow like this. You could

  1. Ignore the URLs in the API responses and just keep calling agithub methods
  2. Use agithub for the first query then use requests for subsequent queries
  3. Use requests for all the queries