masa-finance / masa-oracle

Masa Oracle: Decentralized Data Protocol 🌐
https://developers.masa.ai/docs/masa-protocol/welcome
MIT License
22 stars 18 forks source link

refactor(twitter): set User-Agent globally from config file #545

Closed teslashibe closed 1 month ago

teslashibe commented 2 months ago

Problem:

The User-Agent is currently hardcoded in the getFlow function and not consistently used across all requests. In other parts of the application, requests are using the default Go User-Agent. This inconsistency limits flexibility, makes it difficult to update the User-Agent across the entire application, and may lead to inconsistent behavior or potential blocking of requests by Twitter's servers.

Acceptance Criteria:

  1. Create a config file (e.g., config.go) to store global variables.
  2. Add a UserAgent variable in the config file.
  3. Remove hardcoded User-Agent from getFlow function.
  4. Modify newRequest function to use the global User-Agent.
  5. Ensure all HTTP requests use the globally defined User-Agent, replacing the default Go User-Agent.
  6. Add a function to allow runtime updates of the User-Agent.
  7. Update tests to verify the new User-Agent implementation.
  8. Document the new User-Agent configuration in the README.
teslashibe commented 2 months ago

@mudler @Luka-Loncar this needs adding to a release

mudler commented 1 month ago

https://github.com/masa-finance/masa-oracle/pull/564