def post_photo(self, photo_data, caption=''):
        """
        Post a photo

        :param photo_data: byte string of the image
        :param caption: caption text
        """
        warnings.warn('This endpoint has not been fully tested.', UserWarning)

        self._init_rollout_hash()

        upload_id = int(time.time() * 1000)
        boundary = '----WebKitFormBoundary{}'.format(
            ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(16)))
        fields = [
            ('upload_id', upload_id),
            ('media_type', 1),
        ]
        files = [
            ('photo', 'photo.jpg', 'application/octet-stream', photo_data)
        ]
        content_type, body = MultipartFormDataEncoder(boundary=boundary).encode(
            fields, files)
        headers = {
            'User-Agent': self.mobile_user_agent,
            'Accept': '*/*',
            'Accept-Language': 'en-US',
            'Accept-Encoding': 'gzip, deflate',
            'Connection': 'close',
            'x-csrftoken': self.csrftoken,
            'x-requested-with': 'XMLHttpRequest',
            'x-instagram-ajax': self.rollout_hash,
            'Origin': 'https://www.instagram.com',
            'Referer': 'https://www.instagram.com/create/crop/',
            'Content-Type': content_type,
            'Content-Length': len(body)
        }
        endpoint = 'https://www.instagram.com/create/upload/photo/'
        req = compat_urllib_request.Request(endpoint, body, headers=headers)
        self.logger.debug('REQUEST: {0!s}'.format(endpoint))

        try:
            res = self.opener.open(req, timeout=self.timeout)
            response_content = self._read_response(res)

            self.logger.debug('RESPONSE: {0!s}'.format(response_content))
            upload_res = json.loads(response_content)
            if upload_res.get('status', '') != 'ok':
                raise ClientError('Upload status: {}'.format(upload_res.get('status', '')))
            upload_id = upload_res['upload_id']

            headers['Referer'] = 'https://www.instagram.com/create/details/'
            headers['Content-Type'] = 'application/x-www-form-urlencoded'
            del headers['Content-Length']
            endpoint = 'https://www.instagram.com/create/configure/'
            res = self._make_request(
                endpoint, headers=headers,
                params={
                    'upload_id': upload_id,
                    'caption': caption,
                    'retry_timeout': '',
                    'custom_accessibility_caption': '',
                },
                get_method=lambda: 'POST')
            return res

        except compat_urllib_error.HTTPError as e:
            raise ClientError('HTTPError "{0!s}" while opening {1!s}'.format(e.reason, endpoint), e.code)

        Post a photo

        :param photo_data: byte string of the image
        :param caption: caption text
        
instagram_web_api/client.py