Flickr API need a hash string which made using post arguments

    :param args: Arguments of the flickr request
    :type args: list of sets
    :return: api_sig, ex: ('api_sig', 'abcdefg')
    :rtype: tuple
10692
def _get_api_sig(args):
    
    tmp_sig = api_secret
    for i in args:
        tmp_sig = tmp_sig + i[0] + i[1]
    api_sig = hashlib.md5(tmp_sig.encode('utf-8')).hexdigest()
    return 'api_sig', api_sig
548907
def _api_handler(self, *args, **kwargs):
        
        keyword_arguments = {}
        keyword_arguments.update(self.keywords)
        keyword_arguments.update(kwargs)
        return api_handler(*args, **keyword_arguments)
276050
def do_args(self, arg):
        
        co = self.curframe.f_code
        dict = self.get_locals(self.curframe)
        n = co.co_argcount
        if co.co_flags & 4: n = n+1
        if co.co_flags & 8: n = n+1
        for i in range(n):
            name = co.co_varnames[i]
            if name in dict:
                self.message('%s = %s' % (name, bdb.safe_repr(dict[name])))
            else:
                self.message('%s = *** undefined ***' % (name,))
1238228
def request_payload(cls, request, request_id):
        ''''''
        if isinstance(request.args, dict):
            raise ProtocolError.invalid_args(
                'JSONRPCv1 does not support named arguments')
        return {
            'method': request.method,
            'params': request.args,
            'id': request_id
        }
830637
def parse_args(args):
    
    parser = argparse.ArgumentParser(
        description='Starts the REST API application and connects to a '
        'specified validator.')

    parser.add_argument('-B', '--bind',
                        help='identify host and port for API to run on \
                        default: http://localhost:8008)',
                        action='append')
    parser.add_argument('-C', '--connect',
                        help='specify URL to connect to a running validator')
    parser.add_argument('-t', '--timeout',
                        help='set time (in seconds) to wait for validator \
                        response')
    parser.add_argument('--client-max-size',
                        type=int,
                        help='the max size (in bytes) of a request body')
    parser.add_argument('-v', '--verbose',
                        action='count',
                        default=0,
                        help='enable more verbose output to stderr')
    parser.add_argument('--opentsdb-url',
                        help='specify host and port for Open TSDB database \
                        used for metrics')
    parser.add_argument('--opentsdb-db',
                        help='specify name of database for storing metrics')

    try:
        version = pkg_resources.get_distribution(DISTRIBUTION_NAME).version
    except pkg_resources.DistributionNotFound:
        version = 'UNKNOWN'

    parser.add_argument(
        '-V', '--version',
        action='version',
        version=(DISTRIBUTION_NAME + ' (Hyperledger Sawtooth) version {}')
        .format(version),
        help='display version information')

    return parser.parse_args(args)
819927
def hashZ(*args):
    
    TAG = "TAG_RELIC_HASH_Z"
    MESSAGE = "MESSAGE_HASH_Z"

    # Combine the arguments into a canonical string representation.
    text = TAG.join([str(val) for val in args ] )

    # Hash the string using HMAC
    # b: byte string 
    b = hmac(text, MESSAGE)
    return BigInt(longFromString(b))
