instagram/core

Source   Edit  

Types

IgAuthRequired = object of IOError
  
The request cannot be done without authentication cookies Source   Edit  
IgException = object of IOError
  
Generic error occurred Source   Edit  
IgMissingCsrf = object of IOError
  
The request depends on CSRF Token, but it's not present/valid Source   Edit  
IgTooManyRequests = object of IOError
  
Rate limit exceeded, provide the cookies TODO: Implement Source   Edit  
Instagram = ref object
  ## X-IG-App-ID
  cookies*: string           ## Optional, but without authentication there's a rate limit
  sharedData*: XigSharedData
  
Source   Edit  

Procs

func endpoint(path: string; args: varargs[string, `$`]): string {.
    ...raises: [ValueError], tags: [], forbids: [].}
Source   Edit  
func isLogged(ig: Instagram): bool {....raises: [], tags: [], forbids: [].}
Checks if this Instagram instance is logged in Source   Edit  
proc newInstagram(cookies = ""): Future[Instagram] {....stackTrace: false,
    raises: [Exception, ValueError], tags: [RootEffect, ReadDirEffect,
    ReadEnvEffect, TimeEffect, ReadIOEffect, WriteIOEffect], forbids: [].}
Creates new Instagram instance Source   Edit  
proc prepare(ig: Instagram): owned(Future[void]) {....stackTrace: false,
    raises: [Exception], tags: [RootEffect, ReadDirEffect, ReadEnvEffect,
                                TimeEffect, ReadIOEffect, WriteIOEffect],
    forbids: [].}

Adds to the provided mutable Instagram instance the required codes for API request extracted from a Instagram page

Need to run when IgMissingCsrf is raised

Source   Edit  
proc renameHook[T: object](v: var T; fieldName: var string)
Source   Edit  
proc request(ig: Instagram; httpMethod: HttpMethod; endpoint: string; body = ""): Future[
    string] {....stackTrace: false, raises: [Exception, ValueError], tags: [
    RootEffect, ReadDirEffect, ReadEnvEffect, TimeEffect, ReadIOEffect,
    WriteIOEffect], forbids: [].}
Requests to Instagram internal api Source   Edit