예제 #1
0
        private void Initialize()
        {
            string appDataFolder = Factory.Settings["AppDataFolder"];

            if (appDataFolder == null)
            {
                throw new ApplicationException("Sorry, AppDataFolder must be set in the app.config file.");
            }
            string configFile = appDataFolder + @"/Providers/eSignalProviderService.config";

            LoadProperties(configFile);

            esignal = new HooksClass();
            esignal.OnQuoteChanged += new _IHooksEvents_OnQuoteChangedEventHandler(esignal_OnQuoteChanged);

            //attempt to login to esignal
            try
            {
                string pw = GetProperty("esignalaccount");
                esignal.SetApplication(pw);
            }
            catch (Exception e)
            {
                //MessageBox.Show("Not Entitled! Check User Name.")
                Console.WriteLine(e.ToString());
            }

            //just to be sure its clean
            esignal.ClearSymbolCache();

            Thread.Sleep(5000);
        }
예제 #2
0
        ///     """A user-created :class:`Request <Request>` object.
        ///
        ///     Used to prepare a :class:`PreparedRequest <PreparedRequest>`, which is sent to the server.
        ///
        ///     :param method: HTTP method to use.
        ///     :param url: URL to send.
        ///     :param headers: dictionary of headers to send.
        ///     :param files: dictionary of {filename: fileobject} files to multipart upload.
        ///     :param data: the body to attach to the request. If a dictionary is provided, form-encoding will take place.
        ///     :param json: json for the body to attach to the request (if files or data is not specified).
        ///     :param params: dictionary of URL parameters to append to the URL.
        ///     :param auth: Auth handler or (user, pass) tuple.
        ///     :param cookies: dictionary or CookieJar of cookies to attach to this request.
        ///     :param hooks: dictionary of callback hooks, for internal usage.
        ///
        ///     Usage::
        ///
        ///       >>> import requests
        ///       >>> req = requests.Request('GET', 'http://httpbin.org/get')
        ///       >>> req.prepare()
        ///       <PreparedRequest [GET]>
        ///
        ///     """
        ///     def __init__(self, method=None, url=None, headers=None, files=None,
        ///         data=None, params=None, auth=None, cookies=None, hooks=None, json=None):
        ///
        ///         # Default empty dicts for dict params.
        ///         data = [] if data is None else data
        ///         files = [] if files is None else files
        ///         headers = {} if headers is None else headers
        ///         params = {} if params is None else params
        ///         hooks = {} if hooks is None else hooks
        ///
        ///         self.hooks = default_hooks()
        ///         for (k, v) in list(hooks.items()):
        ///             self.register_hook(event=k, hook=v)
        ///
        ///         self.method = method
        ///         self.url = url
        ///         self.headers = headers
        ///         self.files = files
        ///         self.data = data
        ///         self.json = json
        ///         self.params = params
        ///         self.auth = auth
        ///         self.cookies = cookies
        public Request(string Method = null, string URL = null, Dictionary <string, List <object> > Hooks = null,
                       Dictionary <string, string> Cookies = null)
        {
            var hooks = Hooks ?? new Dictionary <string, List <object> >();

            base.Hooks = HooksClass.DefaultHooks <object>();
            foreach (var x in hooks)
            {
            }

            this.Method  = Method ?? string.Empty;
            this.URL     = URL ?? string.Empty;
            this.Cookies = Cookies;
        }