858441
def _post(self, url, data=None, **kwargs):
        

        # Remove non-ASCII characters from filenames due to a limitation of the combination of
        # urllib3 (via python-requests) and our server
        # https://github.com/requests/requests/issues/2117
        # Internal Ticket #3090
        if "files" in kwargs and kwargs["files"] is not None:
            acceptable_chars = "0123456789" + "abcdefghijklmnopqrstuvwxyz" + \
                               "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + " _-.,()[]{}"
            for param_name, fp in kwargs["files"].items():
                if isinstance(fp, (tuple, list)):
                    filename, fp = fp
                else:
                    filename = requests.utils.guess_filename(fp) or param_name

                def encode(char):
                    try:
                        if char in acceptable_chars:
                            return char
                    except UnicodeDecodeError:
                        pass
                    return "x{:02x}".format(ord(char))
                filename = "".join(encode(x) for x in filename)

                kwargs["files"][param_name] = (filename, fp)

        for i in itertools.count(1):
            try:
                return self.session.post(url, data=data, timeout=self.timeout, **kwargs)
            except requests.exceptions.Timeout as e:
                # exhausted all retries
                if i >= self.retries:
                    raise ConnectionError(e)
            except requests.exceptions.RequestException as e:
                raise ConnectionError(e)

            # exponential backoff
            max_backoff = 4 ** i / 10   # .4, 1.6, 6.4, 25.6, ...
            time.sleep(random.uniform(0, max_backoff))
561184
def uri(resource, args = {})
      uri = resource.uri(args)

      query_values  = args[:query]   || {}
      header_values = args[:headers] || {}

      params.each { |param|
        name = param.name

        if param.style == 'header'
          value = header_values[name] || header_values[name.to_sym]
          value = param % value

          uri.headers[name] = value if value
        else
          value = query_values[name] || query_values[name.to_sym]
          value = param.format(value, nil, 'query')

          uri.query << value if value && !value.empty?
        end
      }

      uri
    end
866212
def request_args(self):
        """"""
        args = flask.request.args
        data_raw = {}

        for field_name, field in self.args_schema.fields.items():
            alternate_field_name = field.load_from if MA2 else field.data_key

            if alternate_field_name and alternate_field_name in args:
                field_name = alternate_field_name
            elif field_name not in args:
                # getlist will return an empty list instead of raising a
                # KeyError for args that aren't present.
                continue

            value = args.getlist(field_name)
            if not self.is_list_field(field) and len(value) == 1:
                value = value[0]

            data_raw[field_name] = value

        return self.deserialize_args(data_raw)
1063012
def make_url(invocation, args=[], kwargs={}):
    
    if not invocation.endswith('/'):
        invocation += '/'
    if not invocation.startswith('/'):
        invocation = '/' + invocation

    url = invocation

    for arg in args:
        url += str(arg) + "/"

    if kwargs:
        url = url[:-1]
        url += "?" + urlencode(kwargs)
    
    return url
242351
def args_as_tuple(self):
        """"""
        result = ("currentdate", )
        result += (
            ":zone",
            self.extra_arguments["zone"].strip('"'),
            self.arguments["match-type"],
        )
        if self.arguments["match-type"] in [":count", ":value"]:
            result += (self.extra_arguments["match-type"].strip('"'), )
        result += (self.arguments["date-part"].strip('"'), )
        value = self.arguments["key-list"]
        if isinstance(value, list):
            # FIXME
            value = "[{}]".format(
                ",".join('"{}"'.format(item) for item in value))
        if value.startswith("["):
            result = result + tuple(tools.to_list(value))
        else:
            result = result + (value.strip('"'),)
        return result
969350
def repr_args(args):
    
    res = []
    for x in args:
        if isinstance(x, tuple) and len(x) == 2:
            key, value = x
            # todo: exclude this key if value is its default
            res += ["%s=%s" % (key, repr_arg(value))]
        else:
            res += [repr_arg(x)]
    return ', '.join(res)
892646
def get_arguments(self):
        

        parser = argparse.ArgumentParser(
            description='Downloads images from given URL')
        parser.add_argument('url2scrape', nargs=1, help="URL to scrape")
        parser.add_argument('-m', '--max-images', type=int, default=None,
                            help="Limit on number of images\n")
        parser.add_argument('-s', '--save-dir', type=str, default="images",
                            help="Directory in which images should be saved")
        parser.add_argument('-g', '--injected', help="Scrape injected images",
                            action="store_true")
        parser.add_argument('--proxy-server', type=str, default=None,
                            help="Proxy server to use")
        parser.add_argument('--min-filesize', type=int, default=0,
                            help="Limit on size of image in bytes")
        parser.add_argument('--max-filesize', type=int, default=100000000,
                            help="Limit on size of image in bytes")
        parser.add_argument('--dump-urls', default=False,
                            help="Print the URLs of the images",
                            action="store_true")
        parser.add_argument('--formats', nargs="*", default=None,
                            help="Specify formats in a list without any separator.\
                                  This argument must be after the URL.")
        parser.add_argument('--scrape-reverse', default=False,
                            help="Scrape the images in reverse order",
                            action="store_true")
        parser.add_argument('--filename-pattern', type=str, default=None,
                            help="Only scrape images with filenames that\
                                  match the given regex pattern")
        parser.add_argument('--nthreads', type=int, default=10,
                            help="The number of threads to use when downloading images.")
        args = parser.parse_args()
        self.url = args.url2scrape[0]
        if not re.match(r'^[a-zA-Z]+://', self.url):
            self.url = 'http://' + self.url
        self.no_to_download = args.max_images
        save_dir = args.save_dir + '_{uri.netloc}'.format(
            uri=urlparse(self.url))
        if args.save_dir != "images":
            save_dir = args.save_dir
        self.download_path = os.path.join(os.getcwd(), save_dir)
        self.use_ghost = args.injected
        self.format_list = args.formats if args.formats else [
            "jpg", "png", "gif", "svg", "jpeg"]
        self.min_filesize = args.min_filesize
        self.max_filesize = args.max_filesize
        self.dump_urls = args.dump_urls
        self.proxy_url = args.proxy_server
        self.proxies = {}
        if self.proxy_url:
            if not re.match(r'^[a-zA-Z]+://', self.proxy_url):
                self.proxy_url = 'http://' + self.proxy_url
            proxy_start_length = self.proxy_url.find("://") + 3
            self.proxies = {
                self.proxy_url[:(proxy_start_length - 3)]: self.proxy_url
            }

        self.scrape_reverse = args.scrape_reverse
        self.filename_pattern = args.filename_pattern
        self.nthreads = args.nthreads
        return (self.url, self.no_to_download, self.format_list,
                self.download_path, self.min_filesize, self.max_filesize,
                self.dump_urls, self.scrape_reverse, self.use_ghost, self.filename_pattern)
848496
function listWebm (...args) {
  let board
  let threadNo
  let protocol

  if (args[1] === undefined) {
    ;({ board, threadNo, protocol } = parseUrl(args[0]))
  } else {
    [ board, threadNo ] = args
    args[2] = args[2] || {}
    protocol = args[2].https ? 'https' : 'http'
  }

  const apiUrl = `${protocol}://a.4cdn.org/${board}/thread/${threadNo}.json`

  return axios.get(apiUrl).then(res => transform(res.data, protocol, board))
}
1210383
def arg_to_json(arg):
    
    conversion = json_conversions.get(type(arg))
    if conversion:
        return conversion(arg)
    for type_ in subclass_conversions:
        if isinstance(arg, type_):
            return json_conversions[type_](arg)
    return json_conversions[str](arg)
564663
def build_args(args)
      args.each do |arg|
        arg.each do |key, value|
          case key.to_s
          when 'query_params'
            @query_params = value
          when 'request_headers'
            update_headers(value)
          when 'request_body'
            @request_body = value
          end
        end
      end
    end
270143
def post(arguments):
    ''''''
    twitter = api.API(arguments)
    params = {}

    if arguments.update == '-':
        params['status'] = sys.stdin.read()
    else:
        params['status'] = arguments.update

    if arguments.media_file:
        medias = [twitter.media_upload(m) for m in arguments.media_file]
        params['media_ids'] = [m.media_id for m in medias]

    try:
        logging.getLogger(arguments.screen_name).info('status: %s', params['status'])
        if not arguments.dry_run:
            twitter.update_status(**params)

    except tweepy.TweepError as e:
        logging.getLogger(arguments.screen_name).error(e.message)